@vercel/build-utils 9.3.0 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/fs/run-user-scripts.js +44 -39
- package/dist/index.js +44 -39
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# @vercel/build-utils
|
2
2
|
|
3
|
+
## 9.3.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [build-utils] extract install command specific logic into helper ([#13049](https://github.com/vercel/vercel/pull/13049))
|
8
|
+
|
9
|
+
- [build-utils] remove dead node 16 check ([#13047](https://github.com/vercel/vercel/pull/13047))
|
10
|
+
|
3
11
|
## 9.3.0
|
4
12
|
|
5
13
|
### Minor Changes
|
@@ -423,6 +423,45 @@ async function walkParentDirsMulti({
|
|
423
423
|
function isSet(v) {
|
424
424
|
return v?.constructor?.name === "Set";
|
425
425
|
}
|
426
|
+
async function runInstallCommand({
|
427
|
+
packageManager,
|
428
|
+
args,
|
429
|
+
opts
|
430
|
+
}) {
|
431
|
+
const getInstallCommandForPackageManager = (packageManager2, args2) => {
|
432
|
+
switch (packageManager2) {
|
433
|
+
case "npm":
|
434
|
+
return {
|
435
|
+
prettyCommand: "npm install",
|
436
|
+
commandArguments: args2.filter((a) => a !== "--prefer-offline").concat(["install", "--no-audit", "--unsafe-perm"])
|
437
|
+
};
|
438
|
+
case "pnpm":
|
439
|
+
return {
|
440
|
+
prettyCommand: "pnpm install",
|
441
|
+
// PNPM's install command is similar to NPM's but without the audit nonsense
|
442
|
+
// @see options https://pnpm.io/cli/install
|
443
|
+
commandArguments: args2.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"])
|
444
|
+
};
|
445
|
+
case "bun":
|
446
|
+
return {
|
447
|
+
prettyCommand: "bun install",
|
448
|
+
// @see options https://bun.sh/docs/cli/install
|
449
|
+
commandArguments: ["install", ...args2]
|
450
|
+
};
|
451
|
+
case "yarn":
|
452
|
+
return {
|
453
|
+
prettyCommand: "yarn install",
|
454
|
+
commandArguments: ["install", ...args2]
|
455
|
+
};
|
456
|
+
}
|
457
|
+
};
|
458
|
+
const { commandArguments, prettyCommand } = getInstallCommandForPackageManager(packageManager, args);
|
459
|
+
opts.prettyCommand = prettyCommand;
|
460
|
+
if (process.env.NPM_ONLY_PRODUCTION) {
|
461
|
+
commandArguments.push("--production");
|
462
|
+
}
|
463
|
+
await spawnAsync(packageManager, commandArguments, opts);
|
464
|
+
}
|
426
465
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion) {
|
427
466
|
if (meta?.isDev) {
|
428
467
|
(0, import_debug.default)("Skipping dependency installation because dev mode is enabled");
|
@@ -473,45 +512,11 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
473
512
|
packageJsonEngines: packageJson?.engines,
|
474
513
|
turboSupportsCorepackHome
|
475
514
|
});
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
opts
|
480
|
-
|
481
|
-
if (isPotentiallyBrokenNpm && spawnOpts?.env?.VERCEL_NPM_LEGACY_PEER_DEPS === "1") {
|
482
|
-
commandArgs.push("--legacy-peer-deps");
|
483
|
-
}
|
484
|
-
} else if (cliType === "pnpm") {
|
485
|
-
opts.prettyCommand = "pnpm install";
|
486
|
-
commandArgs = args.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"]);
|
487
|
-
} else if (cliType === "bun") {
|
488
|
-
opts.prettyCommand = "bun install";
|
489
|
-
commandArgs = ["install", ...args];
|
490
|
-
} else {
|
491
|
-
opts.prettyCommand = "yarn install";
|
492
|
-
commandArgs = ["install", ...args];
|
493
|
-
}
|
494
|
-
if (process.env.NPM_ONLY_PRODUCTION) {
|
495
|
-
commandArgs.push("--production");
|
496
|
-
}
|
497
|
-
try {
|
498
|
-
await spawnAsync(cliType, commandArgs, opts);
|
499
|
-
} catch (err) {
|
500
|
-
const potentialErrorPath = import_path.default.join(
|
501
|
-
process.env.HOME || "/",
|
502
|
-
".npm",
|
503
|
-
"eresolve-report.txt"
|
504
|
-
);
|
505
|
-
if (isPotentiallyBrokenNpm && !commandArgs.includes("--legacy-peer-deps") && import_fs_extra.default.existsSync(potentialErrorPath)) {
|
506
|
-
console.warn(
|
507
|
-
'Warning: Retrying "Install Command" with `--legacy-peer-deps` which may accept a potentially broken dependency and slow install time.'
|
508
|
-
);
|
509
|
-
commandArgs.push("--legacy-peer-deps");
|
510
|
-
await spawnAsync(cliType, commandArgs, opts);
|
511
|
-
} else {
|
512
|
-
throw err;
|
513
|
-
}
|
514
|
-
}
|
515
|
+
await runInstallCommand({
|
516
|
+
packageManager: cliType,
|
517
|
+
args,
|
518
|
+
opts
|
519
|
+
});
|
515
520
|
(0, import_debug.default)(`Install complete [${Date.now() - installTime}ms]`);
|
516
521
|
return true;
|
517
522
|
} finally {
|
package/dist/index.js
CHANGED
@@ -23436,6 +23436,45 @@ async function walkParentDirsMulti({
|
|
23436
23436
|
function isSet(v) {
|
23437
23437
|
return v?.constructor?.name === "Set";
|
23438
23438
|
}
|
23439
|
+
async function runInstallCommand({
|
23440
|
+
packageManager,
|
23441
|
+
args,
|
23442
|
+
opts
|
23443
|
+
}) {
|
23444
|
+
const getInstallCommandForPackageManager = (packageManager2, args2) => {
|
23445
|
+
switch (packageManager2) {
|
23446
|
+
case "npm":
|
23447
|
+
return {
|
23448
|
+
prettyCommand: "npm install",
|
23449
|
+
commandArguments: args2.filter((a) => a !== "--prefer-offline").concat(["install", "--no-audit", "--unsafe-perm"])
|
23450
|
+
};
|
23451
|
+
case "pnpm":
|
23452
|
+
return {
|
23453
|
+
prettyCommand: "pnpm install",
|
23454
|
+
// PNPM's install command is similar to NPM's but without the audit nonsense
|
23455
|
+
// @see options https://pnpm.io/cli/install
|
23456
|
+
commandArguments: args2.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"])
|
23457
|
+
};
|
23458
|
+
case "bun":
|
23459
|
+
return {
|
23460
|
+
prettyCommand: "bun install",
|
23461
|
+
// @see options https://bun.sh/docs/cli/install
|
23462
|
+
commandArguments: ["install", ...args2]
|
23463
|
+
};
|
23464
|
+
case "yarn":
|
23465
|
+
return {
|
23466
|
+
prettyCommand: "yarn install",
|
23467
|
+
commandArguments: ["install", ...args2]
|
23468
|
+
};
|
23469
|
+
}
|
23470
|
+
};
|
23471
|
+
const { commandArguments, prettyCommand } = getInstallCommandForPackageManager(packageManager, args);
|
23472
|
+
opts.prettyCommand = prettyCommand;
|
23473
|
+
if (process.env.NPM_ONLY_PRODUCTION) {
|
23474
|
+
commandArguments.push("--production");
|
23475
|
+
}
|
23476
|
+
await spawnAsync(packageManager, commandArguments, opts);
|
23477
|
+
}
|
23439
23478
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion) {
|
23440
23479
|
if (meta?.isDev) {
|
23441
23480
|
debug("Skipping dependency installation because dev mode is enabled");
|
@@ -23486,45 +23525,11 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
23486
23525
|
packageJsonEngines: packageJson?.engines,
|
23487
23526
|
turboSupportsCorepackHome
|
23488
23527
|
});
|
23489
|
-
|
23490
|
-
|
23491
|
-
|
23492
|
-
opts
|
23493
|
-
|
23494
|
-
if (isPotentiallyBrokenNpm && spawnOpts?.env?.VERCEL_NPM_LEGACY_PEER_DEPS === "1") {
|
23495
|
-
commandArgs.push("--legacy-peer-deps");
|
23496
|
-
}
|
23497
|
-
} else if (cliType === "pnpm") {
|
23498
|
-
opts.prettyCommand = "pnpm install";
|
23499
|
-
commandArgs = args.filter((a) => a !== "--prefer-offline").concat(["install", "--unsafe-perm"]);
|
23500
|
-
} else if (cliType === "bun") {
|
23501
|
-
opts.prettyCommand = "bun install";
|
23502
|
-
commandArgs = ["install", ...args];
|
23503
|
-
} else {
|
23504
|
-
opts.prettyCommand = "yarn install";
|
23505
|
-
commandArgs = ["install", ...args];
|
23506
|
-
}
|
23507
|
-
if (process.env.NPM_ONLY_PRODUCTION) {
|
23508
|
-
commandArgs.push("--production");
|
23509
|
-
}
|
23510
|
-
try {
|
23511
|
-
await spawnAsync(cliType, commandArgs, opts);
|
23512
|
-
} catch (err) {
|
23513
|
-
const potentialErrorPath = import_path5.default.join(
|
23514
|
-
process.env.HOME || "/",
|
23515
|
-
".npm",
|
23516
|
-
"eresolve-report.txt"
|
23517
|
-
);
|
23518
|
-
if (isPotentiallyBrokenNpm && !commandArgs.includes("--legacy-peer-deps") && import_fs_extra7.default.existsSync(potentialErrorPath)) {
|
23519
|
-
console.warn(
|
23520
|
-
'Warning: Retrying "Install Command" with `--legacy-peer-deps` which may accept a potentially broken dependency and slow install time.'
|
23521
|
-
);
|
23522
|
-
commandArgs.push("--legacy-peer-deps");
|
23523
|
-
await spawnAsync(cliType, commandArgs, opts);
|
23524
|
-
} else {
|
23525
|
-
throw err;
|
23526
|
-
}
|
23527
|
-
}
|
23528
|
+
await runInstallCommand({
|
23529
|
+
packageManager: cliType,
|
23530
|
+
args,
|
23531
|
+
opts
|
23532
|
+
});
|
23528
23533
|
debug(`Install complete [${Date.now() - installTime}ms]`);
|
23529
23534
|
return true;
|
23530
23535
|
} finally {
|