Skip to content

Commit

Permalink
fix: add preferLocal option to allow execa to use local npm version (
Browse files Browse the repository at this point in the history
…#445)

Co-authored-by: Matt Travi <[email protected]>
  • Loading branch information
antongolub and travi authored Jan 17, 2022
1 parent 19761ed commit 002439e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/add-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = async (npmrc, {npmPublish}, pkg, context) => {
{
cwd,
env,
preferLocal: true,
}
);
result.stdout.pipe(stdout, {end: false});
Expand Down
2 changes: 1 addition & 1 deletion lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});

Expand Down
2 changes: 1 addition & 1 deletion lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
6 changes: 5 additions & 1 deletion lib/verify-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
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;
Expand Down

0 comments on commit 002439e

Please sign in to comment.