From 549d4137ab880e8b94ddda598768f86f61afd581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Wed, 21 Jun 2017 00:14:40 +0200 Subject: [PATCH] feat(perf): only launch update-notifier when npx installs stuff --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 756382c..84ec8ae 100755 --- a/index.js +++ b/index.js @@ -4,13 +4,10 @@ const child = require('./child') const parseArgs = require('./parse-args.js') const path = require('path') -const pkg = require('./package.json') -const updateNotifier = require('update-notifier') const which = promisify(require('which')) const PATH_SEP = process.platform === 'win32' ? ';' : ':' -updateNotifier({pkg}).notify() main(parseArgs()) module.exports = main @@ -64,6 +61,8 @@ function main (argv) { process.env = newEnv } if ((!existing && !argv.call) || argv.packageRequested) { + // We only fire off the updateNotifier if we're installing things + require('update-notifier')({pkg: require('./package.json')}).notify() // Some npm packages need to be installed. Let's install them! return ensurePackages(argv.package, argv).then(results => { console.error(Y()`npx: installed ${