-
Notifications
You must be signed in to change notification settings - Fork 141
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
add changesets and documentation #510
Conversation
|
ff1f946
to
895d8de
Compare
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 like this method of generating changelogs!
A question and a suggestion.
Q: What does the final changelog look like? It's at the repo root not per package right?
Suggestion: Can you update the PR template to also include instructions to generate a changeset?
.changeset/fifty-shoes-tap.md
Outdated
'@segment/analytics-next': patch | ||
--- | ||
|
||
Add changeset publish pipeline! |
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.
Does this actually need to be a patch update? There aren't any user-facing changes - just contributor changes right?
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.
Correct; technically it's just for demonstration purposes (to trigger the PR bot). I was going to delete the changeset after it was merged or after the PR is approved.
The final changelog is here, and gets automatically updated by the bot whenever a new PR is merged in: #511 (BTW, you can do This changelog can be edited before its merged in, if needed. If a changeset is edited in any PR, the PR will automatically update to reflect the latest changelog according to master.
It's per package (e.g. browser/changelog.md, node/changelog.md).
Sure, I can update the PR template to suggest that user's 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.
Love that we'll have a changelog now versus combing through release notes!
3ced0d3
to
cb898ac
Compare
cb898ac
to
a0b3a63
Compare
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.
amazing 💥
---> | ||
|
||
|
||
[] I've included a changeset (psst. run `yarn changeset`. Read about changesets [here](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md)). |
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.
🙌
@@ -33,5 +40,9 @@ | |||
"ts-jest": "^28.0.4", | |||
"ts-node": "^10.8.0", | |||
"typescript": "^4.6.4" | |||
}, | |||
"resolutions": { | |||
"@segment/analytics-next": "workspace:*", |
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 for my curiosity ... what does this do?
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 stole this pattern in another repo, but I don't remember which one https://github.com/facebook/jest/blob/main/package.json#L172
It should allow us to have fixed version numbers in our packages for the sake of publishing, but when developing locally or running tests, this resolutions key will always guarantee that both our dependencies and any transient dependencies will use the "current" workspace, rather than (accidentally?) using the version that is published (or maybe not-yet published) to npm. For example, if we have a not-yet-published @segment/utils
that is updated, and is a transient dependency of @segment/analytics-core
that is installed in @segment/analytics-node
. If I'm running tests on analytics-node and it has a fixed version of analytics-core, will it pick up on the local changes to utils when we run our tests or do a build? I could be wrong, but I don't think so.
changeset docs: https://github.com/changesets/changesets#documentation
TLDR: When developing a feature/bug/chore, run
yarn changeset
in your branch and commit the generated artifacts. When it’s time to release, merge the automatically created Version Package PR. This will kick off the release process, which results in the CI triggeringyarn release
to push tags to GitHub / publish packages to NPM.Why publishing pipelines are extra complicated in a monorepo…
- How do you ensure the package you're releasing is also released in sync with all of its dependencies? If analytics-browser and analytics-node depend on analytics-core, everytime analytics-core is updated, we need to ensure that analytics-browser and analytics-node are also updated.
- You can no longer easily look at the commit history and see what should package or packages that commit affects. Even knowing what file it touched is not enough — if I update a file in core, I need to release core as a potentially major release and also, all packages that depend on core might need to released as minor releases.
- Generating a changelog is also annoying, it means figuring out which recent commits affect a specific packages and collecting them (manually) -/ there could be a lot of noise.
- Tools like semantic release and changeset force the user to create some kind of metadata in their PRs so the system can easily map each merge to its relevant package or packages, and can calculate the appropriate bump.
Changeset upsides (over lerna with conventional commits)
Changesets release bot:
Version packages example: