Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Fselect | 3,628 | a day ago | 52 | June 16, 2023 | 16 | apache-2.0 | Rust | |||
Find files with SQL-like queries | ||||||||||
Onchange | 680 | 6,156 | 1,884 | 3 years ago | 39 | October 22, 2020 | 2 | mit | TypeScript | |
Use glob patterns to watch file sets and run a command when anything is added, changed or deleted. | ||||||||||
Nanomatch | 82 | 455,186 | 312 | 3 years ago | 29 | June 27, 2018 | 7 | mit | JavaScript | |
Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but without support for extended globs (extglobs), posix brackets or braces, and with complete Bash 4.3 wildcard support: ("*", "**", and "?"). | ||||||||||
Globstar | 16 | 1,287 | 58 | 4 years ago | 1 | March 16, 2015 | 1 | mit | JavaScript | |
Run programs with glob/globstar support, especially on Windows within npm scripts. | ||||||||||
Pospell | 10 | 1 | 7 months ago | 38 | November 26, 2021 | 2 | Python | |||
`pospell` has migrated to an open-source forge: https://git.afpy.org/AFPy/pospell | ||||||||||
Pkgrun | 6 | 8 years ago | 2 | mit | JavaScript | |||||
:runner: Run multiple package.json scripts with one command. | ||||||||||
Glob | 2 | 9 months ago | mit | Python | ||||||
General purpose Discord bot with wide variety of features. | ||||||||||
Glob Test | 2 | 9 years ago | JavaScript | |||||||
Command line glob testing tool. | ||||||||||
Eslint Auto Fix | 1 | a year ago | 5 | gpl-3.0 | JavaScript | |||||
Automatically fix/format your JS code using whatever ESLint configuration your project likes. | ||||||||||
Next Modal Pages Loader | 1 | 2 years ago | mit | JavaScript | ||||||
An automatic dynamic page loader for Next.js |
Use glob patterns to watch file sets and run a command when anything is added, changed or deleted.
npm install onchange
# On every change run `npm test`.
onchange 'app/**/*.js' 'test/**/*.js' -- npm test
# On every change restart `server.js` (by killing the running process).
onchange -i -k '**/*.js' -- node server.js
# On every change `echo` file change.
onchange '**/*.js' -- echo '{{event}} to {{file}}'
NOTE: Windows users may need to use double quotes rather than single quotes. If used in an npm script, remember to escape the double quotes.
You can match as many glob patterns as you like, just put the command you want to run after the --
and it will run any time a file matching any of the globs is added changed or deleted.
Other available replacement variables are fileExt
(path.extname(file)
), fileBase
(path.basename(file)
),
fileBaseNoExt
(basename, without extension), and fileDir
(path.dirname(file)
).
-a
, --add
)To execute the command for all initially added paths:
onchange -a 'config.json' -- microservice-proxy -c {{file}} -p 9000
-i
, --initial
)To execute the command once on load without any event:
onchange -i '**/*.js' -- npm start
-e
, --exclude
)To exclude matches:
onchange '**/*.ts' -e 'dist/**/*.js' -- tslint
--no-exclude
)**/node_modules/**
and **/.git/**
are excluded by default, use --no-exclude
to disable:
onchange 'node_modules/**' --no-exclude -- tslint
--exclude-path
)Excludes all paths in a file following the .gitignore
specification.
onchange '**' --exclude-path .gitignore -- prettier
-k
, --kill
)To kill current and pending processes between changes:
onchange -k '**/*.js' -- npm test
-j <n>
, --jobs <n>
)Set the maximum concurrent processes to run (default is 1
):
onchange -j2 '**/*.js' -- cp -v -r '{{file}}' 'test/{{file}}'
-d
, --delay
)To set the amount of delay (in ms) between process changes:
onchange -d 1000 '**/*.js' -- npm start
--await-write-finish <ms>
)To hold the events until the size does not change for a configurable amount of time (in ms, default is 2000
):
onchange --await-write-finish 1500 '**/*.js' -- npm test
-p <ms>
, --poll <ms>
)Use polling to monitor for changes. This option is useful if you're watching an NFS volume.
onchange -p 100 '**/*.js' -- npm test
-o
, --outpipe
)Shell command to execute every change:
onchange -o '> .changelog' 'src/**/*.js' -- echo '{{event}} to {{file}}'
P.S. When a command is used with --outpipe
, the stdout
from the command will be piped into outpipe
.
-f
, --filter
)By default, onchange watches for all events from chokidar. Use this option to watch only for events you need:
onchange -f add -f change '**/*.js' -- npm start
-v
, --verbose
)Enable if you want verbose logging from onchange
(useful for debugging). For example:
onchange -v 'app/**/*.js' 'test/**/*.js' -- npm test
Includes types for TypeScript users.
0
.MIT