Move versioned prerelease changesets to `.changeset/pre/` folder by bluwy · Pull Request #2190 · changesets/changesets · GitHub
Skip to content

Move versioned prerelease changesets to .changeset/pre/ folder - #2190

Merged
bluwy merged 11 commits into
mainfrom
pre-folder
Jul 30, 2026
Merged

bluwy merged 11 commits into
mainfrom
pre-folder

Conversation

@bluwy

@bluwy bluwy commented Jul 27, 2026

Copy link
Copy Markdown
Member

This is just an experiment/idea I had. No need to push this for v3 if we don't feel like it.


From added changeset:

Move versioned prerelease changesets to .changeset/pre/ folder instead of accumulating in the root and tracking the versioned changeset ids in the .changeset/pre.json file. Existing pre.json will auto-migrate to this new structure on the next run of changeset version or when calling changeset status.

This change allows easier management of versioned prerelease changesets (for the final stable release) and current queued changesets (for the next prerelease). Changesets in .changeset/pre/ can be edited or deleted depending if it's still relevant for the final stable release of a package. There's no need to synchronize the changeset ids in pre.json if certain changesets are deleted.


I think this should close #1688. While not directly addressing its issue, this PR should make it easy to resolve the problem by going through all the versioned prerelease changesets and only keep the ones that matter. If they don't care about a final changelog, they can simply delete all the changesets in .changeset/pre/

@changeset-bot

changeset-bot Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Comment thread packages/git/src/index.ts
[
"log",
"--diff-filter=A",
"--follow",

@bluwy bluwy Jul 27, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has its own changeset as it affects outside of this PR. If the changeset file was renamed, previously we would return the commit that renamed it, --follow fixes this by checking the parent for possible renames and then looking further for the actual commit that added it. While this is technically more work done for git, I noticed for about 93 changesets, it only slows down from 300ms to 350ms, so not horribly slow, but it still depends on the state of the repo and parent commit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add a test case for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@codecov

codecov Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.70588% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.09%. Comparing base (1b9687f) to head (eb25057).

Files with missing lines Patch % Lines
packages/pre/src/index.ts 8.33% 9 Missing and 2 partials ⚠️
packages/apply-release-plan/src/index.ts 77.77% 4 Missing ⚠️
packages/read/src/index.ts 85.71% 2 Missing ⚠️
packages/release-utils/src/readChangesetState.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2190      +/-   ##
==========================================
- Coverage   84.49%   84.09%   -0.40%     
==========================================
  Files          80       80              
  Lines        3140     3157      +17     
  Branches      885      888       +3     
==========================================
+ Hits         2653     2655       +2     
- Misses        432      445      +13     
- Partials       55       57       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@beeequeue

Copy link
Copy Markdown
Member

i really like this idea!

i have a growing concern that running these kinds of migrations when needed can be surprising to users, and having a migrate command that does it all in one go would be more fitting

looking at the current migration guide, there are a few things we could put in it (e.g. prettier: true -> format: "prettier")

@bluwy

bluwy commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

Yeah a migrate command would be nice to have 👍

@Andarist Andarist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea behind this - I had very similar thoughts about this when cleaning up those old changesets in the other PR

Comment thread packages/apply-release-plan/src/index.ts Outdated
return changesets.filter(
(changeset) => !usedChangesetIds.has(changeset.id),
);
return changesets.filter((changeset) => !changeset.id.startsWith("pre/"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotta make sure this pre/ prefix gets normalized on Windows

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah right now readChangesets will ensure this starts with pre/ as it reads the files in the directory. I think it's easier to handle the a forward-slash always as the changeset "id".

Comment thread packages/git/src/index.ts
[
"log",
"--diff-filter=A",
"--follow",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add a test case for this?

@beeequeue

Copy link
Copy Markdown
Member

while this change helps with #1688 i would prefer to close the issue by fixing chunking so the requests don't fail.

@bluwy

bluwy commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

We already chunk right? With the maxBatchSize config for dataloader before

@beeequeue

Copy link
Copy Markdown
Member

@bluwy
bluwy added this pull request to the merge queue Jul 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 30, 2026
@bluwy
bluwy added this pull request to the merge queue Jul 30, 2026
Merged via the queue into main with commit 96b65ee Jul 30, 2026
13 of 15 checks passed
@bluwy
bluwy deleted the pre-folder branch July 30, 2026 06:15
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.

Exiting pre mode fails with 400+ changesets

3 participants