update-notifier
Advanced tools
Comparing version 0.7.0 to 1.0.0
23
index.js
@@ -12,3 +12,2 @@ 'use strict'; | ||
var xdgBasedir = require('xdg-basedir'); | ||
var ansiAlign = require('ansi-align'); | ||
var ONE_DAY = 1000 * 60 * 60 * 24; | ||
@@ -47,8 +46,10 @@ | ||
// expecting error code EACCES or EPERM | ||
var msg = | ||
chalk.yellow(format(' %s update check failed ', options.pkg.name)) + | ||
format('\n Try running with %s or get access ', chalk.cyan('sudo')) + | ||
'\n to the local update config store via \n' + | ||
chalk.cyan(format(' sudo chown -R $USER:$(id -gn $USER) %s ', xdgBasedir.config)); | ||
process.on('exit', function () { | ||
var msg = [chalk.yellow(format(' %s update check failed ', options.pkg.name))]; | ||
msg.push(format(' Try running with %s or get access ', chalk.cyan('sudo'))); | ||
msg.push(' to the local update config store via '); | ||
msg.push(chalk.cyan(format(' sudo chown -R $USER:$(id -gn $USER) %s ', xdgBasedir.config))); | ||
console.error('\n' + boxen(ansiAlign.center(msg).join('\n'))); | ||
console.error('\n' + boxen(msg, {align: 'center'})); | ||
}); | ||
@@ -110,9 +111,15 @@ } | ||
var message = '\n' + boxen('Update available ' + chalk.dim(this.update.current) + chalk.reset(' → ') + chalk.green(this.update.latest) + ' \nRun ' + chalk.cyan('npm i -g ' + this.packageName) + ' to update', { | ||
opts.message = opts.message || 'Update available ' + chalk.dim(this.update.current) + chalk.reset(' → ') + | ||
chalk.green(this.update.latest) + ' \nRun ' + chalk.cyan('npm i -g ' + this.packageName) + ' to update'; | ||
opts.boxenOpts = opts.boxenOpts || { | ||
padding: 1, | ||
margin: 1, | ||
align: 'center', | ||
borderColor: 'yellow', | ||
borderStyle: 'round' | ||
}); | ||
}; | ||
var message = '\n' + boxen(opts.message, opts.boxenOpts); | ||
if (opts.defer === undefined) { | ||
@@ -119,0 +126,0 @@ process.on('exit', function () { |
{ | ||
"name": "update-notifier", | ||
"version": "0.7.0", | ||
"version": "1.0.0", | ||
"description": "Update notifications for your CLI app", | ||
@@ -36,4 +36,3 @@ "license": "BSD-2-Clause", | ||
"dependencies": { | ||
"ansi-align": "^1.0.0", | ||
"boxen": "^0.5.1", | ||
"boxen": "^0.6.0", | ||
"chalk": "^1.0.0", | ||
@@ -48,5 +47,7 @@ "configstore": "^2.0.0", | ||
"clear-require": "^1.0.1", | ||
"fixture-stdout": "^0.2.1", | ||
"mocha": "*", | ||
"strip-ansi": "^3.0.1", | ||
"xo": "*" | ||
} | ||
} |
@@ -121,3 +121,16 @@ # update-notifier [![Build Status](https://travis-ci.org/yeoman/update-notifier.svg?branch=master)](https://travis-ci.org/yeoman/update-notifier) | ||
#### options.message | ||
Type: `string`<br> | ||
Default: [See the screen shot above](https://github.com/yeoman/update-notifier#update-notifier-) | ||
The message that will be shown when an update is available. | ||
### options.boxenOpts | ||
Type: `object`<br> | ||
Default: `{ padding: 1, margin: 1, borderColor: 'yellow', borderStyle: 'round' }` ([See the screen shot above](https://github.com/yeoman/update-notifier#update-notifier-)) | ||
The object that will be passed to [boxen](https://github.com/sindresorhus/boxen). | ||
### User settings | ||
@@ -124,0 +137,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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10712
7
137
1
163
5
+ Addedboxen@0.6.0(transitive)
- Removedansi-align@^1.0.0
- Removedboxen@0.5.1(transitive)
Updatedboxen@^0.6.0