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
Enhance Visualization of .pnpm-store #7413
Comments
The names, versions, and file addresses of the cached packages can be found at But the decision whether add this feature (and with it, maintaining burden) to pnpm is up to @zkochan. |
If it can be added to pnpm, I'd be willing to implement this feature. |
I guess we need two commands. One for reading the index file. Something like:
This would print the JSON content of the package's index file. The other command would print the content of the file by it's hash (the hash that is saved in the index file):
The command names are inspired by similar commands in Git and Bit |
Excellent suggestion, I can create any visualization tool based on these two commands. |
I believe there is still a feature needed. As multiple versions of a library in the pnpm-store share files, I would like to know which libraries correspond to a particular hash. For example, if lodash@1.0.0 and lodash.1.1.0 are installed, all packages can be found via the following command: pnpm find-hash <hash>
# lodash@1.0.0 <hash>-index.json
# lodash.1.1.0 <hash>-index.json |
You mean you want to know a file is included by which packages? We can probably do that but I think it will be a slow command. We'd need to read all the index files in the store and search for the file's hash in every index file. |
Yes, I require this feature. It's okay if it's a lower priority, but I hope it can be implemented as soon as possible. Thank you very much for creating such a useful tool. If you guys are too busy, I can also help with the implementation of the specific logic code. Additionally, I have another question. Is there a planned timeline for this? Where can I see it? |
As you said, it is low priority. If you need it, maybe try to contribute it yourself. |
Are these few commands more suitable as sub commands for the store? like
|
I don't have a preference. Making it a subcommand is fine. But making it a top-level command is probably fine too as I don't think there will be related commands that are not related to the store. |
This is also correct to understand 😂 |
@byteHulk Can you submit the pull request. |
@zkochan @yanhaijing Do we need to add this command? I implemented part of it. |
done |
Regarding the Alternatively, if we keep the |
I think the Or what is the user usage scenario for finding the hash through a file? |
Sometimes I want to check how many packages are sharing a particular file, as I mentioned above, using visualization tools. |
Like a file from node_modules, right? |
@yanhaijing can you build pnpm from the PR and try out the new commands? |
https://github.com/pnpm/pnpm/blob/main/CONTRIBUTING.md This can help build Using the |
Like you said, I think adding a command to compute the hash from the node_modules file path would make finding the hash more flexible. |
Let's first push forward with cat-index and cat-file. As for find-hash, I believe it requires further consideration and time. |
I agree with this idea. Having a command to quickly locate files within node_modules and identify their positions within the store is a great idea. |
Contribution
Describe the user story
I have been using pnpm and find it really useful, especially the way it optimizes package storage using its store. However, I find it really hard sometimes to understand where packages are placed within the .pnpm-store due to its non-human-readable, hash-based structure.
Describe the solution you'd like
I think it would be a huge benefit if there was a way, maybe a command or tool, that can provide a visualization or mapping from package names (plus versions) to their locations inside .pnpm-store.
This could help with various debugging scenarios, and generally make the location of packages more transparent to the user.
Does something like this exist, or could it be a new feature in a future version of pnpm? I would love to hear your thoughts on this.
Thank you very much!
Describe the drawbacks of your solution
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: