mattgreen/watchexec runs commands whenever certain files change.

Installation

OSX

brew install watchexec

Rust

cargo install watchexec

For Linux and Windows, get it from GitHub releases.

Getting started

watchexec --exts js,jsx -- npm test

Runs npm test when js,jsx files change.

watchman -w lib -w test -- npm test

Runs npm test when lib/ and test/ files change.

Other options

Flags

FlagDescription
-c --clearClear screen
-r --restartRestart process if its still running

Options

OptionDescription
-s --signal SIGKILLKill signal to use
-d --debounce MSDebounce by MS milliseconds
-e --exts EXTSExtensions
-i --ignore PATTERNIgnore these files
-w --watch PATHWatch these directories

Also see

0 Comments for this cheatsheet. Write yours!