From 1cafc641c1a70a7b0bc15e19979b64ec6756d186 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Tue, 20 Jan 2015 16:18:07 +0000 Subject: [PATCH] Fixed #470 Explain how nodemon.json events work, and removed the manually maintained list of maintainers. People can easily navigate to https://github.com/remy/nodemon/contributors [skip ci] --- README.md | 61 ++++++++++++++++--------------------------------------- faq.md | 4 ++-- 2 files changed, 19 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 86fbcb1..4a22c77 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,22 @@ The following example will listen once for the `SIGUSR2` signal (used by nodemon Note that the `process.kill` is *only* called once your shutdown jobs are complete. Hat tip to [Benjie Gillam](http://www.benjiegillam.com/2011/08/node-js-clean-restart-and-faster-development-with-nodemon/) for writing this technique up. +## 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. + +For example, to trigger a notification on a Mac when nodemon restarts, `nodemon.json` looks like this: + +```json +{ + "events": { + "restart": "osascript -e 'display notification \"app restarted\" with title \"nodemon\"'" + } +} +``` + +A full list of available events is listed on the [event states wiki](https://github.com/remy/nodemon/wiki/Events#states). Note that you can bind to both states and messages. + ## Pipe output to somewhere else ```js @@ -222,47 +238,4 @@ Check out the [grunt-nodemon](https://github.com/ChrisWren/grunt-nodemon) plugin # License -MIT [http://rem.mit-license.org](http://rem.mit-license.org) - -# Contributors - -* [remy](https://github.com/remy) -* [ChrisWren](https://github.com/ChrisWren) -* [dylanmcd](https://github.com/dylanmcd) -* [fearphage](https://github.com/fearphage) -* [pasindud](https://github.com/pasindud) -* [coen-hyde](https://github.com/coen-hyde) -* [shawncplus](https://github.com/shawncplus) -* [albertnetymk](https://github.com/albertnetymk) -* [theredcoder](https://github.com/theredcoder) -* [aivopaas](https://github.com/aivopaas) -* [haircuttedfreak](https://github.com/haircuttedfreak) -* [jdavis](https://github.com/jdavis) -* [binarykitchen](https://github.com/binarykitchen) -* [kuba-kubula](https://github.com/kuba-kubula) -* [vadimi](https://github.com/vadimi) -* [mentatxx](https://github.com/mentatxx) -* [bryankaplan](https://github.com/bryankaplan) -* [lordnox](https://github.com/lordnox) -* [jaredhanson](https://github.com/jaredhanson) -* [skaushik92](https://github.com/skaushik92) -* [twolfson](https://github.com/twolfson) -* [chrisklaiber](https://github.com/chrisklaiber) -* [wasche](https://github.com/wasche) -* [nuxlli](https://github.com/nuxlli) -* [mvasilkov](https://github.com/mvasilkov) -* [morganrallen](https://github.com/morganrallen) -* [DennisKehrig](https://github.com/DennisKehrig) -* [sahat](https://github.com/sahat) -* [didoarellano](https://github.com/didoarellano) -* [arielyang](https://github.com/arielyang) -* [ZombieHippie](https://github.com/ZombieHippie) -* [mikemaccana](https://github.com/mikemaccana) -* [paularmstrong](https://github.com/paularmstrong) -* [sainaen](https://github.com/sainaen) -* [matthew-andrews](https://github.com/matthew-andrews) -* [SlexAxton](https://github.com/SlexAxton) -* [davedoesdev](https://github.com/davedoesdev) -* [rps](https://github.com/rps) -* [pauloadaoag](https://github.com/pauloadaoag) -* [focusaurus](https://github.com/focusaurus) +MIT [http://rem.mit-license.org](http://rem.mit-license.org) \ No newline at end of file diff --git a/faq.md b/faq.md index f1d3b71..b775798 100644 --- a/faq.md +++ b/faq.md @@ -28,7 +28,7 @@ nodemon will ignore all script arguments after `--` and pass them to your script # Help! My changes aren't being detected! -nodemon has three potential methods it uses to look for file changes. First, it polls using the find command to search for files modified within the last second. This method works on systems with a BSD based find (Mac, for example). +nodemon has three potential methods it uses to look for file changes. First, it polls using the find command to search for files modified within the last second. This method works on systems with a BSD based find. Next it tries using node's `fs.watch`. `fs.watch` will not always work however, and nodemon will try and detect if this is the case by writing a file to the tmp directory and seeing if fs.watch is triggered when it's removed. If nodemon finds that fs.watch was not triggered, it will then fall back to the third method (called legacy watch), which works by statting each file in your working directory looking for changes to the last modified time. This is the most cpu intensive method, but it may be the only option on some systems. @@ -54,7 +54,7 @@ Fedora is looking for `nodejs` rather than `node` which is the binary that nodem The solution is a simple workaround, Linux 101: -``` +```bash sudo ln -s /usr/bin/nodejs /usr/local/bin/node ```