Skip to content

Commit

Permalink
package.json: Add packageManager field for corepack compatibility (#4…
Browse files Browse the repository at this point in the history
…0201)

* package.json: Add packageManager field for corepack compatibility

* change to 9.3.0 to align with github actions

* add manage-package-manager-versions=false

* Add structure linting check

---------

Co-authored-by: Brad Jorsch <[email protected]>
  • Loading branch information
mreishus and anomiex authored Nov 15, 2024
1 parent f40bfc8 commit c23823d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/files/lint-project-structure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
"engines": {
"node": "^22.9.0",
"pnpm": "^9.3.0 <9.12.0"
}
},
"packageManager": "[email protected]"
}

0 comments on commit c23823d

Please sign in to comment.