build-if-changed
Build your packages only if they changed since the last build.
How it works
-
Look for package.json
modules in the working directory, ignoring any
node_modules
directories by default. Any local .gitignore
is also
respected.
-
Crawl the package and generate SHA-1 hashes from every watched file. These
hashes are stored in the .bic_cache
file next to each package.json
module.
-
If any .bic_cache
files are outdated, then bic
will execute npm run build
in the relevant packages.
Usage
- Install the package:
yarn add build-if-changed -D
- Edit your
package.json
module to customize the behavior:
"bic": ["src"],
"bic": { "only": [], "skip": [] },
"bic": false,
- Use the package:
yarn build-if-changed
yarn bic
Notes
- The
skip
config takes precedence over the only
config. - The
.git
and node_modules
directories are always skipped. - Any package with
bic
or build-if-changed
in its "build" script is skipped. - This tool uses a custom glob syntax (see here).