-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from yarn
to pnpm
and drop lerna
in the process
#1931
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 8f7de67 The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- &restore_yarn_cache_node_18 | ||
keys: | ||
- v1-yarn-cache-node_18-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
- v1-yarn-cache-node_18-{{ .Branch }} | ||
- v1-yarn-cache-node_18 | ||
|
||
- &save_yarn_cache_node_18 | ||
key: v1-yarn-cache-node_18-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache/yarn | ||
|
||
|
||
- &restore_yarn_cache_node_20 | ||
keys: | ||
- v1-yarn-cache-node_20-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
- v1-yarn-cache-node_20-{{ .Branch }} | ||
- v1-yarn-cache-node_20 | ||
|
||
- &save_yarn_cache_node_20 | ||
key: v1-yarn-cache-node_20-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache/yarn | ||
|
||
- &restore_yarn_cache_node_22 | ||
keys: | ||
- v1-yarn-cache-node_22-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
- v1-yarn-cache-node_22-{{ .Branch }} | ||
- v1-yarn-cache-node_22 | ||
|
||
- &save_yarn_cache_node_22 | ||
key: v1-yarn-cache-node_22-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache/yarn | ||
|
||
- &yarn_install | ||
name: Installing | ||
command: yarn --frozen-lockfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify large parts of this:
- We don't need a cache per Node.js version. Package managers don't install differently based on Node.js versions
- We can migrate this into a command. That way it's native to CircleCI and validated by its language server also locally
@@ -56,72 +18,117 @@ executors: | |||
- image: cimg/node:22.14.0 | |||
working_directory: *working_directory | |||
|
|||
commands: | |||
pnpm_install: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the command to replace everything above.
- run: *yarn_install | ||
- save_cache: *save_yarn_cache_node_18 | ||
- pnpm_install | ||
- run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest not to build as a post install. It's not needed and frustrating. If we don't do that we must do it here.
- name: Read .nvmrc | ||
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | ||
id: nvm | ||
|
||
- name: Setup Node (uses version in .nvmrc) | ||
uses: actions/setup-node@v2 | ||
- name: Install pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
node-version: '${{ steps.nvm.outputs.NVMRC }}' | ||
run_install: false | ||
|
||
- name: Get yarn cache | ||
id: yarn-cache | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- uses: actions/cache@v4 | ||
- name: Setup Node (uses version in .nvmrc) | ||
uses: actions/setup-node@v4 | ||
with: | ||
path: ${{ steps.yarn-cache.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Large parts here can be offloaded to the action-setup.
@@ -0,0 +1 @@ | |||
pnpm commitlint --edit $1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Husky has to be updated in the process. It has now files here instead of a global config file.
"commit": "git-cz", | ||
"build": "lerna run build --no-private", | ||
"build": "pnpm --recursive run build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpm has this which allows us to drop lerna.
"packages/*" | ||
], | ||
"dependencies": { | ||
"resolutions": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just formatting.
"chalk": "3.0.0" | ||
}, | ||
"packageManager": "[email protected]", | ||
"devDependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semi important: root package.json files should not contain deps but devDeps. We use things in there for development.
@@ -0,0 +1,11 @@ | |||
#!/usr/bin/env bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easier to maintain than an inline run script.
@@ -29,6 +29,7 @@ | |||
"target": "esnext", | |||
"allowJs": false, | |||
"baseUrl": ".", | |||
"skipLibCheck": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed at the moment for one package. I don't see a major downside. I plan to enable this later again.
c17fb85
to
4269cf9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1931 +/- ##
==========================================
+ Coverage 94.65% 97.76% +3.10%
==========================================
Files 148 147 -1
Lines 5105 4779 -326
Branches 1380 1277 -103
==========================================
- Hits 4832 4672 -160
+ Misses 270 104 -166
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR migrates the project from yarn to pnpm while also dropping lerna in favor of a new dependency management strategy. Key changes include updating changesets, CircleCI configurations, GitHub release workflows, and contributing documentation to reflect the migration.
Reviewed Changes
File | Description |
---|---|
.changeset/silver-tips-serve.md | Adds a changeset specifying major version bumps for several packages. |
.circleci/config.yml | Replaces yarn commands and cache logic with pnpm alternatives in CI pipelines. |
.github/workflows/release.yml | Updates the release workflow to use pnpm for dependency installation, building, and publishing. |
CONTRIBUTING.md | Revises installation and command instructions to use pnpm, though still retains a reference to lerna. |
husky.config.js | Removes the husky configuration, potentially impacting commit hooks management. |
Copilot reviewed 97 out of 97 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
husky.config.js:1
- The husky.config.js file has been removed; if commit hooks are still needed, please ensure they are configured elsewhere and update the documentation accordingly.
module.exports = {
Co-authored-by: Copilot <[email protected]>
Summary
This migrates from
yarn
topnpm
which we adopted across repositories. It's speedier for installs are more strict about dependency resolution.At the same time we can drop
lerna
in the process and replace it withmanypkg
which enforces dependency rules across the repository.