mirror of
https://github.com/bower/bower.git
synced 2026-01-15 01:08:07 -05:00
Merge pull request #383 from wibblymat/update-notifier
Integrate update notifier (#202)
This commit is contained in:
14
bin/bower
14
bin/bower
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var semver = require('semver');
|
||||
var nopt = require('nopt');
|
||||
var path = require('path');
|
||||
var pkg = require(path.join(__dirname, '..', 'package.json'));
|
||||
var semver = require('semver');
|
||||
var nopt = require('nopt');
|
||||
var path = require('path');
|
||||
var pkg = require(path.join(__dirname, '..', 'package.json'));
|
||||
var updateNotifier = require('update-notifier');
|
||||
|
||||
var template = require('../lib/util/template');
|
||||
var bower = require('../lib');
|
||||
@@ -15,6 +16,11 @@ var input = process.argv;
|
||||
var nodeVer = process.version;
|
||||
var reqVer = pkg.engines.node;
|
||||
var errors = [];
|
||||
var notifier = updateNotifier({ packageName: pkg.name, packageVersion: pkg.version });
|
||||
|
||||
if (notifier.update) {
|
||||
process.stderr.write(template('update-notice', notifier.update, true));
|
||||
}
|
||||
|
||||
process.title = 'bower';
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
"unzip": "0.1.4",
|
||||
"tar": "~0.1.13",
|
||||
"promptly": "~0.1.0",
|
||||
"abbrev": "~1.0.4"
|
||||
"abbrev": "~1.0.4",
|
||||
"update-notifier": "~0.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --timeout 40000"
|
||||
|
||||
4
templates/update-notice.mustache
Normal file
4
templates/update-notice.mustache
Normal file
@@ -0,0 +1,4 @@
|
||||
{{#red}}-----------------------------------------{{/red}}
|
||||
Update available: {{#yellow}}{{latest}}{{/yellow}} {{#cyan}}(current: {{current}}){{/cyan}}
|
||||
Run {{#yellow}}npm update -g {{name}}{{/yellow}} to update
|
||||
{{#red}}-----------------------------------------{{/red}}
|
||||
Reference in New Issue
Block a user