From 3b121dbf2357c662ffc2b63ee765fd30d438e833 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Tue, 17 Nov 2026 19:33:57 +0000 Subject: [PATCH] fix(build): make nx's build runs on next run inside an Nx workspace nx failed every build and build-cache run on next ("isn't part of an Nx workspace"; with only a workspace marker, "Could not find Nx modules"), so it has never had a result there. nx's prepare now installs the global nx version locally with --no-save and sets "nx": {} in package.json. The fixture and lockfile are unchanged, so no install variation is affected; cleanup already restores package.json and removes node_modules. Closes #205 Co-Authored-By: Claude Opus 5.5 --- suite/scripts/variations/build-cache.sh | 2 +- suite/scripts/variations/build.sh | 2 +- suite/scripts/variations/common.sh | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/suite/scripts/variations/build-cache.sh b/suite/scripts/variations/build-cache.sh index 749b3ac908..3eda632721 100644 --- a/suite/scripts/variations/build-cache.sh +++ b/suite/scripts/variations/build-cache.sh @@ -91,7 +91,7 @@ hyperfine --ignore-failure \ ${BENCH_INCLUDE_AUBE:+--command-name="aube" "$BENCH_COMMAND_AUBE"} \ ${BENCH_INCLUDE_UPM:+--prepare="$BENCH_INSTALL_PREPARE_UPM || true; bash $BENCH_SCRIPTS/clean-helpers.sh clean_build_output; $BENCH_WARM_BUILD_UPM || true"} \ ${BENCH_INCLUDE_UPM:+--command-name="upm" "$BENCH_COMMAND_UPM"} \ - ${BENCH_INCLUDE_NX:+--prepare="$BENCH_INSTALL_PREPARE_NPM || true; bash $BENCH_SCRIPTS/clean-helpers.sh clean_build_output; $BENCH_WARM_BUILD_NX || true"} \ + ${BENCH_INCLUDE_NX:+--prepare="$BENCH_INSTALL_PREPARE_NPM || true; $BENCH_SETUP_NX; bash $BENCH_SCRIPTS/clean-helpers.sh clean_build_output; $BENCH_WARM_BUILD_NX || true"} \ ${BENCH_INCLUDE_NX:+--command-name="nx" "$BENCH_COMMAND_NX"} \ ${BENCH_INCLUDE_TURBO:+--prepare="$BENCH_INSTALL_PREPARE_NPM || true; bash $BENCH_SCRIPTS/clean-helpers.sh clean_build_output; $BENCH_WARM_BUILD_TURBO || true"} \ ${BENCH_INCLUDE_TURBO:+--command-name="turbo" "$BENCH_COMMAND_TURBO"} \ diff --git a/suite/scripts/variations/build.sh b/suite/scripts/variations/build.sh index 636d91b333..595ade5a89 100644 --- a/suite/scripts/variations/build.sh +++ b/suite/scripts/variations/build.sh @@ -78,7 +78,7 @@ hyperfine --ignore-failure \ ${BENCH_INCLUDE_AUBE:+--command-name="aube" "$BENCH_COMMAND_AUBE"} \ ${BENCH_INCLUDE_UPM:+--prepare="$BENCH_INSTALL_PREPARE_UPM || true; bash $BENCH_SCRIPTS/clean-helpers.sh clean_build_output"} \ ${BENCH_INCLUDE_UPM:+--command-name="upm" "$BENCH_COMMAND_UPM"} \ - ${BENCH_INCLUDE_NX:+--prepare="$BENCH_INSTALL_PREPARE_NPM || true; bash $BENCH_SCRIPTS/clean-helpers.sh clean_build_output"} \ + ${BENCH_INCLUDE_NX:+--prepare="$BENCH_INSTALL_PREPARE_NPM || true; $BENCH_SETUP_NX; bash $BENCH_SCRIPTS/clean-helpers.sh clean_build_output"} \ ${BENCH_INCLUDE_NX:+--command-name="nx" "$BENCH_COMMAND_NX"} \ ${BENCH_INCLUDE_TURBO:+--prepare="$BENCH_INSTALL_PREPARE_NPM || true; bash $BENCH_SCRIPTS/clean-helpers.sh clean_build_output"} \ ${BENCH_INCLUDE_TURBO:+--command-name="turbo" "$BENCH_COMMAND_TURBO"} \ diff --git a/suite/scripts/variations/common.sh b/suite/scripts/variations/common.sh index f0c319bcce..36577df63a 100644 --- a/suite/scripts/variations/common.sh +++ b/suite/scripts/variations/common.sh @@ -80,7 +80,15 @@ BENCH_SETUP_BUN="" BENCH_SETUP_DENO="" BENCH_SETUP_AUBE="npm pkg delete packageManager >/dev/null 2>&1 || true" BENCH_SETUP_UPM="" -BENCH_SETUP_NX="" +# nx needs a local copy of itself and an Nx workspace; a global nx alone fails +# with "isn't part of an Nx workspace" / "Could not find Nx modules". The next +# fixture has neither, and adding nx as a devDependency would change what every +# install variation on next measures. So the nx build prepares install the same +# nx version as the global one (setup.sh) without saving it, and mark +# package.json as a workspace. Cleanup restores package.json (git checkout) and +# removes node_modules. +BENCH_NX_VERSION="$(node -p "require('$(npm root -g)/nx/package.json').version" 2>/dev/null || echo latest)" +BENCH_SETUP_NX="npm install --no-save --no-audit --no-fund --ignore-scripts --silent nx@$BENCH_NX_VERSION && npm pkg set nx='{}' --json" BENCH_SETUP_TURBO="" # vp install delegates to Yarn 4, so it needs the same yarn.lock as berry above. BENCH_SETUP_VP="touch yarn.lock"