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
chore: add changesets remove lerna #4294
base: main
Are you sure you want to change the base?
Conversation
Branch preview |
Tachometer resultsCurrently, no packages are changed by this PR... |
|
Lighthouse scores
What is this?Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on Transfer Size
Request Count
|
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.
A few things here, @Rajdeepc. I think my requests here all relate to what can actually be handled by Changesets and what might need to be updated to use Yarn.
], | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], |
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.
Do you need to look into the concept of "linked" packages for this monorepo?
I didn't look too deeply at it for Spectrum CSS because all of our packages are published and versioned individually, but your case may be different.
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 think for SWC use case adding fixed packages makes sense since we would want to bump the versions of all the packages on a release.
@@ -22,7 +22,8 @@ | |||
"build:ts:watch": "wireit", | |||
"build:types": "wireit", | |||
"build:watch": "wireit", | |||
"custom-element-json": "lerna exec --ignore \"{@spectrum-web-components/{base,bundle,clear-button,close-button,modal,iconset,shared,opacity-checkerboard,styles,custom-vars-viewer,eslint-plugin},stylelint-header,@swc-react/*,documentation,example-project-rollup,example-project-webpack,swc-templates,@types/swc}\" -- cem analyze --config ../../custom-elements-manifest.config.js --packagejson", | |||
"changeset-publish": "changeset publish --message \"chore: release new versions #publish\" --force-publish", |
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 think the commands in this script will be different for Changesets vs. what they had been for Lerna. I do not believe that --message
and --force-publish
are valid flags that can be passed to Changesets' publish
command. Here's a guide to what is available via the command line: https://github.com/changesets/changesets/blob/main/docs/command-line-options.md
@@ -22,7 +22,8 @@ | |||
"build:ts:watch": "wireit", | |||
"build:types": "wireit", | |||
"build:watch": "wireit", | |||
"custom-element-json": "lerna exec --ignore \"{@spectrum-web-components/{base,bundle,clear-button,close-button,modal,iconset,shared,opacity-checkerboard,styles,custom-vars-viewer,eslint-plugin},stylelint-header,@swc-react/*,documentation,example-project-rollup,example-project-webpack,swc-templates,@types/swc}\" -- cem analyze --config ../../custom-elements-manifest.config.js --packagejson", | |||
"changeset-publish": "changeset publish --message \"chore: release new versions #publish\" --force-publish", | |||
"custom-element-json": "changeset exec --ignore \"{@spectrum-web-components/{base,bundle,clear-button,close-button,modal,iconset,shared,opacity-checkerboard,styles,custom-vars-viewer,eslint-plugin},stylelint-header,@swc-react/*,documentation,example-project-rollup,example-project-webpack,swc-templates,@types/swc}\" -- cem analyze --config ../../custom-elements-manifest.config.js --packagejson", |
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.
Related to my previous comment about the valid command line options, I think this script will need to be refactored as it seems to be using some of Lerna's functionality, which will no longer work for Changesets.
Maybe the things here will need to be invoked via Yarn?
"postchangeset-publish": "yarn build:react && changeset publish from-package --message \"chore: release new React Wrapper versions #publish\"", | ||
"postcustom-element-json": "changeset exec --ignore \"{@spectrum-web-components/{base,bundle,clear-button,close-button,iconset,modal,shared,opacity-checkerboard,styles,custom-vars-viewer,reactive-controllers,vrt-compare,eslint-plugin},stylelint-header,@swc-react/*,documentation,example-project-rollup,example-project-webpack,swc-templates,@types/swc}\" -- node ../../tasks/check-cem.js", | ||
"postdocs:analyze": "node ./scripts/add-custom-properties.js --src=\"projects/documentation/custom-elements.json\"", | ||
"postinstall": "patch-package && yarn get-ready", | ||
"postlerna-publish": "yarn build:react && lerna publish from-package --message \"chore: release new Reach Wrapper versions #publish\"", | ||
"precustom-element-json": "lerna exec --ignore \"{@spectrum-web-components/{base,bundle,iconset,modal,shared,opacity-checkerboard,styles,custom-vars-viewer,reactive-controllers,eslint-plugin},stylelint-header,@swc-react/*,documentation,example-project-rollup,example-project-webpack,swc-templates,@types/swc}\" -- rm custom-elements.json ||:", | ||
"prechangeset-publish": "rimraf react && yarn get-ready && yarn custom-element-json && yarn build:confirm", | ||
"precustom-element-json": "changeset exec --ignore \"{@spectrum-web-components/{base,bundle,iconset,modal,shared,opacity-checkerboard,styles,custom-vars-viewer,reactive-controllers,eslint-plugin},stylelint-header,@swc-react/*,documentation,example-project-rollup,example-project-webpack,swc-templates,@types/swc}\" -- rm custom-elements.json ||:", |
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.
Mentioning this group of lines because, similar to my previous comments about valid CLI options, I think a few of these commands will fail and may need to be refactored to just use Yarn in place of Lerna.
Description
This removes Lerna and replaces it with Changesets for handling package versioning and publishing (releases).
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
It's important to know that moving to Changesets shifts the onus of version determination toward a more intentional choice for contributors. Some could argue that the onus was already on the contributor as we used Conventional Commit messages to provide Lerna a way to infer the severity of a version increase. Now, instead of relying on Conventional Commit messages, the contributor will be asked to provide changesets as part of their PR process.
The workflow for this will look something like:
yarn changeset
and is asked in the CLI to choose which package(s) should be part of the changeset.major
,minor
, orpatch
. Hittingenter
in the CLI without making a choice will skip options withpatch
being the final option.changelog.md
for the respective package(s). We're also using the@changesets/changelog-github
package to provide additional GitHub-related context (pull request number + link, contributor information), and this info will show in thechangelog.md
for the package(s), as well.Motivation and context
How has this been tested?
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.