fix(npm): don’t set skipInstalls when file refs found

This commit is contained in:
Rhys Arkins 2019-03-23 11:24:25 +01:00
parent 2e6b7aea85
commit 45007169f4
3 changed files with 0 additions and 24 deletions

View file

@ -116,7 +116,6 @@ async function extractPackageFile(content, fileName, config) {
let lernaDir;
let lernaPackages;
let lernaClient;
let hasFileRefs = false;
const lernaJson = JSON.parse(
await platform.getFile(upath.join(path.dirname(fileName), 'lerna.json'))
);
@ -166,7 +165,6 @@ async function extractPackageFile(content, fileName, config) {
}
if (dep.currentValue.startsWith('file:')) {
dep.skipReason = 'file';
hasFileRefs = true;
return dep;
}
if (semver.isValid(dep.currentValue)) {
@ -270,19 +268,6 @@ async function extractPackageFile(content, fileName, config) {
return null;
}
}
let skipInstalls = config.skipInstalls;
if (skipInstalls === null) {
if (hasFileRefs) {
// https://npm.community/t/npm-i-package-lock-only-changes-lock-file-incorrectly-when-file-references-used-in-dependencies/1412
// Explanation:
// - npm install --package-lock-only is buggy for transitive deps in file: references
// - So we set skipInstalls to false if file: refs are found *and* the user hasn't explicitly set the value already
logger.info('Automatically setting skipInstalls to false');
skipInstalls = false;
} else {
skipInstalls = true;
}
}
return {
deps,
packageJsonName,
@ -294,7 +279,6 @@ async function extractPackageFile(content, fileName, config) {
lernaDir,
lernaClient,
lernaPackages,
skipInstalls,
yarnWorkspacesPackages,
};
}

View file

@ -19,7 +19,6 @@ Object {
"packageJsonType": "app",
"packageJsonVersion": undefined,
"pnpmShrinkwrap": undefined,
"skipInstalls": true,
"yarnLock": undefined,
"yarnWorkspacesPackages": undefined,
"yarnrc": undefined,
@ -120,7 +119,6 @@ Object {
"packageJsonType": "app",
"packageJsonVersion": undefined,
"pnpmShrinkwrap": undefined,
"skipInstalls": false,
"yarnLock": undefined,
"yarnWorkspacesPackages": undefined,
"yarnrc": undefined,
@ -280,7 +278,6 @@ Object {
"packageJsonType": "app",
"packageJsonVersion": undefined,
"pnpmShrinkwrap": undefined,
"skipInstalls": true,
"yarnLock": undefined,
"yarnWorkspacesPackages": undefined,
"yarnrc": undefined,
@ -376,7 +373,6 @@ Object {
"packageJsonType": "app",
"packageJsonVersion": "1.0.0",
"pnpmShrinkwrap": undefined,
"skipInstalls": true,
"yarnLock": "yarn.lock",
"yarnWorkspacesPackages": undefined,
"yarnrc": undefined,
@ -395,7 +391,6 @@ Object {
"packageJsonType": "app",
"packageJsonVersion": "0.0.8",
"pnpmShrinkwrap": undefined,
"skipInstalls": true,
"yarnLock": undefined,
"yarnWorkspacesPackages": Array [
"packages/*",
@ -493,7 +488,6 @@ Object {
"packageJsonType": "app",
"packageJsonVersion": "1.0.0",
"pnpmShrinkwrap": undefined,
"skipInstalls": true,
"yarnLock": undefined,
"yarnWorkspacesPackages": undefined,
"yarnrc": undefined,
@ -589,7 +583,6 @@ Object {
"packageJsonType": "app",
"packageJsonVersion": "1.0.0",
"pnpmShrinkwrap": undefined,
"skipInstalls": true,
"yarnLock": undefined,
"yarnWorkspacesPackages": undefined,
"yarnrc": undefined,

View file

@ -15,7 +15,6 @@ Array [
"packageJsonType": "app",
"packageJsonVersion": undefined,
"pnpmShrinkwrap": "shrinkwrap.yaml",
"skipInstalls": true,
"yarnLock": "yarn.lock",
"yarnWorkspacesPackages": undefined,
"yarnrc": "{}",