Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

Commit 549d413

Browse files
committed
feat(perf): only launch update-notifier when npx installs stuff
1 parent 00fc313 commit 549d413

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
const child = require('./child')
55
const parseArgs = require('./parse-args.js')
66
const path = require('path')
7-
const pkg = require('./package.json')
8-
const updateNotifier = require('update-notifier')
97
const which = promisify(require('which'))
108

119
const PATH_SEP = process.platform === 'win32' ? ';' : ':'
1210

13-
updateNotifier({pkg}).notify()
1411
main(parseArgs())
1512

1613
module.exports = main
@@ -64,6 +61,8 @@ function main (argv) {
6461
process.env = newEnv
6562
}
6663
if ((!existing && !argv.call) || argv.packageRequested) {
64+
// We only fire off the updateNotifier if we're installing things
65+
require('update-notifier')({pkg: require('./package.json')}).notify()
6766
// Some npm packages need to be installed. Let's install them!
6867
return ensurePackages(argv.package, argv).then(results => {
6968
console.error(Y()`npx: installed ${

0 commit comments

Comments
 (0)