Skip to content

Commit c4f52a7

Browse files
authored
feat(pacmak): support jsii-rosetta 5.7 (#4718)
Adds support for jsii-rosetta 5.7 to jsii-pacmak. This also changes the peer dependency to simply state the minimal required version. This will make it less urgent for us to actually release a new version of jsii-pacmak. Also includes a new script to fully automate the uprade. A future extension would be to run this script from a workflow. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
1 parent fcf9995 commit c4f52a7

File tree

17 files changed

+2419
-1196
lines changed

17 files changed

+2419
-1196
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
# Workflows pertaining to the main branch
22
name: Main
3-
43
on:
54
merge_group: {}
65
pull_request:
76
branches: [main, release]
87
push:
98
branches: [main, release]
10-
119
env:
1210
DOTNET_NOLOGO: true
1311
NODE_OPTIONS: --max-old-space-size=4096
14-
1512
# This workflows currently has the following jobs:
1613
# - build : Builds the source tree as-is
1714
# - test : Runs all unit tests against the build result
1815
# - create-release-package : Prepares a release package with the "real" version
1916
# - integ-test : Runs integration tests against the release package
20-
2117
jobs:
2218
build:
2319
name: Build
@@ -101,7 +97,6 @@ jobs:
10197
&& echo "Untracked files: ${untracked:-<none>}" \
10298
&& test -z "${untracked}"
10399
shell: bash
104-
105100
create-release-package:
106101
name: Create Release Package
107102
permissions:
@@ -182,7 +177,6 @@ jobs:
182177
with:
183178
name: release-package
184179
path: ${{ github.workspace }}/dist/
185-
186180
test:
187181
permissions:
188182
contents: none
@@ -291,9 +285,7 @@ jobs:
291285
java: '8'
292286
node: '18'
293287
os: ubuntu-latest
294-
295288
runs-on: ${{ matrix.os }}
296-
297289
steps:
298290
# Check out the code
299291
- name: Download Artifact
@@ -366,7 +358,6 @@ jobs:
366358
&& echo "Untracked files: ${untracked:-<none>}" \
367359
&& test -z "${untracked}"
368360
shell: bash
369-
370361
test-ok:
371362
name: Unit Tests
372363
runs-on: ubuntu-latest
@@ -379,7 +370,6 @@ jobs:
379370
- if: ${{ needs.test.result != 'success' }}
380371
name: Set status based on matrix build
381372
run: exit 1
382-
383373
pacmak-integration-test:
384374
runs-on: ubuntu-latest
385375
needs: create-release-package
@@ -391,6 +381,7 @@ jobs:
391381
- 5.4.x
392382
- 5.5.x
393383
- 5.6.x
384+
- 5.7.x
394385
steps:
395386
# Check out the code
396387
- name: Download Artifact
@@ -450,7 +441,6 @@ jobs:
450441
with:
451442
name: integtest_aws-cdk-lib
452443
path: ./node_modules/aws-cdk-lib/dist/
453-
454444
pacmak-integration-test-ok:
455445
name: Integration test (jsii-pacmak)
456446
runs-on: ubuntu-latest

.github/workflows/yarn-upgrade.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ jobs:
8282
# Upgrade all production dependencies (and other always major-pinned dependencies)
8383
lerna exec --parallel ncu -- --upgrade --target=minor \
8484
--filter='@types/diff,@types/fs-extra,${{ steps.production-dependencies.outputs.list }}' \
85-
--reject='typescript,@xmldom/xmldom,${{ steps.monorepo-packages.outputs.list }}'
85+
--reject='typescript,@xmldom/xmldom,jsii,jsii-rosetta,${{ steps.monorepo-packages.outputs.list }}'
8686
8787
# Upgrade all minor-pinned dependencies
8888
lerna exec --parallel ncu -- --upgrade --target=patch \
8989
--filter=typescript,@xmldom/xmldom
9090
9191
# Upgrade all other dependencies (devDependencies) to the latest
9292
lerna exec --parallel ncu -- --upgrade --target=latest \
93-
--reject='@types/diff,@types/inquirer,@types/node,@types/fs-extra,@types/yargs,@xmldom/xmldom,glob,typescript,typescript-json-schema,${{ steps.production-dependencies.outputs.list }},${{ steps.monorepo-packages.outputs.list }}'
93+
--reject='@types/diff,@types/inquirer,@types/node,@types/fs-extra,@types/yargs,@xmldom/xmldom,glob,typescript,typescript-json-schema,${{ steps.production-dependencies.outputs.list }},jsii,jsii-rosetta,${{ steps.monorepo-packages.outputs.list }}'
9494
9595
# This will ensure the current lockfile is up-to-date with the dependency specifications (necessary for "yarn update" to run)
9696
- name: Run "yarn install"

CONTRIBUTING.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,25 @@ whether or not it is supported and tested, and produces appropriate warnings in
249249
- [https://endoflife.date/nodejs](https://endoflife.date/nodejs)
250250
- [Adding support for node 22 PR](https://github.com/aws/jsii/pull/4489)
251251

252-
## Support for new `jsii-rosetta` versions
252+
## Support for new `jsii` & `jsii-rosetta` versions
253253

254254
When a new minor version of `jsii-rosetta` (modern) is released, we need to update the `jsii-pacmak` package.
255255
`jsii-pacmak` uses `jsii-rosetta` to transpile examples in documentation.
256256
Because every package can use its own version of jsii, TypeScript and jsii-rosetta, it is declared as a peer dependency.
257257
To ensure compatibility, we also have integration tests.
258258

259-
### Adding a new `jsii-rosetta` version
259+
### Adding a new `jsii` & `jsii-rosetta` version
260260

261-
1. Add the new version to the `jsii-rosetta` peer dependency in [package.json](./packages/jsii-pacmak/package.json)
262-
2. Add the new version to the `pacmak-integration-test` matrix in the main build workflow in [main.yml](.github/workflows/main.yml)
263-
3. Remove any versions for which support has ended (EOS) from both locations
261+
Run the following command. It takes care of the required changes.
262+
The script needs `jq` and `yq` installed to run.
263+
264+
```console
265+
yarn upgrade:jsii
266+
```
267+
268+
Then you need to run the build and update snapshots locally:
269+
270+
```console
271+
yarn build
272+
yarn test:update
273+
```

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"test": "lerna run test --concurrency=1 --stream && yarn compliance",
1313
"test:integ": "lerna run test:integ --stream",
1414
"test:update": "lerna run test:update --concurrency=1 --stream",
15-
"compliance": "(cd tools/jsii-compliance && yarn report)"
15+
"compliance": "(cd tools/jsii-compliance && yarn report)",
16+
"upgrade:jsii": "bash scripts/upgrade-jsii.sh"
1617
},
1718
"devDependencies": {
1819
"@jest/types": "^29.6.3",
@@ -32,6 +33,7 @@
3233
"jest-config": "^28.1.3",
3334
"jest-expect-message": "^1.1.3",
3435
"lerna": "^8.1.9",
36+
"npm-check-updates": "^9.2.4",
3537
"prettier": "^3.3.3",
3638
"standard-version": "^9.5.0",
3739
"ts-node": "^10.9.2",

packages/@scope/jsii-calc-base-of-base/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"test:update": "npm run build && UPDATE_DIFF=1 npm run test"
3131
},
3232
"devDependencies": {
33-
"jsii": "^5.6.0",
33+
"jsii": "^5.7.0",
3434
"jsii-build-tools": "^0.0.0",
35-
"jsii-rosetta": "^5.6.0"
35+
"jsii-rosetta": "^5.7.0"
3636
},
3737
"jsii": {
3838
"outdir": "dist",

packages/@scope/jsii-calc-base-of-base/test/assembly.jsii

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"description": "An example transitive dependency for jsii-calc.",
1111
"homepage": "https://github.com/aws/jsii",
12-
"jsiiVersion": "5.6.0",
12+
"jsiiVersion": "5.7.0",
1313
"license": "Apache-2.0",
1414
"metadata": {
1515
"jsii": {
@@ -166,5 +166,5 @@
166166
}
167167
},
168168
"version": "2.1.1",
169-
"fingerprint": "itbDtJ87SbwgkYovbu9lFbJPZeKxLga0bRW0aLuyEME="
169+
"fingerprint": "PwcsgWKaFz//+WnNgqPa2iYQrz0wG2NLVTTmYtlAe3Q="
170170
}

packages/@scope/jsii-calc-base/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
"@scope/jsii-calc-base-of-base": "^2.1.1"
3636
},
3737
"devDependencies": {
38-
"jsii": "^5.6.0",
38+
"jsii": "^5.7.0",
3939
"jsii-build-tools": "^0.0.0",
40-
"jsii-rosetta": "^5.6.0"
40+
"jsii-rosetta": "^5.7.0"
4141
},
4242
"jsii": {
4343
"metadata": {

packages/@scope/jsii-calc-base/test/assembly.jsii

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"description": "An example direct dependency for jsii-calc.",
4141
"homepage": "https://github.com/aws/jsii",
42-
"jsiiVersion": "5.6.0",
42+
"jsiiVersion": "5.7.0",
4343
"license": "Apache-2.0",
4444
"metadata": {
4545
"jsii": {
@@ -207,5 +207,5 @@
207207
}
208208
},
209209
"version": "0.0.0",
210-
"fingerprint": "YfsMQPprGozJvkv3tDvqfaD0n6nemL/7qgQLBVfozZk="
210+
"fingerprint": "owD5dvNwZsCheQcXuO55DpsBC6WVKRk723nURQOT+Dk="
211211
}

packages/@scope/jsii-calc-lib/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
"@scope/jsii-calc-base-of-base": "^2.1.1"
4040
},
4141
"devDependencies": {
42-
"jsii": "^5.6.0",
42+
"jsii": "^5.7.0",
4343
"jsii-build-tools": "^0.0.0",
44-
"jsii-rosetta": "^5.6.0"
44+
"jsii-rosetta": "^5.7.0"
4545
},
4646
"jsii": {
4747
"outdir": "dist",

packages/@scope/jsii-calc-lib/test/assembly.jsii

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"stability": "deprecated"
7272
},
7373
"homepage": "https://github.com/aws/jsii",
74-
"jsiiVersion": "5.6.0",
74+
"jsiiVersion": "5.7.0",
7575
"license": "Apache-2.0",
7676
"metadata": {
7777
"jsii": {
@@ -1107,5 +1107,5 @@
11071107
}
11081108
},
11091109
"version": "0.0.0",
1110-
"fingerprint": "/ufqnDvVVWtV63VSBrPx4dm5v42FAKQp4aDxKl1/f6c="
1110+
"fingerprint": "YbFe4GUOj1bMi4Nfb//EVD6W94vthn7qqgjK99omHZk="
11111111
}

packages/jsii-calc/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
"@scope/jsii-calc-lib": "^0.0.0"
5252
},
5353
"devDependencies": {
54-
"jsii": "^5.6.0",
54+
"jsii": "^5.7.0",
5555
"jsii-build-tools": "^0.0.0",
56-
"jsii-rosetta": "^5.6.0"
56+
"jsii-rosetta": "^5.7.0"
5757
},
5858
"jsii": {
5959
"outdir": "dist",

packages/jsii-calc/test/assembly.jsii

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"stability": "stable"
147147
},
148148
"homepage": "https://github.com/aws/jsii",
149-
"jsiiVersion": "5.6.0",
149+
"jsiiVersion": "5.7.0",
150150
"keywords": [
151151
"aws",
152152
"jsii",
@@ -18996,5 +18996,5 @@
1899618996
}
1899718997
},
1899818998
"version": "3.20.120",
18999-
"fingerprint": "IBXWPJXjzXcQygsQrgkTTCthomDag1ZWYMQ5Sz5X70E="
18999+
"fingerprint": "0tG7jS936WALug3+Z3mkb+Zts9YiQ1Nqy+xGmWhCzls="
1900019000
}

packages/jsii-diff/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@types/fs-extra": "^9.0.13",
4545
"@types/tar-fs": "^2.0.4",
4646
"jest-expect-message": "^1.1.3",
47-
"jsii": "^5.6.0",
47+
"jsii": "^5.7.0",
4848
"jsii-build-tools": "^0.0.0"
4949
}
5050
}

packages/jsii-pacmak/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@
5252
},
5353
"devDependencies": {
5454
"@jsii/dotnet-runtime": "^0.0.0",
55-
"@jsii/java-runtime": "^0.0.0",
5655
"@jsii/go-runtime": "^0.0.0",
56+
"@jsii/java-runtime": "^0.0.0",
5757
"@scope/jsii-calc-lib": "^0.0.0",
5858
"@types/clone": "^2.1.4",
59-
"@types/diff": "^5.2.3",
6059
"@types/commonmark": "^0.27.9",
60+
"@types/diff": "^5.2.3",
6161
"@types/fs-extra": "^9.0.13",
6262
"@types/semver": "^7.5.8",
6363
"diff": "^5.2.0",
64-
"jsii": "^5.6.0",
64+
"jsii": "^5.7.0",
6565
"jsii-build-tools": "^0.0.0",
6666
"jsii-calc": "^3.20.120",
67-
"jsii-rosetta": "~5.6.0",
67+
"jsii-rosetta": "~5.7.0",
6868
"pyright": "^1.1.389"
6969
},
7070
"peerDependencies": {
71-
"jsii-rosetta": "~5.4.0 || ~5.5.0 || ~5.6.0"
71+
"jsii-rosetta": ">=5.4.0"
7272
},
7373
"keywords": [
7474
"jsii",

packages/jsii-reflect/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"devDependencies": {
4545
"@scope/jsii-calc-lib": "^0.0.0",
4646
"@types/fs-extra": "^9.0.13",
47-
"jsii": "^5.6.0",
47+
"jsii": "^5.7.0",
4848
"jsii-build-tools": "^0.0.0",
4949
"jsii-calc": "^3.20.120"
5050
}

scripts/upgrade-jsii.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
#------------------------------------------------------------------------
3+
# updates all package.json files to the latest jsii
4+
# and jsii-rosetta versions
5+
# updates the jsii-pacmak peer dep to the latest supported version
6+
# updates the build matrix in the .github/workflows/main.yml file
7+
#------------------------------------------------------------------------
8+
set -euo pipefail
9+
scriptdir=$(cd $(dirname $0) && pwd)
10+
11+
# go to repo root
12+
cd ${scriptdir}/..
13+
14+
# load version data
15+
tomorrow=$(date -v+1d +%s)
16+
supported=$(curl -sS https://raw.githubusercontent.com/aws/jsii-rosetta/refs/heads/main/releases.json |\
17+
jq "(.maintenance | to_entries | sort_by(.value) | .[] | select(.value | .[0:19] +\"Z\" | fromdateiso8601 >= $tomorrow) | .key), .current")
18+
latest=$(echo $supported | jq -sr '.[-1]')
19+
oldest=$(echo $supported | jq -sr '.[0]')
20+
21+
echo "Latest supported jsii & jsii-rosetta version: $latest"
22+
echo "Oldest supported jsii & jsii-rosetta version: $oldest"
23+
echo ""
24+
25+
# Set jsii-pacmak minimal dependency
26+
echo "Updating jsii-pacmak peerDependency to >=$oldest.0"
27+
echo ""
28+
npm --prefix packages/jsii-pacmak pkg set peerDependencies.jsii-rosetta=">=$oldest.0"
29+
30+
# GitHub Actions
31+
matrix=$(echo $supported | jq -rs '["latest"] + map(. + ".x") | @csv')
32+
echo "Updating GitHub Actions workflow to run jsii-pacmak integration tests for $matrix"
33+
echo ""
34+
yq -i ".jobs.pacmak-integration-test.strategy.matrix.rosetta = [$matrix]" .github/workflows/main.yml
35+
36+
# update jsii and jsii-rosetta versions
37+
echo "Upgrading jsii & jsii-rosetta to latest"
38+
echo ""
39+
npx lerna exec --parallel ncu -- --upgrade --target=latest --dep=prod,dev --filter=jsii,jsii-rosetta

0 commit comments

Comments
 (0)