Update @manypkg/get-packages to v2#1795
Conversation
🦋 Changeset detectedLatest commit: 0d3f4db The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1795 +/- ##
=======================================
Coverage 81.33% 81.34%
=======================================
Files 54 54
Lines 2277 2278 +1
Branches 684 679 -5
=======================================
+ Hits 1852 1853 +1
Misses 420 420
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" | ||
| integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== | ||
|
|
||
| read-yaml-file@^1.1.0: |
There was a problem hiding this comment.
@bluwy I'm moving the conversation here since #1772 is closed
I think we cant upgrade it in this major due to its breaking change.
From @manypkg/get-packages@2.0.0 changelog
There is a change in getPackages structure:
The get-packages package now returns a slightly different structure. The old tool string has been replaced with a tool object, using the new Tool interface provided by @manypkg/tools. Each Package now contains both the absolute directory and relative directory path. Last, the root package has been renamed rootPackage and is optional, to support monorepos that do not contain a root package.
I assumed that when working with a changeset there is always a root package, so I added a non-null assertion to avoid the type-checking error.
For the tool updates, I added access to the type property and used a simple { type: 'tool' } object in the mock functions, along with a type cast.
|
@bluwy could you take a look at this PR? |
|
@Andarist This PR has been open for months without review. I noticed you added the I’d appreciate a review when possible. |
|
@marcalexiei ye, we should retarget this to the next branch BUT we need a plan first that will work with our bot, see how we use the packages: The problem in there is that we need This might require refactoring the current latest version of manypkg. I'm not sure. If you could do the research around this, it would be very appreciated. |
|
@Andarist As I understand it, the original goal was for I reviewed the following packages:
In most places, ProposalIntroduce a new interface in This would decouple the implementation from The structure would closely resemble Rough Interface Sketchinterface ChangesetPackages {
rootPackage?: {
dir: string;
};
packages: Array<{
dir: string;
// from "@changesets/types"
packageJson: PackageJSON;
}>;
}Would this direction be something you’d consider? |
|
Sounds good. We should also try to handle both manypkg v1 and v2 formats in the bot repo - by detecting what version of Changesets is used by the repo (unless they are completely compatible for our needs) |
Ok, I'll start a new PR from scratch based upon the
Yes, because the tool property differs significantly between the two versions, |
Note that we could also consider releasing manypkg v3 to make that project more compatible with what we need it for in Changesets but it would be nice to not lose functionality implemented in v2... But maybe there is some restructuring that can be done to accomplish both needs? |
|
I'm working on this and so far this is what I've created in export interface ChangesetPackage {
dir: string;
packageJson: PackageJSON;
}
// This should be compatible with `@manypkg/get-packages@2`
export type ChangesetPackagesTool = {
type: "yarn" | "bolt" | "pnpm" | "lerna" | "root" // Picked up from `@manypkg/get-packages@1`
};
export interface ChangesetPackages {
root: ChangesetPackage;
packages: Array<ChangesetPackage>;
tool: ChangesetPackagesTool;
}Once I have the test and type-check scripts working, For now, I won’t update |
js-yamltov4#1772@manypkg/get-packages@1depends onread-yml-files@1, which usesjs-yaml@3.Upgrading to
@manypkg/get-packages@2.2.2removes this and other dependencies.Why not
@manypkg/get-packages@3?Version 3 is ESM-only.
This repository still relies on Jest 29, which does not support ESM by default, so upgrading to v3 isn’t feasible yet.
I’m aware that a few changes may conflict with the
nextbranch,but I believe it’s worthwhile to merge this into
mainto reduce unnecessary dependencies.If you're happy with this PR, I can also prepare a follow-up to bring the same changes into
next.Since
nextbranch usesvitest, we could consider upgrading@manypkg/get-packagesto v3 there.