Skip to content

Commit 0881845

Browse files
committed
docs(scripts): document how to perform a codegen sync
1 parent 2981565 commit 0881845

3 files changed

Lines changed: 198 additions & 30 deletions

File tree

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Codegen Version Bump
2+
3+
This instruction set is for staging a bump to the maven version of `smithy-typescript-codegen` and
4+
`smithy-aws-typescript-codegen`.
5+
6+
This spans two repositories and two PRs. The smithy-typescript PR merges first,
7+
then its merge commit hash is filled into the aws-sdk-js-v3 PR.
8+
9+
Let `$VERSION` be the new version (e.g. `0.49.1`), `$DATE` be the release date
10+
(e.g. `2026-04-30`), and `$PREV_COMMIT` be the current value of `SMITHY_TS_COMMIT`
11+
in `scripts/generate-clients/config.js`.
12+
13+
The maven version of smithy-typescript-codegen and smithy-aws-typescript-codegen must be in lockstep.
14+
15+
If the current version is 0.49.1, then the next version should be 0.50.0. In cases where the only commits for the
16+
changelog are fixes, the version bump may be in the patch range, e.g. 0.49.2.
17+
18+
---
19+
20+
## Part 1: smithy-typescript
21+
22+
### Files to update
23+
24+
1. **`build.gradle.kts`** — set `version` in `allprojects`:
25+
26+
```kts
27+
version = "$VERSION"
28+
```
29+
30+
2. **`README.md`** — update both `smithy-typescript-codegen:` version references.
31+
32+
3. **`CHANGELOG.md`** — add entry at the top:
33+
34+
```md
35+
## $VERSION ($DATE)
36+
37+
### Features
38+
39+
- Description ([#PR](https://github.com/smithy-lang/smithy-typescript/pull/PR))
40+
41+
### Bug Fixes
42+
43+
- Description ([#PR](https://github.com/smithy-lang/smithy-typescript/pull/PR))
44+
```
45+
46+
The filter for relevant PRs to include is the commit log between the prior bump in version and
47+
the latest `main` branch of smithy-ts, but scoped to the following
48+
folder: https://github.com/smithy-lang/smithy-typescript/commits/main/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen
49+
50+
The descriptions should be subjectless past-tense, like "Updated widgets to return sprockets.",
51+
and don't always match with the PR commit message. Only Java codegen commits are relevant.
52+
53+
Follow the existing file structure and conventions in CHANGELOG.md in smithy-typescript.
54+
55+
If `main` in smithy-typescript contains unpublished items in the `.changeset` folder, then
56+
it is not in a good state for staging. Halt this process and restart after the changeset queue has been cleared
57+
via NPM publishing.
58+
59+
### Commit & PR
60+
61+
Message:
62+
63+
```
64+
chore(codegen): smithy-typescript-codegen $VERSION
65+
```
66+
67+
Set this PR aside for review. The resulting merge commit hash (`$COMMIT`) will be used later, but proceed
68+
for now directly to opening the aws-sdk-js-v3 draft PR accompaniment.
69+
70+
---
71+
72+
## Part 2: aws-sdk-js-v3
73+
74+
Open this PR as a **draft** initially, using `"TBD"` for the
75+
commit hash. This ensures CI fails until the real hash is filled in (the config.js validation
76+
throws if the hash is not 40 characters).
77+
78+
### Files to update
79+
80+
1. **`codegen/build.gradle.kts`** — set `version` in `allprojects`:
81+
82+
```kts
83+
version = "$VERSION"
84+
```
85+
86+
2. **`codegen/smithy-aws-typescript-codegen/build.gradle.kts`** — update dependency:
87+
88+
```kts
89+
api("software.amazon.smithy.typescript:smithy-typescript-codegen:$VERSION")
90+
```
91+
92+
3. **`scripts/generate-clients/config.js`** — update commit hash and comparison link:
93+
94+
```js
95+
// https://github.com/smithy-lang/smithy-typescript/compare/$PREV_COMMIT...$COMMIT
96+
SMITHY_TS_COMMIT: "$COMMIT",
97+
```
98+
99+
Use `"TBD"` until the smithy-typescript PR merges.
100+
101+
4. **`codegen/CHANGELOG.md`** — add entry at the top:
102+
103+
```md
104+
## $VERSION ($DATE)
105+
106+
### Chores
107+
108+
- Upgraded to smithy-typescript $VERSION ([Release Notes](https://github.com/smithy-lang/smithy-typescript/blob/main/CHANGELOG.md#$ANCHOR))
109+
```
110+
111+
Where `$ANCHOR` is the version with dots removed, e.g. `0491-2026-04-30`.
112+
113+
Use the same changelog format as the changelog in smithy-ts. But, always include a mention that the upstream
114+
is being updated to `$VERSION`. The commits worth mentioning will appear
115+
in https://github.com/aws/aws-sdk-js-v3/commits/main/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen.
116+
117+
As with smithy-ts, commits made that are no interest to applications consuming the code generation library may be
118+
omitted from the changelogs, as the full revision history is readily available.
119+
120+
### Commit & PR
121+
122+
Message:
123+
124+
```
125+
chore(codegen): smithy-aws-typescript-codegen $VERSION
126+
```
127+
128+
Once the smithy-typescript PR merges:
129+
130+
1. Replace the placeholder with the real `$COMMIT` hash.
131+
2. Update the comparison link.
132+
3. Using that commit, run through all of [CODEGEN_SYNC](./CODEGEN_SYNC.md), except the commit message and opening a PR,
133+
as those steps roll into the same tasks here.
134+
4. Mark the PR as ready for review. CI will run on the PR at that point.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Instructions for performing a code generation sync
2+
3+
## Prerequisite
4+
5+
- Adjacent checkout of [smithy-typescript](https://github.com/smithy-lang/smithy-typescript).
6+
- ./aws-sdk-js-v3 # this repo
7+
- ./smithy-typescript # codegen upstream
8+
9+
## Steps
10+
11+
### Determine a target commit
12+
13+
The current commit pointer in `scripts/generate-clients/config.js` indicates what version
14+
of smithy-ts to use to generate the clients in this repository.
15+
16+
When performing a bump, we typically use the latest commit in the `main` branch of smithy-ts.
17+
If the latest commit has a message of "Version NPM packages", this indicates that all the JS runtime changes
18+
that had been enqueued with changesets have been published to NPM. This is always a good candidate for sync.
19+
20+
If the latest commit is not a changesets release, it might be a Java codegen-only change that doesn't need NPM
21+
version bumps. But if the latest change is to JavaScript code, then it means it is unpublished, and likely not
22+
the appropriate target for sync.
23+
24+
### Check `smithy-typescript` out to main
25+
26+
If the adjacent smithy-ts checkout is not on `main`, a PR is likely in progress. Save your work on that branch with a
27+
commit, and then check out latest `main` branch for smithy-ts. The code generation process will use the target commit,
28+
but return to `main` afterward.
29+
30+
### Check `aws-sdk-js-v3` out to `<github_username>/chore/codegen`
31+
32+
This branch should be deleted prior to checkout (i.e. a fresh branch from jsv3 `main`).
33+
34+
### Update config.js smithy-ts git pointer
35+
36+
Update SMITHY_TS_COMMIT to the target commit determined earlier.
37+
Above it, update the comment that shows the diff in smithy-ts from the previous target commit.
38+
39+
### Run codegen
40+
41+
Run `yarn generate-clients -x`. Afterward, if this has succeeded, the git state will contain uncommitted
42+
code generation updates.
43+
44+
This process includes updating all smithy package versions to the one from the target commit, and running
45+
`yarn` afterward.
46+
47+
### Commit codegen diff
48+
49+
Commit the changes, allowing commit hooks to perform formatting if needed. The commit message should be:
50+
51+
```
52+
chore(codegen): sync for <...>
53+
```
54+
55+
In the placeholder, topically describe the changes in the smithy-ts diff from the comment in config.js.
56+
For example, `chore(codegen): sync for adaptive retry fixes`.
57+
58+
### Open a PR
59+
60+
Open a PR to aws/aws-sdk-js-v3 using the commit as the PR title (default behavior).
61+
For the PR body, the standard template may be ignored in favor of simply posting the link from
62+
config.js that shows the commit diff between the previous and current smithy-ts target commit hashes.
63+
64+
If available, we recommend using the GitHub CLI to open the PR.

scripts/generate-clients/README.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)