Skip to content

Commit 002439e

Browse files
antongolubtravi
andauthoredJan 17, 2022
fix: add preferLocal option to allow execa to use local npm version (#445)
Co-authored-by: Matt Travi <programmer@travi.org>
1 parent 19761ed commit 002439e

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed
 

‎lib/add-channel.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = async (npmrc, {npmPublish}, pkg, context) => {
2424
{
2525
cwd,
2626
env,
27+
preferLocal: true,
2728
}
2829
);
2930
result.stdout.pipe(stdout, {end: false});

‎lib/prepare.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = async (npmrc, {tarballDir, pkgRoot}, {cwd, env, stdout, stderr,
2222

2323
if (tarballDir) {
2424
logger.log('Creating npm package version %s', version);
25-
const packResult = execa('npm', ['pack', basePath, '--userconfig', npmrc], {cwd, env});
25+
const packResult = execa('npm', ['pack', basePath, '--userconfig', npmrc], {cwd, env, preferLocal: true});
2626
packResult.stdout.pipe(stdout, {end: false});
2727
packResult.stderr.pipe(stderr, {end: false});
2828

‎lib/publish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = async (npmrc, {npmPublish, pkgRoot}, pkg, context) => {
2323
const result = execa(
2424
'npm',
2525
['publish', basePath, '--userconfig', npmrc, '--tag', distTag, '--registry', registry],
26-
{cwd, env}
26+
{cwd, env, preferLocal: true}
2727
);
2828
result.stdout.pipe(stdout, {end: false});
2929
result.stderr.pipe(stderr, {end: false});

‎lib/verify-auth.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ module.exports = async (npmrc, pkg, context) => {
1818

1919
if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) {
2020
try {
21-
const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], {cwd, env});
21+
const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], {
22+
cwd,
23+
env,
24+
preferLocal: true,
25+
});
2226
whoamiResult.stdout.pipe(stdout, {end: false});
2327
whoamiResult.stderr.pipe(stderr, {end: false});
2428
await whoamiResult;

0 commit comments

Comments
 (0)
Please sign in to comment.