diff options
Diffstat (limited to 'node_modules/update-notifier')
-rw-r--r-- | node_modules/update-notifier/index.js | 28 | ||||
-rw-r--r-- | node_modules/update-notifier/package.json | 8 | ||||
-rw-r--r-- | node_modules/update-notifier/readme.md | 1 |
3 files changed, 20 insertions, 17 deletions
diff --git a/node_modules/update-notifier/index.js b/node_modules/update-notifier/index.js index 0a11dbf1f..a5fff0103 100644 --- a/node_modules/update-notifier/index.js +++ b/node_modules/update-notifier/index.js @@ -2,20 +2,21 @@ const spawn = require('child_process').spawn; const path = require('path'); const format = require('util').format; -const lazyRequire = require('lazy-req')(require); - -const configstore = lazyRequire('configstore'); -const chalk = lazyRequire('chalk'); -const semverDiff = lazyRequire('semver-diff'); -const latestVersion = lazyRequire('latest-version'); -const isNpm = lazyRequire('is-npm'); -const boxen = lazyRequire('boxen'); -const xdgBasedir = lazyRequire('xdg-basedir'); +const importLazy = require('import-lazy')(require); + +const configstore = importLazy('configstore'); +const chalk = importLazy('chalk'); +const semverDiff = importLazy('semver-diff'); +const latestVersion = importLazy('latest-version'); +const isNpm = importLazy('is-npm'); +const boxen = importLazy('boxen'); +const xdgBasedir = importLazy('xdg-basedir'); const ONE_DAY = 1000 * 60 * 60 * 24; class UpdateNotifier { constructor(options) { - this.options = options = options || {}; + options = options || {}; + this.options = options; options.pkg = options.pkg || {}; // Reduce pkg to the essential keys. with fallback to deprecated options @@ -34,8 +35,10 @@ class UpdateNotifier { this.updateCheckInterval = typeof options.updateCheckInterval === 'number' ? options.updateCheckInterval : ONE_DAY; this.hasCallback = typeof options.callback === 'function'; this.callback = options.callback || (() => {}); + this.disabled = 'NO_UPDATE_NOTIFIER' in process.env || + process.argv.indexOf('--no-update-notifier') !== -1; - if (!this.hasCallback) { + if (!this.disabled && !this.hasCallback) { try { const ConfigStore = configstore(); this.config = new ConfigStore(`update-notifier-${this.packageName}`, { @@ -69,8 +72,7 @@ class UpdateNotifier { if ( !this.config || this.config.get('optOut') || - 'NO_UPDATE_NOTIFIER' in process.env || - process.argv.indexOf('--no-update-notifier') !== -1 + this.disabled ) { return; } diff --git a/node_modules/update-notifier/package.json b/node_modules/update-notifier/package.json index 803cc5a0c..8a122a774 100644 --- a/node_modules/update-notifier/package.json +++ b/node_modules/update-notifier/package.json @@ -1,6 +1,6 @@ { "name": "update-notifier", - "version": "2.1.0", + "version": "2.2.0", "description": "Update notifications for your CLI app", "license": "BSD-2-Clause", "repository": "yeoman/update-notifier", @@ -36,17 +36,17 @@ "boxen": "^1.0.0", "chalk": "^1.0.0", "configstore": "^3.0.0", + "import-lazy": "^2.1.0", "is-npm": "^1.0.0", "latest-version": "^3.0.0", - "lazy-req": "^2.0.0", "semver-diff": "^2.0.0", "xdg-basedir": "^3.0.0" }, "devDependencies": { - "clear-require": "^2.0.0", + "clear-module": "^2.1.0", "fixture-stdout": "^0.2.1", "mocha": "*", "strip-ansi": "^3.0.1", - "xo": "^0.17.0" + "xo": "^0.18.2" } } diff --git a/node_modules/update-notifier/readme.md b/node_modules/update-notifier/readme.md index f76e3215c..e41d6faf1 100644 --- a/node_modules/update-notifier/readme.md +++ b/node_modules/update-notifier/readme.md @@ -161,6 +161,7 @@ The idea for this module came from the desire to apply the browser update strate There are a bunch projects using it: +- [npm](https://github.com/npm/npm) - Package manager for JavaScript - [Yeoman](http://yeoman.io) - Modern workflows for modern webapps - [AVA](https://ava.li) - Simple concurrent test runner - [XO](https://github.com/sindresorhus/xo) - JavaScript happiness style linter |