Skip to content

Instantly share code, notes, and snippets.

@dillonkrug
Last active June 25, 2018 06:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dillonkrug/25ee1397510aa4dec1d7 to your computer and use it in GitHub Desktop.
Save dillonkrug/25ee1397510aa4dec1d7 to your computer and use it in GitHub Desktop.
forever watch file + multiple directories (using a watchIgnore glob)
forever start --uid 'appname' -o app.log -e error.log -a -w --watchIgnore '!{app.js,{src,common,lib}/**}' app
# breaking it down:
#
# --uid 'appname' name the process so we can use `forever stop appname`.
# the quotes are necessary.
#
# -o app.log / -e error.log pipe stdout/stderr to files
#
# -a append to said files
#
# -w watch the current directory for changes
#
# --watchIgnore '!{app.js,{src,common,lib}/**}' tell forever to ignore changes from files that do NOT match
# the pattern `{app.js,{src,common,lib}/**}`. The `!` negates
# the glob, so we use the double negative to only watch
# specific files. This particular pattern results in the app
# restarting when app.js or any file within src/, common/,
# or lib/ is modified.
#
# app the main file to run: app.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment