Skip to content

chore: migrate to Yarn Berry (v4)#2626

Merged
aws-cdk-automation merged 4 commits intomainfrom
mrgrain/chore/yarn-berry-migration
Apr 10, 2026
Merged

chore: migrate to Yarn Berry (v4)#2626
aws-cdk-automation merged 4 commits intomainfrom
mrgrain/chore/yarn-berry-migration

Conversation

@mrgrain
Copy link
Copy Markdown
Contributor

@mrgrain mrgrain commented Apr 9, 2026

This migrates the jsii-compiler project from Yarn Classic (v1) to Yarn Berry (v4) with the node-modules linker, following the same approach used in jsii-rosetta#3622.

The old common.ts exported hardcoded helper functions (ACTIONS_CHECKOUT, ACTIONS_SETUP_NODE, YARN_INSTALL) that duplicated action versions and flags across all workflows. These have been replaced with a single workflowSetup() wrapper around projen's project.renderWorkflowSetup(), which automatically generates the correct corepack, setup-node, and install steps based on the package manager configuration. Checkout steps now use github.WorkflowSteps.checkout() where possible.

Jobs that require custom setup-node configuration (matrix node versions, custom registry URLs) still use inline steps, since the projen primitives don't support those options.

Additionally, a 3-day cooldown has been added to the dependency upgrade workflow as supply chain protection. This is enforced at two levels: ncu --cooldown=3 filters packages during discovery, and YARN_NPM_MINIMAL_AGE_GATE=4320m blocks them at yarn install time.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mrgrain mrgrain force-pushed the mrgrain/chore/yarn-berry-migration branch from 1620a86 to 3cd5077 Compare April 9, 2026 16:33
Migrate the package manager from Yarn Classic (v1) to Yarn Berry (v4)
with `node-modules` linker. This replaces the custom workflow helper
functions in `common.ts` with projen primitives
(`project.renderWorkflowSetup()` and `github.WorkflowSteps.checkout()`)
to keep CI configuration in sync with the package manager settings.

Key changes:
- Configure `YARN_BERRY` package manager with `node-modules` linker
- Replace `--frozen-lockfile` / `--check-files` with `--immutable`
- Replace `yarn version --no-git-tag-version --new-version` with Berry syntax
- Add `corepack enable` before `actions/setup-node` in all workflows
- Use projen primitives for checkout and workflow setup where possible
@mrgrain mrgrain force-pushed the mrgrain/chore/yarn-berry-migration branch from 3cd5077 to 387f6a5 Compare April 9, 2026 16:44
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit 2ee8a10 Apr 10, 2026
72 checks passed
@aws-cdk-automation aws-cdk-automation deleted the mrgrain/chore/yarn-berry-migration branch April 10, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants