From 5b96046cde0b69ee03c69cfb9fd480803847b2b9 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Thu, 23 Dec 2021 08:27:28 +0300 Subject: [PATCH 1/3] fix: add `preferLocal` option to allow execa to use local npm version --- lib/add-channel.js | 1 + lib/prepare.js | 2 +- lib/publish.js | 2 +- lib/verify-auth.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/add-channel.js b/lib/add-channel.js index ccb39814..00db5612 100644 --- a/lib/add-channel.js +++ b/lib/add-channel.js @@ -24,6 +24,7 @@ module.exports = async (npmrc, {npmPublish}, pkg, context) => { { cwd, env, + preferLocal: true, } ); result.stdout.pipe(stdout, {end: false}); diff --git a/lib/prepare.js b/lib/prepare.js index 25fb8ee1..4ec52b95 100644 --- a/lib/prepare.js +++ b/lib/prepare.js @@ -22,7 +22,7 @@ module.exports = async (npmrc, {tarballDir, pkgRoot}, {cwd, env, stdout, stderr, if (tarballDir) { logger.log('Creating npm package version %s', version); - const packResult = execa('npm', ['pack', basePath, '--userconfig', npmrc], {cwd, env}); + const packResult = execa('npm', ['pack', basePath, '--userconfig', npmrc], {cwd, env, preferLocal: true}); packResult.stdout.pipe(stdout, {end: false}); packResult.stderr.pipe(stderr, {end: false}); diff --git a/lib/publish.js b/lib/publish.js index c79d5652..ff3af007 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -23,7 +23,7 @@ module.exports = async (npmrc, {npmPublish, pkgRoot}, pkg, context) => { const result = execa( 'npm', ['publish', basePath, '--userconfig', npmrc, '--tag', distTag, '--registry', registry], - {cwd, env} + {cwd, env, preferLocal: true} ); result.stdout.pipe(stdout, {end: false}); result.stderr.pipe(stderr, {end: false}); diff --git a/lib/verify-auth.js b/lib/verify-auth.js index d4605632..d6aa05b9 100644 --- a/lib/verify-auth.js +++ b/lib/verify-auth.js @@ -18,7 +18,7 @@ module.exports = async (npmrc, pkg, context) => { if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) { try { - const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], {cwd, env}); + const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], {cwd, env, preferLocal: true}); whoamiResult.stdout.pipe(stdout, {end: false}); whoamiResult.stderr.pipe(stderr, {end: false}); await whoamiResult; From bb4d6f6a3d42c3cc19488d1e45b4ea5f45cf00ac Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Mon, 17 Jan 2022 09:45:47 -0600 Subject: [PATCH 2/3] refactor: knocked-down execa options to resolve lint issue --- lib/verify-auth.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/verify-auth.js b/lib/verify-auth.js index d6aa05b9..99d957e2 100644 --- a/lib/verify-auth.js +++ b/lib/verify-auth.js @@ -18,7 +18,11 @@ module.exports = async (npmrc, pkg, context) => { if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) { try { - const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], {cwd, env, preferLocal: true}); + const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], { + cwd, + env, + preferLocal: true + }); whoamiResult.stdout.pipe(stdout, {end: false}); whoamiResult.stderr.pipe(stderr, {end: false}); await whoamiResult; From 087de5f1b16262af292cba07e86c998bcf03474e Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Mon, 17 Jan 2022 18:50:40 +0300 Subject: [PATCH 3/3] style: linting --- lib/verify-auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/verify-auth.js b/lib/verify-auth.js index 99d957e2..bd7efc08 100644 --- a/lib/verify-auth.js +++ b/lib/verify-auth.js @@ -21,7 +21,7 @@ module.exports = async (npmrc, pkg, context) => { const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], { cwd, env, - preferLocal: true + preferLocal: true, }); whoamiResult.stdout.pipe(stdout, {end: false}); whoamiResult.stderr.pipe(stderr, {end: false});