is-changed
Designed to track dependencies in package.json and check file modification time. Result is saved to local files, but not memory. Useful for task runners and builders, when you need to know is it necessary run rebuild someting.
CLI
Check dependencies in package.json, run command npm run build:libs
if changes found.
Snapshot will be stored in .libs.dat
.
is-changed --dependencies -t .libs.dat -u "npm run build:libs"
Check file src/style.scss
time modification, execute npm run build:style
if time is different from latest saved snapshot to .style.dat
.
is-changed -f src/style.scss -t .style.dat -u "npm run build:style"
API
changed.file: Result;
changed.dependenciesdependencies: Result;;
EXAMPLES
const changed = require('is-changed');
const Path = require('path');
const buildPath = 'dist';
Example 1: File changed
;// do something useful with src/style.scss...styleChanged.update;
Example 2: Track dependencies
;// do something...styleChanged.update;