Comparing version 0.2.2 to 0.3.0
@@ -26,3 +26,9 @@ #!/usr/bin/env node | ||
sys.log('\x1B[32m[nodemon] starting node\x1B[0m'); | ||
node = spawn('node', nodeArgs); | ||
var ext = path.extname(app); | ||
if (ext === '.coffee') { | ||
node = spawn('coffee', nodeArgs); | ||
} else { | ||
node = spawn('node', nodeArgs); | ||
} | ||
@@ -118,3 +124,16 @@ node.stdout.on('data', function (data) { | ||
if (!nodeArgs.length || nodeArgs[0] == 'help') { | ||
if (!nodeArgs.length) { | ||
// try to get the app from the package.json | ||
// doing a try/catch because we can't use the path.exist callback pattern | ||
// or we could, but the code would get messy, so this will do exactly | ||
// what we're after - if the file doesn't exist, it'll throw. | ||
try { | ||
app = JSON.parse(fs.readFileSync('./package.json').toString()).main; | ||
nodeArgs.push(app); | ||
} catch (e) { | ||
nodeArgs.push('help'); // default to help | ||
} | ||
} | ||
if (nodeArgs[0] == 'help') { | ||
usage(); | ||
@@ -134,3 +153,2 @@ process.exit(0); | ||
sys.log('[nodemon] v' + meta.version); | ||
@@ -137,0 +155,0 @@ |
@@ -9,7 +9,7 @@ { | ||
"bin": { "nodemon" : "./nodemon.js" }, | ||
"repository": { "type" : "git", "url" : "http://github.com/remy/nodemon.git" }, | ||
"repository": { "type" : "git", "url" : "http://github.com/remy/nodemon.git" }, | ||
"description": "Simple monitor script for use during development of a node.js app.", | ||
"keywords": ["monitor", "development", "restart", "autoload", "reload", "terminal"], | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"main": "./nodemon" | ||
} |
@@ -22,3 +22,3 @@ # nodemon | ||
nodemon [your node app] | ||
For example, if my application accepted a host and port as the arguments, I would start it as so: | ||
@@ -30,2 +30,8 @@ | ||
`nodemon` also supports running and monitoring [coffee-script](http://jashkenas.github.com/coffee-script/) apps: | ||
nodemon server.coffee | ||
If no script is given, `nodemon` will test for a `package.json` file and if found, will run the file associated with the *main* property ([ref](https://github.com/remy/nodemon/issues/14)). | ||
# Ignoring files | ||
@@ -32,0 +38,0 @@ |
7984
149
60