feat(npm): Update Yarn install arguments (#7156)

Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
Kid 2020-09-01 21:57:55 +08:00 committed by GitHub
parent 2d344b1a69
commit 6fb36435f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -115,7 +115,7 @@ Array [
exports[`manager/npm/post-update/yarn generates lock files using yarn v2.1.0 1`] = ` exports[`manager/npm/post-update/yarn generates lock files using yarn v2.1.0 1`] = `
Array [ Array [
Object { Object {
"cmd": "yarn install --ignore-engines --ignore-platform --network-timeout 100000", "cmd": "yarn install",
"options": Object { "options": Object {
"cwd": "some-dir", "cwd": "some-dir",
"encoding": "utf-8", "encoding": "utf-8",
@ -128,6 +128,7 @@ Array [
"NO_PROXY": "localhost", "NO_PROXY": "localhost",
"PATH": "/tmp/path", "PATH": "/tmp/path",
"YARN_ENABLE_SCRIPTS": "0", "YARN_ENABLE_SCRIPTS": "0",
"YARN_HTTP_TIMEOUT": "100000",
}, },
"timeout": 900000, "timeout": 900000,
}, },
@ -228,7 +229,7 @@ Array [
exports[`manager/npm/post-update/yarn performs lock file maintenance using yarn v2.1.0 1`] = ` exports[`manager/npm/post-update/yarn performs lock file maintenance using yarn v2.1.0 1`] = `
Array [ Array [
Object { Object {
"cmd": "yarn install --ignore-engines --ignore-platform --network-timeout 100000", "cmd": "yarn install",
"options": Object { "options": Object {
"cwd": "some-dir", "cwd": "some-dir",
"encoding": "utf-8", "encoding": "utf-8",
@ -241,6 +242,7 @@ Array [
"NO_PROXY": "localhost", "NO_PROXY": "localhost",
"PATH": "/tmp/path", "PATH": "/tmp/path",
"YARN_ENABLE_SCRIPTS": "0", "YARN_ENABLE_SCRIPTS": "0",
"YARN_HTTP_TIMEOUT": "100000",
}, },
"timeout": 900000, "timeout": 900000,
}, },

View file

@ -74,8 +74,13 @@ export async function generateLockFile(
preCommands.push(optimizeCommand); preCommands.push(optimizeCommand);
} }
const commands = []; const commands = [];
let cmdOptions = let cmdOptions = '';
'--ignore-engines --ignore-platform --network-timeout 100000'; if (isYarn1) {
cmdOptions +=
'--ignore-engines --ignore-platform --network-timeout 100000';
} else {
extraEnv.YARN_HTTP_TIMEOUT = '100000';
}
if (global.trustLevel !== 'high' || config.ignoreScripts) { if (global.trustLevel !== 'high' || config.ignoreScripts) {
if (isYarn1) { if (isYarn1) {
cmdOptions += ' --ignore-scripts'; cmdOptions += ' --ignore-scripts';