diff --git a/bin/cli.js b/bin/cli.js index 4ae46ff3..4d684714 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -3,6 +3,7 @@ var subcommand = require('subcommand') var debug = require('debug')('dat') var usage = require('../src/usage') +var pkg = require('../package.json') process.title = 'dat' @@ -11,6 +12,21 @@ var NODE_VERSION_SUPPORTED = 4 var nodeMajorVer = process.version.match(/^v([0-9]+)\./)[1] var invalidNode = nodeMajorVer < NODE_VERSION_SUPPORTED if (invalidNode) exitInvalidNode() +else { + var notifier = require('update-notifier') + notifier({pkg: pkg}) + .notify({ + defer: true, + isGlobal: true, + boxenOpts: { + align: 'left', + borderColor: 'green', + borderStyle: 'classic', + padding: 1, + margin: {top: 1, bottom: 1} + } + }) +} if (debug.enabled) { debug('Dat DEBUG mode engaged, enabling quiet mode') @@ -72,7 +88,6 @@ var config = { } if (debug.enabled) { - var pkg = require('../package.json') debug('dat', pkg.version) debug('node', process.version) } diff --git a/package.json b/package.json index b476b3db..8b01a4a9 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "speedometer": "^1.0.0", "subcommand": "^2.1.0", "throttle": "^1.0.3", + "update-notifier": "^2.3.0", "xtend": "^4.0.1" }, "devDependencies": {