@vercel/build-utils 14.0.1 → 14.0.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 14.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - b7ec19b: Scope the pre-compilation install's `VERCEL_INSTALL_COMPLETED` marker to the `package.json` it installed. Previously, a `vercel.toml`/`vercel.ts` config caused `vc build` to install at the repo root and then silently skip every later default install, so services whose install root is a different workspace (its own `package.json`/lockfile) built without dependencies.
8
+
3
9
  ## 14.0.1
4
10
 
5
11
  ### Patch Changes
@@ -592,6 +592,16 @@ function checkIfAlreadyInstalled(runNpmInstallSet, packageJsonPath) {
592
592
  return { alreadyInstalled, runNpmInstallSet: initializedRunNpmInstallSet };
593
593
  }
594
594
  const runNpmInstallSema = new import_async_sema.default(1);
595
+ function installCompletedCovers(packageJsonPath) {
596
+ if (process.env.VERCEL_INSTALL_COMPLETED !== "1") {
597
+ return false;
598
+ }
599
+ const completedPath = process.env.VERCEL_INSTALL_COMPLETED_PATH;
600
+ if (!completedPath) {
601
+ return true;
602
+ }
603
+ return packageJsonPath !== void 0 && import_path.default.normalize(completedPath) === import_path.default.normalize(packageJsonPath);
604
+ }
595
605
  let customInstallCommandSet;
596
606
  function resetCustomInstallCommandSet() {
597
607
  customInstallCommandSet = void 0;
@@ -627,7 +637,7 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
627
637
  if (alreadyInstalled) {
628
638
  return false;
629
639
  }
630
- if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
640
+ if (installCompletedCovers(packageJsonPath)) {
631
641
  (0, import_debug.default)(
632
642
  `Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`
633
643
  );
@@ -1041,20 +1051,21 @@ async function runCustomInstallCommand({
1041
1051
  );
1042
1052
  return false;
1043
1053
  }
1044
- if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
1045
- (0, import_debug.default)(
1046
- `Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`
1047
- );
1048
- return false;
1049
- }
1050
- console.log(`Running "install" command: \`${installCommand}\`...`);
1051
1054
  const {
1052
1055
  cliType,
1053
1056
  lockfileVersion,
1054
1057
  packageJson,
1058
+ packageJsonPath,
1055
1059
  packageJsonPackageManager,
1056
1060
  turboSupportsCorepackHome
1057
1061
  } = await scanParentDirs(destPath, true);
1062
+ if (installCompletedCovers(packageJsonPath)) {
1063
+ (0, import_debug.default)(
1064
+ `Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`
1065
+ );
1066
+ return false;
1067
+ }
1068
+ console.log(`Running "install" command: \`${installCommand}\`...`);
1058
1069
  const env = getEnvForPackageManager({
1059
1070
  cliType,
1060
1071
  lockfileVersion,
package/dist/index.js CHANGED
@@ -34433,6 +34433,16 @@ function checkIfAlreadyInstalled(runNpmInstallSet, packageJsonPath) {
34433
34433
  return { alreadyInstalled, runNpmInstallSet: initializedRunNpmInstallSet };
34434
34434
  }
34435
34435
  var runNpmInstallSema = new import_async_sema4.default(1);
34436
+ function installCompletedCovers(packageJsonPath) {
34437
+ if (process.env.VERCEL_INSTALL_COMPLETED !== "1") {
34438
+ return false;
34439
+ }
34440
+ const completedPath = process.env.VERCEL_INSTALL_COMPLETED_PATH;
34441
+ if (!completedPath) {
34442
+ return true;
34443
+ }
34444
+ return packageJsonPath !== void 0 && import_path6.default.normalize(completedPath) === import_path6.default.normalize(packageJsonPath);
34445
+ }
34436
34446
  var customInstallCommandSet;
34437
34447
  function resetCustomInstallCommandSet() {
34438
34448
  customInstallCommandSet = void 0;
@@ -34468,7 +34478,7 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
34468
34478
  if (alreadyInstalled) {
34469
34479
  return false;
34470
34480
  }
34471
- if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
34481
+ if (installCompletedCovers(packageJsonPath)) {
34472
34482
  debug(
34473
34483
  `Skipping dependency installation for ${packageJsonPath} because VERCEL_INSTALL_COMPLETED is set`
34474
34484
  );
@@ -34882,20 +34892,21 @@ async function runCustomInstallCommand({
34882
34892
  );
34883
34893
  return false;
34884
34894
  }
34885
- if (process.env.VERCEL_INSTALL_COMPLETED === "1") {
34886
- debug(
34887
- `Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`
34888
- );
34889
- return false;
34890
- }
34891
- console.log(`Running "install" command: \`${installCommand}\`...`);
34892
34895
  const {
34893
34896
  cliType,
34894
34897
  lockfileVersion,
34895
34898
  packageJson,
34899
+ packageJsonPath,
34896
34900
  packageJsonPackageManager,
34897
34901
  turboSupportsCorepackHome
34898
34902
  } = await scanParentDirs(destPath, true);
34903
+ if (installCompletedCovers(packageJsonPath)) {
34904
+ debug(
34905
+ `Skipping custom install command for ${normalizedPath} because VERCEL_INSTALL_COMPLETED is set`
34906
+ );
34907
+ return false;
34908
+ }
34909
+ console.log(`Running "install" command: \`${installCommand}\`...`);
34899
34910
  const env = getEnvForPackageManager({
34900
34911
  cliType,
34901
34912
  lockfileVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "14.0.1",
3
+ "version": "14.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -53,14 +53,14 @@
53
53
  "vitest": "2.0.1",
54
54
  "typescript": "4.9.5",
55
55
  "yazl": "2.5.1",
56
- "@vercel/routing-utils": "6.4.1",
57
- "@vercel/error-utils": "2.2.1"
56
+ "@vercel/error-utils": "2.2.1",
57
+ "@vercel/routing-utils": "6.4.1"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "node build.mjs",
61
61
  "test": "vitest run --config ../../vitest.config.mts",
62
62
  "vitest-run": "vitest -c ../../vitest.config.mts",
63
- "vitest-unit": "glob --absolute 'test/unit.*test.ts'",
63
+ "vitest-unit": "pnpm vitest-run --run test/unit.",
64
64
  "vitest-e2e": "glob --absolute 'test/integration*.test.ts'",
65
65
  "type-check": "tsc --noEmit"
66
66
  }