diff --git a/scripts/package-count.sh b/scripts/package-count.sh index 8d5b2ab0e8..4d2b845ec6 100644 --- a/scripts/package-count.sh +++ b/scripts/package-count.sh @@ -18,7 +18,16 @@ infer_package_manager() { elif [[ -f "vlt-lock.json" ]]; then echo "vlt" elif [[ -f "pnpm-lock.yaml" ]]; then - echo "pnpm" + # pnpm (v11, TypeScript) and pacquet (pnpm v12, Rust) both leave a + # pnpm-lock.yaml, so the lockfile alone can't tell them apart. The + # installer records its own version in node_modules/.modules.yaml + # (packageManager: pnpm@); v12+ is pacquet. + pnpm_major=$(sed -n "s/^packageManager: ['\"]\{0,1\}pnpm@\([0-9][0-9]*\).*/\1/p" node_modules/.modules.yaml 2>/dev/null | head -1) + if [[ -n "$pnpm_major" && "$pnpm_major" -ge 12 ]]; then + echo "pacquet" + else + echo "pnpm" + fi elif [[ -f "yarn.lock" ]]; then if [[ -f ".yarnrc.yml" ]] && command -v yarn >/dev/null 2>&1; then yarn_version=$(yarn -v 2>/dev/null || echo "") diff --git a/scripts/variations/lockfile+node_modules.sh b/scripts/variations/lockfile+node_modules.sh index df22d610d1..c86c72cf07 100644 --- a/scripts/variations/lockfile+node_modules.sh +++ b/scripts/variations/lockfile+node_modules.sh @@ -4,8 +4,11 @@ set -Eeuxo pipefail # Load common variables source "$1/variations/common.sh" -# Prepare command base for each run -BENCH_PREPARE_BASE="sleep 1; bash $BENCH_SCRIPTS/clean-helpers.sh clean_all_cache clean_package_manager_files" +# Prepare command base for each run. +# clean_package_manager_field must run AFTER clean_all_cache: the corepack +# yarn cache cleans re-pin devEngines.packageManager (yarn) into package.json, +# which makes npm and pnpm refuse to run entirely (see clean_all). +BENCH_PREPARE_BASE="sleep 1; bash $BENCH_SCRIPTS/clean-helpers.sh clean_all_cache clean_package_manager_files clean_package_manager_field" # Run the benchmark suite # When running a cache benchmark, we want to clean up only the node_modules diff --git a/scripts/variations/lockfile.sh b/scripts/variations/lockfile.sh index 6ac11e925a..c06d61a104 100644 --- a/scripts/variations/lockfile.sh +++ b/scripts/variations/lockfile.sh @@ -4,8 +4,11 @@ set -Eeuxo pipefail # Load common variables source "$1/variations/common.sh" -# Prepare command base for each run -BENCH_PREPARE_BASE="sleep 1; bash $BENCH_SCRIPTS/clean-helpers.sh clean_all_cache clean_node_modules clean_package_manager_files" +# Prepare command base for each run. +# clean_package_manager_field must run AFTER clean_all_cache: the corepack +# yarn cache cleans re-pin devEngines.packageManager (yarn) into package.json, +# which makes npm and pnpm refuse to run entirely (see clean_all). +BENCH_PREPARE_BASE="sleep 1; bash $BENCH_SCRIPTS/clean-helpers.sh clean_all_cache clean_node_modules clean_package_manager_files clean_package_manager_field" # Run the benchmark suite # When running a cache benchmark, we want to clean up only the node_modules diff --git a/scripts/variations/node_modules.sh b/scripts/variations/node_modules.sh index 3264eeba70..8cedd44859 100644 --- a/scripts/variations/node_modules.sh +++ b/scripts/variations/node_modules.sh @@ -4,8 +4,11 @@ set -Eeuxo pipefail # Load common variables source "$1/variations/common.sh" -# Prepare command base for each run -BENCH_PREPARE_BASE="sleep 1; bash $BENCH_SCRIPTS/clean-helpers.sh clean_all_cache clean_lockfiles clean_package_manager_files" +# Prepare command base for each run. +# clean_package_manager_field must run AFTER clean_all_cache: the corepack +# yarn cache cleans re-pin devEngines.packageManager (yarn) into package.json, +# which makes npm and pnpm refuse to run entirely (see clean_all). +BENCH_PREPARE_BASE="sleep 1; bash $BENCH_SCRIPTS/clean-helpers.sh clean_all_cache clean_lockfiles clean_package_manager_files clean_package_manager_field" # Run the benchmark suite # When running a cache benchmark, we want to clean up only the node_modules