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

Commit c3027a9

Browse files
committed
fix(updater): dependency injection for update-notifier target
1 parent c864cb7 commit c3027a9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

bin/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ const path = require('path')
55

66
const NPM_PATH = path.join(__dirname, 'node_modules', '.bin', 'npm')
77

8-
npx(npx.parseArgs(process.argv, NPM_PATH))
8+
const parsed = npx.parseArgs(process.argv, NPM_PATH)
9+
parsed.npxPkg = path.join(__dirname, 'package.json')
10+
npx(parsed)

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ function npx (argv) {
6464
}
6565
if ((!existing && !argv.call) || argv.packageRequested) {
6666
// We only fire off the updateNotifier if we're installing things
67-
require('update-notifier')({pkg: require('./package.json')}).notify()
67+
if (argv.npxPkg) {
68+
require('update-notifier')({pkg: require(argv.npxPkg)}).notify()
69+
}
6870
// Some npm packages need to be installed. Let's install them!
6971
return ensurePackages(argv.package, argv).then(results => {
7072
if (results && results.added && results.updated && !argv.q) {

0 commit comments

Comments
 (0)