Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show message for update, replaces #852 #968

Merged
merged 9 commits into from
Apr 12, 2018
17 changes: 16 additions & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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')
Expand Down Expand Up @@ -72,7 +88,6 @@ var config = {
}

if (debug.enabled) {
var pkg = require('../package.json')
debug('dat', pkg.version)
debug('node', process.version)
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down