chore: revert hasFancyRefs

This commit is contained in:
Rhys Arkins 2021-04-22 07:58:49 +02:00
parent 572749a398
commit 6232b654be
2 changed files with 7 additions and 6 deletions

View file

@ -357,7 +357,7 @@ Object {
"packageJsonName": undefined, "packageJsonName": undefined,
"packageJsonType": "app", "packageJsonType": "app",
"pnpmShrinkwrap": undefined, "pnpmShrinkwrap": undefined,
"skipInstalls": true, "skipInstalls": false,
"yarnLock": undefined, "yarnLock": undefined,
"yarnWorkspacesPackages": undefined, "yarnWorkspacesPackages": undefined,
"yarnrc": undefined, "yarnrc": undefined,

View file

@ -126,7 +126,7 @@ export async function extractPackageFile(
let lernaJsonFile: string; let lernaJsonFile: string;
let lernaPackages: string[]; let lernaPackages: string[];
let lernaClient: 'yarn' | 'npm'; let lernaClient: 'yarn' | 'npm';
let hasFileRefs = false; let hasFancyRefs = false;
let lernaJson: { let lernaJson: {
packages: string[]; packages: string[];
npmClient: string; npmClient: string;
@ -224,6 +224,7 @@ export async function extractPackageFile(
if (dep.currentValue.startsWith('npm:')) { if (dep.currentValue.startsWith('npm:')) {
dep.npmPackageAlias = true; dep.npmPackageAlias = true;
hasFancyRefs = true;
const valSplit = dep.currentValue.replace('npm:', '').split('@'); const valSplit = dep.currentValue.replace('npm:', '').split('@');
if (valSplit.length === 2) { if (valSplit.length === 2) {
dep.lookupName = valSplit[0]; dep.lookupName = valSplit[0];
@ -237,7 +238,7 @@ export async function extractPackageFile(
} }
if (dep.currentValue.startsWith('file:')) { if (dep.currentValue.startsWith('file:')) {
dep.skipReason = SkipReason.File; dep.skipReason = SkipReason.File;
hasFileRefs = true; hasFancyRefs = true;
return dep; return dep;
} }
if (isValid(dep.currentValue)) { if (isValid(dep.currentValue)) {
@ -345,11 +346,11 @@ export async function extractPackageFile(
} }
let skipInstalls = config.skipInstalls; let skipInstalls = config.skipInstalls;
if (skipInstalls === null) { if (skipInstalls === null) {
if (hasFileRefs) { if (hasFancyRefs) {
// https://github.com/npm/cli/issues/1432 // https://github.com/npm/cli/issues/1432
// Explanation: // Explanation:
// - npm install --package-lock-only is buggy for transitive deps in file: references // - npm install --package-lock-only is buggy for transitive deps in file: and npm: references
// - So we set skipInstalls to false if file: refs are found *and* the user hasn't explicitly set the value already // - So we set skipInstalls to false if file: or npm: refs are found *and* the user hasn't explicitly set the value already
logger.debug('Automatically setting skipInstalls to false'); logger.debug('Automatically setting skipInstalls to false');
skipInstalls = false; skipInstalls = false;
} else { } else {