@kszongic/watchfile-cli
v1.0.0
Published
Zero-dependency CLI to watch files/directories and run a command on changes
Downloads
11
Maintainers
Readme
watchfile-cli
Zero-dependency CLI to watch files or directories and run a command on changes.
Install
npm i -g @kszongic/watchfile-cliUsage
# Watch a directory and run tests
watchfile src/ -- npm test
# Watch multiple paths
watchfile src/ test/ -- node build.js
# Watch a single file
watchfile config.json -- echo "config changed"
# Custom debounce (ms)
watchfile -d 500 src/ -- npm run buildOptions
| Flag | Description |
|------|-------------|
| -d, --debounce <ms> | Debounce interval (default: 300ms) |
| -h, --help | Show help |
| -v, --version | Show version |
How it works
Uses Node.js built-in fs.watch with recursive watching for directories. Changes are debounced to avoid running the command multiple times for rapid saves.
License
MIT © 2026 kszongic
