Skip to content
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 #712

Merged
merged 10 commits into from
Aug 28, 2023
Merged

Add changesets #712

merged 10 commits into from
Aug 28, 2023

Conversation

webpro
Copy link
Contributor

@webpro webpro commented Aug 2, 2023

Follow-up to #612 and targeting that branch.

This PR introduces Changesets to handle our changelog and package publishing needs. Please read some of the docs to get an idea of what it is all about. Here's a an article with a quick rundown: Ditching manual releases with Changesets.

Also see #612 + comments for additional context. This PR contains:

  • Changelog CLI that writes .changesets/*.md files (the equivalent of common/changes/**/*.json in Rush projects).
  • An initial GitHub Action that creates a pull request with all changes in the main branch.
    • The PR will be updated until we're ready to release.
    • When we're ready, we merge this PR and it will publish the (non-private) packages to npm.
    • We need to install GITHUB_TOKEN and NPM_TOKEN.
    • This PR includes the first workflow (see below); probably good to start with the third.
  • A (temporary) script to convert the Rush JSON files to the Changesets Markdown format if/when necessary.

Three workflows:

  1. Use GitHub Action w/ available automation (versioning + publishing), in this PR.
  2. Use this GitHub Action only for versioning. Publishing manually (using Changesets CLI).
  3. Omit the Action, and use the Changesets CLI to do both steps manually.

When we open new pull requests we can add a changeset (the equivalent of rush change):

pnpm changeset

After merging this PR we can install the Changesets bot which comments on PRs that don't contain a changelog (the equivalent of rush change --verify). So with normal settings developers will be notified in the PR itself + email.

Extra scripts

Convert Rush changelog (common/changes/**/*.json) to Changesets (.changesets/*.md) format:

npx tsx packages/tools/scripts/convert-changelog.ts

Generate packages.json in root:

npx tsx packages/tools/scripts/generate-packages-json.ts

Publish one, set, or all packages (from root):

pnpm publish-set

Notes

  • Both Rush and Changesets aim to publish everything at once, and publishing a single or subset of packages is not (yet?) possible in a fully automated fashion. We can experiment with using the ignore option to exclude "everything else" from being versioned and published.
  • Changesets updates CHANGELOG.md in each package. We can remove the CHANGELOG.json files as we go.

Preview

To get an idea of what publishing looks like, here's a screenshot with the current settings:

Screenshot 2023-08-03 at 2 21 36 PM

The pnpm publish-set is a script that basically adjusts the ignore: [] config of Changesets in case we don't want to publish everything. Run this script which will populate the config: [] with everything we won't publish (yes it's a hack) and runs the regular Changesets version + publish flow afterwards:

Screenshot 2023-08-10 at 3 55 41 PM

@vercel
Copy link

vercel bot commented Aug 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
alpha-docs ⬜️ Ignored (Inspect) Visit Preview Aug 28, 2023 2:05pm
docs-storybook ⬜️ Ignored (Inspect) Visit Preview Aug 28, 2023 2:05pm
immutable-records ⬜️ Ignored (Inspect) Visit Preview Aug 28, 2023 2:05pm
react-ui ⬜️ Ignored (Inspect) Visit Preview Aug 28, 2023 2:05pm
tools ⬜️ Ignored (Inspect) Visit Preview Aug 28, 2023 2:05pm

@webpro webpro changed the base branch from main to chore/migrate-away-from-rush August 2, 2023 07:00
@webpro webpro force-pushed the chore/add-changesets branch 2 times, most recently from dbb17ac to 3effe2b Compare August 3, 2023 07:53
@webpro webpro force-pushed the chore/migrate-away-from-rush branch 5 times, most recently from 1ed5fa2 to b91e8aa Compare August 10, 2023 09:27
@webpro webpro mentioned this pull request Aug 24, 2023
6 tasks
Base automatically changed from chore/migrate-away-from-rush to main August 28, 2023 14:01
@webpro webpro marked this pull request as ready for review August 28, 2023 14:01
@webpro webpro requested a review from alber70g as a code owner August 28, 2023 14:01
@webpro webpro merged commit ed09cbb into main Aug 28, 2023
8 of 9 checks passed
@webpro webpro deleted the chore/add-changesets branch August 28, 2023 14:26
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.

1 participant