Skip to content

feat(types): add Packages to replace types from @manypkg/get-packages#1872

Merged
Andarist merged 5 commits intochangesets:nextfrom
marcalexiei:changeset-packages-type
Mar 25, 2026
Merged

feat(types): add Packages to replace types from @manypkg/get-packages#1872
Andarist merged 5 commits intochangesets:nextfrom
marcalexiei:changeset-packages-type

Conversation

@marcalexiei
Copy link
Copy Markdown
Contributor

This PR introduces ChangesetsPackages types to reduce the number of package relying on @manypkg/get-packages

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 4, 2026

🦋 Changeset detected

Latest commit: 40f95d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@changesets/types Minor
@changesets/apply-release-plan Patch
@changesets/assemble-release-plan Patch
@changesets/changelog-git Patch
@changesets/changelog-github Patch
@changesets/cli Patch
@changesets/config Patch
@changesets/get-dependents-graph Patch
@changesets/get-release-plan Patch
@changesets/git Patch
@changesets/parse Patch
@changesets/pre Patch
@changesets/read Patch
@changesets/release-utils Patch
@changesets/should-skip-package Patch
@changesets/write Patch

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

Comment thread packages/types/src/index.ts Outdated
changesets: string[];
};

export interface ChangesetsPackage {
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.

given we are in the scope of Changesets already, I'd prefer to remove the Changesets prefix from those types

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I prefixed the name with Changeset to avoid clashes with the ones coming from manypkg.
I can rename them now.

const packagesByName: { [key: string]: Package } = {
[packages.root.packageJson.name]: packages.root,
const packagesByName: { [key: string]: ChangesetsPackage } = {
[packages.root!.packageJson.name]: packages.root!,
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.

isn't root required in the new type?

Copy link
Copy Markdown
Contributor Author

@marcalexiei marcalexiei Mar 10, 2026

Choose a reason for hiding this comment

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

Leftover, the not null assertion shouldn't be needed.

Maybe in the future I would consider turning on the no-non-null-assertion rule that reports similar situations.

EDIT: Maybe in the future I would consider turning on the no-unnecessary-type-assertion rule that reports similar situations.

Copy link
Copy Markdown

@beeequeue beeequeue Mar 12, 2026

Choose a reason for hiding this comment

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


export default function getDependencyGraph(
packages: Packages,
packages: Pick<ChangesetsPackages, "packages" | "root">,
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.

q: why do we use Pick here now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I used a Pick since this package only accesses those two properties, so I thought it would be clearer to make that explicit.

await git.commit("first commit", tempDir);

try {
const { root, packages, tool } = await getPackages(tempDir);
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.

q: so now tool is just a string so we wrap it in { type: tool } to conform to thy manypkg's v2 shape, right? once we migrate to it this value will change, we'll be able to just pass in tool directly because it will be an object with a .type property. On our end, in Changesets, we'll only require the .type to exist though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exactly.
The idea is to use an object so it can be extended with additional fields in the future if needed.

For now, the main benefit is that it keeps the type compatible with the one from manypkg@v2.

@marcalexiei marcalexiei requested a review from Andarist March 10, 2026 13:16
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.50%. Comparing base (c698064) to head (0ea7b13).
⚠️ Report is 1 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #1872   +/-   ##
=======================================
  Coverage   82.50%   82.50%           
=======================================
  Files          53       53           
  Lines        2383     2384    +1     
  Branches      697      697           
=======================================
+ Hits         1966     1967    +1     
  Misses        375      375           
  Partials       42       42           

☔ View full report in Codecov by Sentry.
📢 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.

@marcalexiei marcalexiei changed the title feat(types): add ChangesetsPackages feat(types): add Packages to replace types from @manypkg/get-packages Mar 12, 2026
@Andarist Andarist merged commit c19b112 into changesets:next Mar 25, 2026
1 of 6 checks passed
@marcalexiei marcalexiei deleted the changeset-packages-type branch March 25, 2026 12:36
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.

3 participants