chuyik / build-if-changed

Run build scripts only when files changed (good with monorepos)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build-if-changed

Build your packages only if they changed since the last build.

 

How it works

  1. Look for package.json modules in the working directory, ignoring any node_modules directories by default. Any local .gitignore is also respected.

  2. 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.

  3. If any .bic_cache files are outdated, then bic will execute npm run build in the relevant packages.

 

Usage

  1. Install the package:
yarn add build-if-changed -D
  1. Edit your package.json module to customize the behavior:
// Only watch the "src" directory:
"bic": ["src/**"],
// Any glob can be included or excluded:
"bic": { "only": [], "skip": [] },
// Disable bic for a package:
"bic": false,
  1. Use the package:
yarn bic
yarn bic --help
yarn bic --dir some-dir
yarn bic --ignore some-name

 

Notes

  • The skip config takes precedence over the only config.
  • The .git and node_modules directories are always skipped.
  • This tool uses a custom glob syntax (see here).

About

Run build scripts only when files changed (good with monorepos)

License:MIT License


Languages

Language:TypeScript 94.9%Language:JavaScript 4.7%Language:Shell 0.4%