@anzerr/entr.cli
TypeScript icon, indicating that this package has built-in type declarations

1.0.15 • Public • Published

Intro

GitHub Actions status | publish

Run a command when a file/directory is changed

Install

npm install --save git+https://github.com/anzerr/entr.cli.git
npm install --save @anzerr/entr.cli
git clone git+https://github.com/anzerr/entr.cli.git &&
cd entr.cli &&
npm link

Example

entr -r index.js ls -la .
entr -p package.json npm i

// no-eval gives you full control
entr -p package.json --no-eval sh -c "rm -f package-lock.json && npm i"

// run change when ts file is edited outside of node_modules
entr -e "(node_module|git)" -i '^(?!.*node_modules).*\.ts$' . echo "change"

// reload will kill the sleep and only run the command on the last edit
entr -e "(node_module|git)" -i '^(?!.*node_modules).*\.ts$' -r . 'sleep 2 && echo "change"'
const Entr = require('entr.cli');

new Entr({
	cwd: path.resolve('./index.js'), // file/dir to watch
	exec: ['cat', 'index.js'], // command to run
	reload: false, // should it track and kill last process
	postpone: false, // should it run on start
	exclude: null, // regex to exclude files to watch
	include: null, // regex to include files to watch
	eval: false // run exec in 'sh -c "cat index.js"'
});

Readme

Keywords

Package Sidebar

Install

npm i @anzerr/entr.cli

Weekly Downloads

0

Version

1.0.15

License

MIT

Unpacked Size

5.7 kB

Total Files

5

Last publish

Collaborators

  • anzerr