From ff79835b143290a53d495d0f4263e5ef45df2c51 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Mon, 7 May 2018 09:08:32 +0100 Subject: [PATCH 1/6] chore: update stalebot --- .github/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index 3221f73c..0d5c7a4e 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -7,7 +7,7 @@ exemptLabels: - pinned - security # Label to use when marking an issue as stale -staleLabel: wontfix +staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as idle and stale because it hasn't From b3fc3a9aa9ae446b9a7ebc6a3836129376d2720a Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Fri, 18 May 2018 20:46:08 +0100 Subject: [PATCH 2/6] fix: in watch, use fully filtered ignore rules Fixes #1348 --- lib/monitor/match.js | 3 +++ lib/monitor/watch.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/monitor/match.js b/lib/monitor/match.js index 0d5b5467..1c7c4cf2 100644 --- a/lib/monitor/match.js +++ b/lib/monitor/match.js @@ -154,6 +154,9 @@ function match(files, monitor, ext) { var prefix = s.slice(0, 1); if (prefix === '!') { + if (s.indexOf('!' + cwd) === 0) { + return s; + } return '!**' + (prefix !== path.sep ? path.sep : '') + s.slice(1); } diff --git a/lib/monitor/watch.js b/lib/monitor/watch.js index 13b63b7a..a9618256 100644 --- a/lib/monitor/watch.js +++ b/lib/monitor/watch.js @@ -41,7 +41,12 @@ function watch() { const promise = new Promise(function (resolve) { const dotFilePattern = /[/\\]\./; - var ignored = Array.from(rootIgnored); + var ignored = match.rulesToMonitor( + [], // not needed + Array.from(rootIgnored), + config + ).map(pattern => pattern.slice(1)); + const addDotFile = dirs.filter(dir => dir.match(dotFilePattern)); // don't ignore dotfiles if explicitly watched. From dc0646652d4ee85f884522e3caf65e4637b90c92 Mon Sep 17 00:00:00 2001 From: Michael Shick Date: Wed, 23 May 2018 12:40:05 -0400 Subject: [PATCH 3/6] Note about procps on Docker Adding a note about installing procps on some Node.js Docker images to deal with long standing issue #419 --- faq.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/faq.md b/faq.md index b8b03b80..beae1703 100644 --- a/faq.md +++ b/faq.md @@ -238,3 +238,16 @@ sudo npm i -g npm ``` Otherwise see [issue #1124](https://github.com/remy/nodemon/issues/1124) for further suggestions. + +## No automatic restart when using Docker volumes [issue #419](https://github.com/remy/nodemon/issues/419#issuecomment-391244911) + +Some Node.js Docker images do not seem to have the full suite of filtesystem process utilities that allow `nodemon` to restart automatically when the code in a mounted volume changes. To handle this, and enable automatic restarts withour using legacy mode, you can install the [procps](http://procps.sourceforge.net) package. + +Here's an example snippet of a Dockerfile: + +``` +FROM node:8.9.4-wheezy +RUN apt-get update && apt-get install -y procps +``` + + From c554b42dc28c88527120921100bffe943223b87c Mon Sep 17 00:00:00 2001 From: Michael Shick Date: Wed, 23 May 2018 12:40:51 -0400 Subject: [PATCH 4/6] Update faq.md --- faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faq.md b/faq.md index beae1703..e94d0046 100644 --- a/faq.md +++ b/faq.md @@ -241,7 +241,7 @@ Otherwise see [issue #1124](https://github.com/remy/nodemon/issues/1124) for fur ## No automatic restart when using Docker volumes [issue #419](https://github.com/remy/nodemon/issues/419#issuecomment-391244911) -Some Node.js Docker images do not seem to have the full suite of filtesystem process utilities that allow `nodemon` to restart automatically when the code in a mounted volume changes. To handle this, and enable automatic restarts withour using legacy mode, you can install the [procps](http://procps.sourceforge.net) package. +Some Node.js Docker images do not seem to have the full suite of filtesystem process utilities that allow `nodemon` to restart automatically when the code in a mounted volume changes. To handle this, and enable automatic restarts without using legacy mode, you can install the [procps](http://procps.sourceforge.net) package. Here's an example snippet of a Dockerfile: From a724e538aca7fca62aa7901ada50353876c70b6e Mon Sep 17 00:00:00 2001 From: acceptable Date: Thu, 14 Jun 2018 20:28:47 +1000 Subject: [PATCH 5/6] docs: more docs for nodemon as child process (#1362) I was trying to find out how to use nodemon as child process, and stumble upon this https://github.com/remy/nodemon/issues/1018 So adding more docs for other people later to make it clearer how to do it. [skip ci] --- README.md | 4 ++++ doc/events.md | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/README.md b/README.md index b9186f96..59afb8cd 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,10 @@ Note that if you specify a `--config` file or provide a local `nodemon.json` any Please see [doc/requireable.md](doc/requireable.md) +## Using nodemon as child process + +Please see [doc/events.md](doc/events.md#Using_nodemon_as_child_process) + ## Running non-node scripts nodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of .js if there's no `nodemon.json`: diff --git a/doc/events.md b/doc/events.md index 49a08542..7933ad42 100644 --- a/doc/events.md +++ b/doc/events.md @@ -47,11 +47,29 @@ nodemon.emit('restart'); nodemon.emit('quit'); ``` +## Using nodemon as child process + If nodemon is a spawned process, then the child (nodemon) will emit message events whereby the event argument contains the event type, and instead of emitting events, you `send` the command: ```js +// using `spawn` as example, can use other functions like `fork`, etc +// https://nodejs.org/api/child_process.html +const { spawn } = require('child_process'); + +function spawnNodemon() { + const cp = spawn('nodemon', ['path/to/file.js', '--watch', 'path/to/watch'], { + // the important part is the 4th option 'ipc' + // this way `process.send` will be available in the child process (nodemon) + // so it can communicate back with parent process (through `.on()`, `.send()`) + // https://nodejs.org/api/child_process.html#child_process_options_stdio + stdio: ['pipe', 'pipe', 'pipe', 'ipc'], + }); + + return cp; +} + var app = spawnNodemon(); app.on('message', function (event) { From 251bc57563a7d1099a48c4b44696324034e5fdaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Here=C3=B1=C3=BA?= Date: Sun, 1 Jul 2018 03:27:45 -0300 Subject: [PATCH 6/6] docs: typo on string #24 & #246 (#1374) [skip ci] --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 59afb8cd..b23b64b7 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ npm install -g nodemon And nodemon will be installed globally to your system path. -You can also install nodemon as a developement dependency: +You can also install nodemon as a development dependency: ```bash npm install --save-dev nodemon @@ -131,7 +131,7 @@ Please see [doc/events.md](doc/events.md#Using_nodemon_as_child_process) ## Running non-node scripts -nodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of .js if there's no `nodemon.json`: +nodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of `.js` if there's no `nodemon.json`: ```bash nodemon --exec "python -v" ./app.py @@ -143,7 +143,7 @@ Now nodemon will run `app.py` with python in verbose mode (note that if you're n Using the `nodemon.json` config file, you can define your own default executables using the `execMap` property. This is particularly useful if you're working with a language that isn't supported by default by nodemon. -To add support for nodemon to know about the .pl extension (for Perl), the nodemon.json file would add: +To add support for nodemon to know about the `.pl` extension (for Perl), the `nodemon.json` file would add: ```json { @@ -181,7 +181,7 @@ By default, nodemon looks for files with the `.js`, `.mjs`, `.coffee`, `.litcoff nodemon -e js,jade ``` -Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions .js, .jade. +Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions `.js`, `.jade`. ## Ignoring files @@ -243,7 +243,7 @@ nodemon --delay 2500ms server.js The delay figure is number of seconds (or milliseconds, if specified) to delay before restarting. So nodemon will only restart your app the given number of seconds after the *last* file change. -If you are setting this value in `nodemon.json`, the value will always be interpretted in milliseconds. E.g., the following are equivalent: +If you are setting this value in `nodemon.json`, the value will always be interpreted in milliseconds. E.g., the following are equivalent: ```bash nodemon --delay 2.5