diff --git a/README.md b/README.md index a7e483e5..b9186f96 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ For use during development of a node.js based application. nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application. -nodemon does **not** require *any* changes to your code or method of development. nodemon simply wraps your node application and keeps an eye on any files that have changed. Remember that nodemon is a replacement wrapper for `node`, think of it as replacing the word "node" on the command line when you run your script. +nodemon does **not** require *any* changes to your code or method of development. nodemon wraps your node application and keeps an eye on any files that have changed. Remember that nodemon is a replacement wrapper for `node`, think of it as replacing the word "node" on the command line when you run your script. [![NPM version](https://badge.fury.io/js/nodemon.svg)](https://npmjs.org/package/nodemon) [![Travis Status](https://travis-ci.org/remy/nodemon.svg?branch=master)](https://travis-ci.org/remy/nodemon) [![Backers on Open Collective](https://opencollective.com/nodemon/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/nodemon/sponsors/badge.svg)](#sponsors) @@ -71,7 +71,7 @@ nodemon was originally written to restart hanging processes such as web servers, ## Manual restarting -Whilst nodemon is running, if you need to manually restart your application, instead of stopping and restart nodemon, you can simply type `rs` with a carriage return, and nodemon will restart your process. +Whilst nodemon is running, if you need to manually restart your application, instead of stopping and restart nodemon, you can type `rs` with a carriage return, and nodemon will restart your process. ## Config files @@ -96,14 +96,14 @@ A config file can take any of the command line arguments as JSON key values, for } ``` -The above `nodemon.json` file might be my global config so that I have support for ruby files and processing files, and I can simply run `nodemon demo.pde` and nodemon will automatically know how to run the script even though out of the box support for processing scripts. +The above `nodemon.json` file might be my global config so that I have support for ruby files and processing files, and I can run `nodemon demo.pde` and nodemon will automatically know how to run the script even though out of the box support for processing scripts. A further example of options can be seen in [sample-nodemon.md](https://github.com/remy/nodemon/blob/master/doc/sample-nodemon.md) ### package.json If you want to keep all your package configurations in one place, nodemon supports using `package.json` for configuration. -Simply specify the config in the same format as you would for a config file but under `nodemonConfig` in the `package.json` file, for example, take the following `package.json`: +Specify the config in the same format as you would for a config file but under `nodemonConfig` in the `package.json` file, for example, take the following `package.json`: ```json { @@ -267,7 +267,7 @@ Note that the `process.kill` is *only* called once your shutdown jobs are comple ## Triggering events when nodemon state changes -If you want growl like notifications when nodemon restarts or to trigger an action when an event happens, then you can either `require` nodemon or simply add event actions to your `nodemon.json` file. +If you want growl like notifications when nodemon restarts or to trigger an action when an event happens, then you can either `require` nodemon or add event actions to your `nodemon.json` file. For example, to trigger a notification on a Mac when nodemon restarts, `nodemon.json` looks like this: diff --git a/doc/cli/options.txt b/doc/cli/options.txt index ab6561ac..70f41c4a 100644 --- a/doc/cli/options.txt +++ b/doc/cli/options.txt @@ -14,6 +14,7 @@ Execution --cwd .............. change into before running the script -e, --ext ................ extensions to look for, ie. "js,jade,hbs" -I, --no-stdin ........... nodemon passes stdin directly to child process + --spawn .................. force nodemon to use spawn (over fork) [node only] -x, --exec app ........... execute script with "app", ie. -x "python -v" -- ........... to tell nodemon stop slurping arguments diff --git a/doc/requireable.md b/doc/requireable.md index c096d8cc..4d6327ee 100644 --- a/doc/requireable.md +++ b/doc/requireable.md @@ -40,7 +40,7 @@ The `nodemon` object also has a few methods and properties. Some are exposed to ### Event handling -This is simply the event emitter bus that exists inside nodemon exposed at the top level module (ie. it's the `events` api): +This is the event emitter bus that exists inside nodemon exposed at the top level module (ie. it's the `events` api): - `nodemon.on(event, fn)` - `nodemon.addListener(event, fn)` diff --git a/faq.md b/faq.md index 22ea5724..42174dde 100644 --- a/faq.md +++ b/faq.md @@ -4,7 +4,7 @@ This is being added to as common issues occur on the [issues](http://github.com/ This is a working document, and if it makes sense, I'll take pull requests to help make it better. -## nodemon doesn't work with my REPL +# nodemon doesn't work with my REPL Create an nodemon.json file with the setting: @@ -16,6 +16,10 @@ Create an nodemon.json file with the setting: This will leave the STDIN to your application rather than listening for the `rs` command to restart. +# Strange/failing behaviour starting the (node-based) executable + +By default, nodemon will try to fork your node scripts ([background reading](https://github.com/remy/nodemon/issues/1025)), however, there are some edge cases where that won't suit your needs. Most of the time the default configuration should be fine, but if you want to force nodemon to spawn your node process, use the `--spawn` option. + # My script arguments are being taken by nodemon Use the `--` switch to tell nodemon to ignore all arguments after this point. So to pass `-L` to your script instead of nodemon, use: @@ -142,7 +146,7 @@ forever start --uid foo --killSignal=SIGTERM -c 'nodemon --exitcrash' server.js To test this, you can kill the server.js process and forever will restart it. If you `touch server.js` nodemon will restart it. -To stop the process monitored by forever and nodemon, simply call the following, using the `uid` we assigned above (`foo`): +To stop the process monitored by forever and nodemon, call the following, using the `uid` we assigned above (`foo`): ```bash forever stop foo diff --git a/lib/cli/parse.js b/lib/cli/parse.js index 4c0fa8fc..ad740038 100644 --- a/lib/cli/parse.js +++ b/lib/cli/parse.js @@ -117,6 +117,9 @@ function nodemonOption(options, arg, eatNext) { options.noUpdateNotifier = true; } else + if (arg === '--spawn') { + options.spawn = true; + } else if (arg === '--dump') { options.dump = true; diff --git a/lib/config/load.js b/lib/config/load.js index b3a88be9..694985d4 100644 --- a/lib/config/load.js +++ b/lib/config/load.js @@ -109,7 +109,7 @@ function load(settings, options, config, callback) { } /** - * Loads the old style nodemonignore files which are simply a list of patterns + * Loads the old style nodemonignore files which is a list of patterns * in a file to ignore * * @param {Object} options nodemon user options @@ -210,7 +210,7 @@ function loadFile(options, config, dir, ready) { function loadPackageJSON(config, ready) { if (!ready) { - ready = () => {}; + ready = () => { }; } const dir = process.cwd(); diff --git a/lib/monitor/run.js b/lib/monitor/run.js index 80d62080..76fff484 100644 --- a/lib/monitor/run.js +++ b/lib/monitor/run.js @@ -66,6 +66,7 @@ function run(options) { const hasStdio = utils.satisfies('>= 6.4.0 || < 5'); if ( + !config.options.spawn && firstArg.indexOf('-') === -1 && // don't fork if there's a node arg firstArg !== 'inspect' && // don't fork it's `inspect` debugger executable === 'node' && // only fork if node diff --git a/website/nodemon.png b/website/nodemon.png new file mode 100644 index 00000000..f7ca20a8 Binary files /dev/null and b/website/nodemon.png differ diff --git a/website/sparkpost.png b/website/sparkpost.png new file mode 100644 index 00000000..675185e2 Binary files /dev/null and b/website/sparkpost.png differ