Skip to content

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

Open
marcalexiei wants to merge 3 commits intochangesets:nextfrom
marcalexiei:changeset-packages-type
Open

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

Conversation

@marcalexiei
Copy link
Contributor

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

@changeset-bot
Copy link

changeset-bot bot commented Mar 4, 2026

⚠️ No Changeset found

Latest commit: 0ea7b13

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changesets: string[];
};

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

@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
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
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
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
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

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
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