npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

staticit

v1.3.2

Published

Minimal, zero-configuration and fast solution for static site generation in any front-end framework.

Downloads

48

Readme

Staticit - Introduction

Whether you want to increase performance of your web application or improve SEO. Generally you have 2 options, use SSR (Server Side Rendering) or SSG (Static Site Generation). SSR can be cumbersome and you will need a server to host it.

SSG is relatively simple and a good alternative. Some frameworks have this feature out of the box some don't, some are bloated and you may want a simpler solution. Here comes the Staticit!

Staticit is a improved version of a small library called react-spa-prerender. Under the hood it uses express and puppeteer to generate static files.

Since it's standalone it will work with any build tool and any front-end framework that supports routing.

How it works?

  • Serves the web application from build directory with express.
  • Renders & generates desired routes with puppeteer.
  • Reformats all generated HTML files with prettier so they'll be pretty 🥰.

Install

- Latest LTS Node.js is recommended.

  • With npm:
$ npm install -D staticit
  • With yarn:
$ yarn add --dev staticit
  • With pnpm:
$ pnpm install -D staticit

Usage

Create a file called .staticit.json in your project root directory. For minimal configuration add the following lines.

{
  "routes": ["/", "/about"],
  "outDir": "./dist",
  "port": 8080
}

- If you are going to build your application in an automated environment, for example with a CI tool. You should pass the --no-sandbox flag to puppeteer: launchOpts or you might get errors since most of them are running inside of a container with root user. (Ref)

"scripts": {
  ...
  "postbuild": "staticit"
}

References

JSON Reference

| Option | Default | Description | | ---------------------- | -------- | ----------------------------------------------------------------------------------- | | routes | [] | Array of routes that you want to pre-render & generate static files. | | outDir | ./dist | Relative path to the build directory of your application. | | port | 8080 | The port where the static server will serve your web application for the puppeteer. | | puppeteer: launchOpts | {} | Generic launch options that can be passed when launching puppeteer browser. | | puppeteer: waitForOpts | {} | Timeout options for puppeteer browser. |

--

CLI Reference

| Option | Description | | ------------------ | --------------------------------------------- | | --disable-prettier | Disables formatting HTML files with prettier. | | -c, --config | To use with different config file name. |

Examples

License

This repository is licensed under the MIT License.