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

[Feature Request] Display package size #219

Open
styfle opened this issue Mar 22, 2018 · 5 comments
Open

[Feature Request] Display package size #219

styfle opened this issue Mar 22, 2018 · 5 comments

Comments

@styfle
Copy link

styfle commented Mar 22, 2018

I am considering writing a tool to do this because it might be outside the scope of this project.

There is already https://bundlephobia.com which is great for front end dependencies that get bundled with webpack but it doesn't tell you about the size of dev dependencies such as test frameworks.

There is already a request to add this to npmjs.com here: npm/www#197

Is this a feature that could be used by npms.io? (forgive me if this is the wrong repo)

@satazor
Copy link
Member

satazor commented Mar 22, 2018

Yes we could! We actually have downloaders that are able to download the source code as well as the published code: https://github.com/npms-io/npms-analyzer/tree/master/lib/analyze/download

If there's a module that could receive a directory (that contains the code as well as the package.json) and calculate the bundle size, it would be easy to add the feature.

@styfle
Copy link
Author

styfle commented Mar 22, 2018

@satazor Thanks for the response!

I am actually working on code now to be able to do this but wanted to make sure I wasn't re-inventing the wheel! https://github.com/styfle/packagephobia

I started going for a web app to make it similar to bundlephobia but really all it does is act as an API for the module you just described.

Would you like me to break out the logic that computes the size into a separate package so you can save the size in your own database?

@styfle
Copy link
Author

styfle commented Apr 8, 2018

Here's what I came up with: https://github.com/styfle/packagephobia

@styfle
Copy link
Author

styfle commented Apr 17, 2018

@satazor The API is now available 🎉

You can use the npm package name and version (cached result):

https://packagephobia.com/[email protected]

Or simply the npm package name which will automatically use the latest version (never cached):

https://packagephobia.com/api.json?p=next

Will this work for npms.io to display a size?

@styfle
Copy link
Author

styfle commented May 11, 2018

@satazor Do you want to call the API when building stats?
How can we move forward with this? Thanks 😄

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

2 participants