Comparing version 2.5.0 to 2.6.0
var fs = require('fs') | ||
, path = require('path') | ||
var path = require('path') | ||
@@ -4,0 +4,0 @@ function read(dir) { |
var vm = require('vm') | ||
, cfg = require('./cfg') | ||
module.exports = function(wrapper, callback) { | ||
module.exports = function(cfg, wrapper, callback) { | ||
@@ -6,0 +5,0 @@ // Hook into Node's `require(...)` |
var fork = require('child_process').fork | ||
, path = require('path') | ||
, filewatcher = require('filewatcher') | ||
, ipc = require('./ipc') | ||
, notify = require('./notify') | ||
, cli = require('./cli') | ||
, log = require('./log') | ||
var path = require('path') | ||
var filewatcher = require('filewatcher') | ||
var ipc = require('./ipc') | ||
var cli = require('./cli') | ||
@@ -15,3 +13,3 @@ module.exports = function(args) { | ||
// Parse command line options | ||
var cliOpts = cli.parseOpts(args) | ||
var opts = cli.parseOpts(args) | ||
@@ -21,3 +19,5 @@ // Inject wrap.js into the args array | ||
var cfg = require('./cfg')(main, cliOpts) | ||
var cfg = require('./cfg')(main, opts) | ||
var log = require('./log')(cfg) | ||
var notify = require('./notify')(cfg, log) | ||
@@ -24,0 +24,0 @@ // Run ./dedupe.js as prelaod script |
@@ -1,11 +0,4 @@ | ||
var cfg = require('./cfg') | ||
, util = require('util') | ||
, fmt = require('dateformat') | ||
var util = require('util') | ||
var fmt = require('dateformat') | ||
/** | ||
* Logs a message to the console. The level is displayed in ANSI colors, | ||
* either bright red in case of an error or green otherwise. | ||
*/ | ||
module.exports = exports = log | ||
var colors = { | ||
@@ -17,22 +10,31 @@ info: '36', | ||
function log(msg, level) { | ||
if (cfg.timestamp) msg = color(fmt(cfg.timestamp), '30;1') + ' ' + msg | ||
var c = colors[level.toLowerCase()] || '32' | ||
console.log('[' + color(level.toUpperCase(), c) +'] ' + msg) | ||
} | ||
/** | ||
* Logs a message to the console. The level is displayed in ANSI colors, | ||
* either bright red in case of an error or green otherwise. | ||
*/ | ||
module.exports = function(cfg) { | ||
function color(s, c) { | ||
return '\x1B[' + c + 'm' + s + '\x1B[0m' | ||
} | ||
function log(msg, level) { | ||
if (cfg.timestamp) msg = color(fmt(cfg.timestamp), '30;1') + ' ' + msg | ||
var c = colors[level.toLowerCase()] || '32' | ||
console.log('[' + color(level.toUpperCase(), c) +'] ' + msg) | ||
} | ||
exports.info = function() { | ||
log(util.format.apply(util, arguments), 'info') | ||
} | ||
function color(s, c) { | ||
return '\x1B[' + c + 'm' + s + '\x1B[0m' | ||
} | ||
exports.warn = function() { | ||
log(util.format.apply(util, arguments), 'warn') | ||
log.info = function() { | ||
log(util.format.apply(util, arguments), 'info') | ||
} | ||
log.warn = function() { | ||
log(util.format.apply(util, arguments), 'warn') | ||
} | ||
log.error = function() { | ||
log(util.format.apply(util, arguments), 'error') | ||
} | ||
return log | ||
} | ||
exports.error = function() { | ||
log(util.format.apply(util, arguments), 'error') | ||
} |
@@ -1,17 +0,21 @@ | ||
var growl = require('growl') | ||
, path = require('path') | ||
, cfg = require('./cfg') | ||
, log = require('./log') | ||
var path = require('path') | ||
var notifier = require('node-notifier') | ||
function icon(level) { | ||
return path.resolve(__dirname, '../icons/node_' + level + '.png') | ||
} | ||
/** | ||
* Displays a desktop notification and writes a message to the console. | ||
*/ | ||
module.exports = function(title, msg, level) { | ||
level = level || 'info' | ||
log(title || msg, level) | ||
if (cfg.notify) growl(msg, { title: title || 'node.js', image: icon(level) }) | ||
module.exports = function(cfg, log) { | ||
return function(title, msg, level) { | ||
level = level || 'info' | ||
log(title || msg, level) | ||
if (cfg.notify) notifier.notify({ | ||
title: title || 'node.js', | ||
image: icon(level), | ||
message: msg | ||
}) | ||
} | ||
} | ||
function icon(level) { | ||
return path.resolve(__dirname, '../icons/node_' + level + '.png') | ||
} |
var path = require('path') | ||
, child_process = require('child_process') | ||
, fork = child_process.fork | ||
, resolve = require('resolve').sync | ||
, hook = require('./hook') | ||
, ipc = require('./ipc') | ||
, cfg = require('./cfg') | ||
, cli = require('./cli') | ||
var child_process = require('child_process') | ||
var fork = child_process.fork | ||
var resolve = require('resolve').sync | ||
var hook = require('./hook') | ||
var ipc = require('./ipc') | ||
var cfg = require('./cfg') | ||
var cli = require('./cli') | ||
@@ -47,3 +47,3 @@ // Remove wrap.js from the argv array | ||
// Hook into require() and notify the parent process about required files | ||
hook(module, function(file) { | ||
hook(cfg, module, function(file) { | ||
ipc.send({required: file}) | ||
@@ -50,0 +50,0 @@ }) |
{ | ||
"name": "node-dev", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Restarts your app when files are modified", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"filewatcher": "~1.1.1", | ||
"growl": "~1.7.0", | ||
"node-notifier": "^4.0.2", | ||
"resolve": "^1.0.0" | ||
@@ -36,0 +36,0 @@ }, |
@@ -54,5 +54,4 @@ [![Build Status](https://secure.travis-ci.org/fgnass/node-dev.png)](http://travis-ci.org/fgnass/node-dev) | ||
Status and error messages can be displayed as desktop notification using either | ||
[Growl](http://growl.info/about.php) or | ||
[libnotify](http://developer.gnome.org/libnotify/). | ||
Status and error messages can be displayed as desktop notification using | ||
[node-notifier](https://www.npmjs.org/package/node-notifier): | ||
@@ -63,11 +62,10 @@ ![Screenshot](http://fgnass.github.com/images/node-dev.png) | ||
__Requirements:__ | ||
In order to use Growl notifications | ||
[growlnotify](http://growl.info/extras.php#growlnotify) must be installed on | ||
your system. | ||
* Mac OS X: >= 10.8 or Growl if earlier. | ||
* Linux: notify-osd installed (Ubuntu should have this by default) | ||
* Windows: >= 8, task bar balloon if earlier or Growl if that is installed. | ||
* General Fallback: Growl | ||
To use OSX's built in notifications: | ||
sudo gem install terminal-notifier | ||
# Settings | ||
@@ -74,0 +72,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18932
340
149
+ Addednode-notifier@^4.0.2
+ Addedansi-escapes@3.2.0(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedansicolors@0.3.2(transitive)
+ Addedcardinal@2.1.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcli-table@0.3.11(transitive)
+ Addedcli-usage@0.1.10(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcolors@1.0.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedgrowly@1.3.0(transitive)
+ Addedhas-flag@2.0.03.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlodash._arraycopy@3.0.0(transitive)
+ Addedlodash._arrayeach@3.0.0(transitive)
+ Addedlodash._baseassign@3.2.0(transitive)
+ Addedlodash._baseclone@3.3.0(transitive)
+ Addedlodash._basecopy@3.0.1(transitive)
+ Addedlodash._basefor@3.0.3(transitive)
+ Addedlodash._bindcallback@3.0.1(transitive)
+ Addedlodash._getnative@3.9.1(transitive)
+ Addedlodash.clonedeep@3.0.2(transitive)
+ Addedlodash.isarguments@3.1.0(transitive)
+ Addedlodash.isarray@3.0.4(transitive)
+ Addedlodash.keys@3.1.2(transitive)
+ Addedmarked@0.7.0(transitive)
+ Addedmarked-terminal@3.3.0(transitive)
+ Addednode-emoji@1.11.0(transitive)
+ Addednode-notifier@4.6.1(transitive)
+ Addedredeyed@2.1.1(transitive)
+ Addedshellwords@0.1.1(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedsupports-hyperlinks@1.0.1(transitive)
+ Addedwhich@1.3.1(transitive)
- Removedgrowl@~1.7.0
- Removedgrowl@1.7.0(transitive)