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

snapshot-env

v0.1.5

Published

Snapshot environments for testing

Downloads

4

Readme

snapshot-env

A utility to take an environment snapshot of a statically built site and host locally for testing purposes.

The output is hosted in its own directory on a temporary server so you can continue developing whilst your branch is being tested by other parties.

Install

$ npm i -g snapshot-env

Or install locally:

$ npm i snapshot-env --save-dev

Usage

Method A (Recommended):

Place a snapshot.json file in your project file with minimum keys of output and build.

e.g

{
  "output": "public",
  "build": "npm run prod",
}

Method B:

Command line arguments can be used to initialise the snapshot.

The command line options are all optional and will take override the snapshot.json options. The command line options are as follows:

'-p', or '--port' Port number to host snapshot on.
'-b,' or '--build' 'Build command to build snapshot'
'-c,' or '--commit' 'Commit ID or Branch name to checkout and build'
'-o'' or '--output' 'Output Directory where the build will be made'

Method C:

Run snapshot-env in the projects root directory and let the wizard take you through your steps. You will have to do this every time if you do not have a snapshot.json file in the projects root directory. This can be useful for quick testing of prototypes.

Usage without snapshot json

Running:

Run snapshot-env in the root directory of the project.

API.

The following explains the keys in the snapshot.json and their intended use.

build

This should be the build command to build your project. It is recommended for this to be your 'production' build step as if you were building for production. N.B. If you are using Create React App this will bundle your app with a service worker, so make sure you clear your browsers service worker in order to see changes deployed.

output

This should be the directory of the output of the build command.

commit

Optional. Commit ID of the snapshot you would like to 'snapshot'. If commit is specified snapshot-env will checkout the commit and create a snapshot of your build at that commit.

License

MIT © Simon Holmes