Skip to content

feat: support for yarn@berry#19

Draft
wojtekmaj wants to merge 6 commits into
antfu:mainfrom
wojtekmaj:yarn
Draft

feat: support for yarn@berry#19
wojtekmaj wants to merge 6 commits into
antfu:mainfrom
wojtekmaj:yarn

Conversation

@wojtekmaj
Copy link
Copy Markdown
Contributor

Description

This is a DRAFT that adds support for yarn@berry. I sadly can't contribute more but I'll be honored if you use my code as a starting point. Please, feel free to close if you don't find this useful! No offense taken. :D

Linked Issues

#13

Additional context

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 5, 2025

Deploy Preview for node-modules-inspector ready!

Name Link
🔨 Latest commit e5c82ec
🔍 Latest deploy log https://app.netlify.com/sites/node-modules-inspector/deploys/67c5564230a07800081a9536
😎 Deploy Preview https://deploy-preview-19--node-modules-inspector.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@antfu antfu changed the title Add support for yarn@berry feat: support for yarn@berry Mar 2, 2025
@antfu
Copy link
Copy Markdown
Owner

antfu commented Mar 2, 2025

It looks very promising already, thank you! Do you think we could merge it as-is, let the community to play with it and iterate together?

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 2, 2025

Open in Stackblitz

npm i https://pkg.pr.new/node-modules-inspector@19
npm i https://pkg.pr.new/node-modules-tools@19

commit: a3d3352

@antfu
Copy link
Copy Markdown
Owner

antfu commented Mar 3, 2025

I tried to take a look into it, but it seems that yarn info lacks a lot of the information we need. I suppose maybe instead of relying on yarn's cli, we could do a generate node_modules travse with fs that can also support other package manager like npm and bun

@antfu
Copy link
Copy Markdown
Owner

antfu commented Mar 3, 2025

Oh, pnp doesn't have a node_modules 😇

@beaussan
Copy link
Copy Markdown

beaussan commented Mar 3, 2025

Maybe we can have a first version without pnp? The node modules linker is still widely used

Copy link
Copy Markdown

@reteps reteps left a comment

Choose a reason for hiding this comment

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

Some minor thoughts -- would love to get this merged for just node-modules support as a start!

break
}
case 'yarn@berry': {
console.warn('Yarn Berry support is experimental, if you encounter any issues, please open an issue with a reproduction')
Copy link
Copy Markdown

@reteps reteps Mar 18, 2025

Choose a reason for hiding this comment

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

Does this need additional handrails to ensure

yarn config get nodeLinker is node-modules? Then the strategy outlined by @antfu would be guaranteed to work.


return {
root,
packageManager: 'berry',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we keep this consistent as yarn@berry?

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 don't think so. It's consistent with agent name (see file path). pnpm also has just "pnpm" and not "pnpm@6".

@OrbisK OrbisK mentioned this pull request Apr 10, 2025
3 tasks
@aqeelat
Copy link
Copy Markdown

aqeelat commented Jul 23, 2025

Since yarn berry with npmLinker is easy to parse, I think this PR is good enough. We can add support for PnP in a future iteration.
Also, do we need to support yarn 1 since it is still common? They have two different cli parameters for yarn list.

@reteps
Copy link
Copy Markdown

reteps commented Aug 13, 2025

This current PR doesn't pick up on package sizes BTW.

@aqeelat
Copy link
Copy Markdown

aqeelat commented Aug 13, 2025

This current PR doesn't pick up on package sizes BTW.

We can add it in a subsequent pr before the release.

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.

5 participants