diff --git a/.github/files/lint-project-structure.sh b/.github/files/lint-project-structure.sh index f081abc47b41c..923455db849c6 100755 --- a/.github/files/lint-project-structure.sh +++ b/.github/files/lint-project-structure.sh @@ -642,6 +642,11 @@ if ! pnpm semver --range "$RANGE" "$PNPM_VERSION" &>/dev/null; then LINE=$(jq --stream 'if length == 1 then .[0][:-1] else .[0] end | if . == ["engines","pnpm"] then input_line_number - 1 else empty end' package.json) echo "::error file=package.json,line=$LINE::Pnpm version $PNPM_VERSION in .github/versions.sh does not satisfy requirement $RANGE from package.json" fi +if ! jq -e --arg v "pnpm@$PNPM_VERSION" '.packageManager == $v' package.json &>/dev/null; then + EXIT=1 + LINE=$(jq --stream 'if length == 1 then .[0][:-1] else .[0] end | if . == ["packageManager"] then input_line_number - 1 else empty end' package.json) + echo "::error file=package.json,line=$LINE::Version in package.json packageManager must be \"pnpm@$PNPM_VERSION\", to match .github/versions.sh." +fi # - Check for incorrect next-version tokens. debug "Checking for incorrect next-version tokens." diff --git a/.npmrc b/.npmrc index 685f1ad31f63c..c1c907fa86634 100644 --- a/.npmrc +++ b/.npmrc @@ -25,3 +25,5 @@ resolution-mode = highest # @automattic/jetpack-webpack-config looks for this. jetpack-webpack-config-resolve-conditions=jetpack:src + +manage-package-manager-versions=false diff --git a/package.json b/package.json index b7d34e0aa51d2..347afccb62110 100644 --- a/package.json +++ b/package.json @@ -36,5 +36,6 @@ "engines": { "node": "^22.9.0", "pnpm": "^9.3.0 <9.12.0" - } + }, + "packageManager": "pnpm@9.3.0" }