This package was inspired by npm-snapshot but automates versioning and adds several features, including a version check for production builds.
It's very easy to use.
Unless your build is contained entirely within your js-package I recommend installing globally for use across multiple projects.
There are two cli commands available. Call them in a directory with the relevant package.json file, or pass the path to the package.json file.
This command updates the current version of a package.json file to x.y.z-SNAPSHOT.
Run before build publishes development package version to npm.
The package.json's .version property must be of the format /d+.d+.d+-SNAPSHOT/
When called within the same directory as the package.json file you wish to modify, this command needs no arguments. Alternatively, you may pass a relative or absolute path to the package.json or its directory.
This command scans a package.json file for a version or dependencies ending in /-SNAPSHOT(.\d+)?$/ If any are found it throws an exception.
Run at the start of a build intended to produce production artifacts.
There should be no instances of -SNAPSHOT in any versions within the package.json.
If used within another package, the following functions are exposed. They throw exceptions if they encounter errors.
snapshotUpdate:
NpmSnapshot = require('npm-auto-snapshot');
NpmSnapshot.snapshotUpdate('/path/to/the/package.json', console.log);
noSnapshotScan
NpmSnapshot = require('npm-auto-snapshot');
NpmSnapshot.noSnapshotScan('/path/to/the/package.json', console.log);