Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pnpm support? #113

Open
borekb opened this issue Jul 5, 2022 · 8 comments
Open

Add pnpm support? #113

borekb opened this issue Jul 5, 2022 · 8 comments

Comments

@borekb
Copy link

borekb commented Jul 5, 2022

This looks like a nice tool but it doesn't seem to work with pnpm installations (we, specifically, use Yarn 3 & its pnpm linker but I guess using the pnpm CLI itself would have the same problem).

The output is just this:

$ npx qnm
node_modules directory is empty
@ranyitz
Copy link
Owner

ranyitz commented Jul 9, 2022

Hey @borekb and thanks for opening this issue!

I've looked into this use case and added support for both yarn-3 with pnpm linker, pnpm and the case of circular symlinks.

on qnm version 2.10.0

Please let me know if it works for you

@borekb
Copy link
Author

borekb commented Jul 9, 2022

Wow that was fast!

I tried in our repo which uses Yarn workspaces and it failed after about 1 minute with this error:

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

I guess Yarn workspaces might be the problem. I don't really have a non-workspaces project I could test right now but still appreciate your super-fast reaction!

@ranyitz
Copy link
Owner

ranyitz commented Jul 9, 2022

Hey @borekb, thanks for testing it!

Actually, qnm supports yarn workspaces, I'm not sure what is the issue 🤷‍♂️
I'd love to debug it though, so if you can find a repo that reproduces it be happy to debug it.

@borekb
Copy link
Author

borekb commented Jul 9, 2022

It's an internal repo, unfortunately, and I can't promise that I'll remember to create a public repro 😄. But you're awesome for adding pnpm support so quickly!

@beeequeue
Copy link

The pnpm support seems to only recognize the top-level dependencies from my testing of running qnm in any repo using pnpm

@ranyitz
Copy link
Owner

ranyitz commented Jul 12, 2022

@beeequeue can you create a repro and describe what do you expect to see in oppose to what qnm shows today? I believe it could help shape the output according to what's relevant for the use case

@beeequeue
Copy link

https://github.com/BeeeQueue/qnm-repro

If you install using npm it shows 700~ deps, and if you remove node_modules and install using pnpm it shows 8

@ranyitz
Copy link
Owner

ranyitz commented Jul 12, 2022

Thanks @beeequeue.

You are right. While I made qnm not crash on pnpm repositories, what it does is just list the top-level modules within the node_modules.

pnpm works differently from npm/yarn in a way that it'll create links for every package, and it will place its own dependencies as its siblings

image

Today, qnm's algorithm is to run on a workspace and analyze it from top to bottom, it doesn't try to go "up" in the directory structure like Node's resolution algorithm does.

This is the reason you see only 8 dependencies when running qnm today.


qnm was created because, for years, package managers compromised on correctness for install size by hoisting packages, which created many problems that needed to be debugged. As I'm not a pnpm user myself, it would be very interesting for me to know what kind of things pnpm users need to debug, and what information they expect to get from qnm.

Once I'll understand the need, it would be possible to implement a solution for it.

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

No branches or pull requests

3 participants