Skip to content

Commit

Permalink
Update to node 20
Browse files Browse the repository at this point in the history
Calypso has updated to node 20, which means it's time for us to do so as
well.

Also, it has been two years since we switched from yarn to pnpm. Let's
clean up the dummy `.engines.yarn` and remove the doc it references.

Also, since pnpm is the only thing (as far as I know) we use that checks
package.json `.engines` and it's happy to check the monorepo root for
everything, let's remove the engines from all the projects'
package.jsons so we don't have to have such a giant PR in the future.
That means we can also get rid of the linting that syncs all the
projects' package.jsons and the special logic in the mirroring that
strips it out of the mirrors.
  • Loading branch information
anomiex committed Oct 26, 2023
1 parent 1755031 commit 05264e5
Show file tree
Hide file tree
Showing 173 changed files with 417 additions and 488 deletions.
21 changes: 0 additions & 21 deletions .github/files/lint-project-structure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ for PROJECT in projects/*; do
fi
done

ROOT_PACKAGE_JSON_ENGINES="$(jq '.engines | .pnpm |= empty' package.json)"

for PROJECT in projects/*/*; do
SLUG="${PROJECT#projects/}"
TYPE="${SLUG%/*}"
Expand All @@ -97,25 +95,6 @@ for PROJECT in projects/*/*; do
echo "::error file=$PROJECT/.gitattributes::$PROJECT/.github/ should have git attribute export-ignore."
fi

# - package.json engines should match monorepo root package.json engines
if [[ -e "$PROJECT/package.json" ]]; then
PACKAGE_JSON_ENGINES="$(jq '.engines' "$PROJECT/package.json")"
if [[ "$PACKAGE_JSON_ENGINES" != "$ROOT_PACKAGE_JSON_ENGINES" ]]; then
EXIT=1
LINE=$(jq --stream --arg obj "$PACKAGE_JSON_ENGINES" 'if length == 1 then .[0][:-1] else .[0] end | if . == ["engines"] then input_line_number - ( $obj | gsub( "[^\n]"; "" ) | length ) else empty end' "$PROJECT/package.json")
if [[ -n "$LINE" ]]; then
echo "---" # Bracket message containing newlines for better visibility in GH's logs.
echo "::error file=$PROJECT/package.json,line=$LINE::Engines must match those in the monorepo root package.json (but omitting \"pnpm\").%0A \"engines\": ${ROOT_PACKAGE_JSON_ENGINES//$'\n'/%0A }"
echo "---"
else
LINE=$(wc -l < "$PROJECT/package.json")
echo "---" # Bracket message containing newlines for better visibility in GH's logs.
echo "::error file=$PROJECT/package.json,line=$LINE::Engines must be specified, matching those in the monorepo root package.json (but omitting \"pnpm\").%0A \"engines\": ${ROOT_PACKAGE_JSON_ENGINES//$'\n'/%0A }"
echo "---"
fi
fi
fi

# - package.json for js modules should look like a library to renovate.
if [[ "$PROJECT" == projects/js-packages/* && -e "$PROJECT/package.json" ]]; then
! IFS= read -r INDEX < <( ls -- "$PROJECT"/index.{js,jsx,cjs,mjs,ts,tsx,d.ts} 2>/dev/null )
Expand Down
2 changes: 1 addition & 1 deletion .github/versions.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Versions of tools to use in CI.
PHP_VERSION=8.2
COMPOSER_VERSION=2.6.5
NODE_VERSION=18.17.0
NODE_VERSION=20.8.1
PNPM_VERSION=8.6.8

# Other useful version numbers.
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.17.0
20.8.1
1 change: 0 additions & 1 deletion docs/monorepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ See PCYsg-xsv-p2#mirror-repo-secrets for details.

Note the following will also be done by the build process:

* In `package.json`, the `.engines` will be deleted. If there is a `.publish_engines`, it will be renamed to `.engines`.
* Entries will be prepended to `.npmignore` to ignore `.github` and `composer.json` during the NPM publish. This file will be created if not present.

Before you create the first release tag, you may want to check out the mirror and run `npm publish --dry-run` to ensure that only the files you want published will be published.
Expand Down
68 changes: 0 additions & 68 deletions docs/yarn-upgrade.md

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
"jetpack-js-tools": "workspace:*"
},
"engines": {
"node": "^18.13.0",
"pnpm": "^8.6.2",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
"node": "^20.8.1",
"pnpm": "^8.6.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


4 changes: 0 additions & 4 deletions projects/github-actions/repo-gardening/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,5 @@
},
"scripts": {
"build": "ncc build src/index.js -o dist --source-map --license licenses.txt"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


4 changes: 0 additions & 4 deletions projects/github-actions/required-review/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,5 @@
},
"scripts": {
"build": "ncc build src/main.js -o dist --source-map --license licenses.txt"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


4 changes: 0 additions & 4 deletions projects/github-actions/test-results-to-slack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,5 @@
"scripts": {
"build": "ncc build src/index.js -o dist --source-map --license licenses.txt",
"test": "jest --config=tests/jest.config.js --verbose --runInBand"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
}
}
5 changes: 5 additions & 0 deletions projects/js-packages/ai-client/changelog/update-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


6 changes: 1 addition & 5 deletions projects/js-packages/ai-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": false,
"name": "@automattic/jetpack-ai-client",
"version": "0.1.13",
"version": "0.1.14-alpha",
"description": "A JS client for consuming Jetpack AI services",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme",
"bugs": {
Expand All @@ -28,10 +28,6 @@
"jest-environment-jsdom": "29.5.0",
"typescript": "5.0.4"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
},
"exports": {
".": "./index.ts"
},
Expand Down
5 changes: 5 additions & 0 deletions projects/js-packages/analytics/changelog/update-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


6 changes: 1 addition & 5 deletions projects/js-packages/analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-analytics",
"version": "0.1.27",
"version": "0.1.28-alpha",
"description": "Jetpack Analytics Package",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/analytics/#readme",
"bugs": {
Expand All @@ -25,9 +25,5 @@
},
"scripts": {
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
}
}
5 changes: 5 additions & 0 deletions projects/js-packages/api/changelog/update-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


6 changes: 1 addition & 5 deletions projects/js-packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-api",
"version": "0.16.4",
"version": "0.16.5-alpha",
"description": "Jetpack Api Package",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/api/#readme",
"bugs": {
Expand All @@ -27,9 +27,5 @@
},
"scripts": {
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/babel-plugin-replace-textdomain",
"version": "1.0.30",
"version": "1.0.31-alpha",
"description": "A Babel plugin to replace the textdomain in gettext-style function calls.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/babel-plugin-replace-textdomain/#readme",
"bugs": {
Expand All @@ -24,10 +24,6 @@
"babel-plugin-tester": "11.0.4",
"jest": "29.4.3"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
},
"exports": {
".": "./src/index.js"
}
Expand Down
5 changes: 5 additions & 0 deletions projects/js-packages/base-styles/changelog/update-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


6 changes: 1 addition & 5 deletions projects/js-packages/base-styles/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-base-styles",
"version": "0.6.11",
"version": "0.6.12-alpha",
"description": "Jetpack components base styles",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/base-styles/#readme",
"bugs": {
Expand All @@ -21,9 +21,5 @@
},
"devDependencies": {
"@wordpress/base-styles": "4.35.0"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
}
}
5 changes: 5 additions & 0 deletions projects/js-packages/boost-score-api/changelog/update-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


6 changes: 1 addition & 5 deletions projects/js-packages/boost-score-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-boost-score-api",
"version": "0.1.14",
"version": "0.1.15-alpha",
"description": "A package to get the Jetpack Boost score of a site",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/boost-score-api/#readme",
"bugs": {
Expand Down Expand Up @@ -34,10 +34,6 @@
"webpack": "5.76.0",
"webpack-cli": "4.9.1"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
},
"exports": {
".": {
"jetpack:src": "./src/index.ts",
Expand Down
5 changes: 5 additions & 0 deletions projects/js-packages/components/changelog/update-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


6 changes: 1 addition & 5 deletions projects/js-packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-components",
"version": "0.44.1",
"version": "0.44.2-alpha",
"description": "Jetpack Components Package",
"author": "Automattic",
"license": "GPL-2.0-or-later",
Expand Down Expand Up @@ -82,9 +82,5 @@
"build": "pnpm run compile-ts",
"compile-ts": "tsc --pretty",
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
}
}
5 changes: 5 additions & 0 deletions projects/js-packages/config/changelog/update-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


6 changes: 1 addition & 5 deletions projects/js-packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-config",
"version": "0.1.22",
"version": "0.1.23-alpha",
"description": "Handles Jetpack global configuration shared across all packages",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/config/#readme",
"bugs": {
Expand All @@ -20,10 +20,6 @@
"jest": "29.4.3",
"jest-environment-jsdom": "29.4.3"
},
"engines": {
"node": "^18.13.0",
"yarn": "use pnpm instead - see docs/yarn-upgrade.md"
},
"exports": {
".": "./src/index.js"
},
Expand Down
5 changes: 5 additions & 0 deletions projects/js-packages/connection/changelog/update-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove "engines" from package.json. No change to the project itself; note the build formerly removed this before mirroring.


Loading

0 comments on commit 05264e5

Please sign in to comment.