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 lernaDir;
let lernaPackages; let lernaPackages;
let lernaClient; let lernaClient;
let hasFileRefs = false;
const lernaJson = JSON.parse( const lernaJson = JSON.parse(
await platform.getFile(upath.join(path.dirname(fileName), 'lerna.json')) 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:')) { if (dep.currentValue.startsWith('file:')) {
dep.skipReason = 'file'; dep.skipReason = 'file';
hasFileRefs = true;
return dep; return dep;
} }
if (semver.isValid(dep.currentValue)) { if (semver.isValid(dep.currentValue)) {
@ -270,19 +268,6 @@ async function extractPackageFile(content, fileName, config) {
return null; 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 { return {
deps, deps,
packageJsonName, packageJsonName,
@ -294,7 +279,6 @@ async function extractPackageFile(content, fileName, config) {
lernaDir, lernaDir,
lernaClient, lernaClient,
lernaPackages, lernaPackages,
skipInstalls,
yarnWorkspacesPackages, yarnWorkspacesPackages,
}; };
} }

View file

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

View file

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