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

Command line package #88

Closed
Siilwyn opened this issue Jun 8, 2018 · 11 comments
Closed

Command line package #88

Siilwyn opened this issue Jun 8, 2018 · 11 comments

Comments

@Siilwyn
Copy link

Siilwyn commented Jun 8, 2018

💭 what do you think of creating a packagephobia CLI tool? Maybe it's possible to re-use core logic that checks the size for a server.

@styfle
Copy link
Owner

styfle commented Jun 9, 2018

Hi Selwyn,

Thanks for your interest in Package Phobia!

I have pondered the idea of a CLI tool myself but there are several ways it could be implemented.

What is your goal here? Do you want to use this CLI tool...

  • as a package author checking the size of a new dependency before you add it?
  • as a package author checking a new version of an existing dependency before bumping?
  • as a package author checking the size of your own source code before you publish to npm?
  • something else?

@Siilwyn
Copy link
Author

Siilwyn commented Jun 12, 2018

Hi there @styfle,

my goal would be to run the CLI from a CI service to check the size of my own source code + node modules for pull requests. So when people add new dependencies in a PR I can check the size before merging.

@styfle
Copy link
Owner

styfle commented Jun 13, 2018

Do you want this to be a function that would fail npm test (travis for example), or do you want it to run as a service to use with GitHub Checks like Bundle Size?

@Siilwyn
Copy link
Author

Siilwyn commented Jun 13, 2018

I think both are great, though the first one is simpler to build I think.

@styfle
Copy link
Owner

styfle commented Jun 14, 2018

Ok, and my guess is that you want to take into account .npmignore so that those files/folders are ignored when checking the size?

For example, most people do not publish their tests folder to npm because consumers do not need it, so you likely do not want to check the size of that folder, correct?

@Siilwyn
Copy link
Author

Siilwyn commented Aug 29, 2018

Sorry about the late reply, I was thinking of creating a PR but have to find some time first with all kinds of other projects. ^^

I would indeed ignore the files in .npmignore and only include the files in the array of package.json files key. The purpose for me would be to test the file size of the npm package on every commit.

@jimmywarting
Copy link

i would like to be able to upload a package.json as a file or url
everything is not a npm package and some are private

@styfle
Copy link
Owner

styfle commented Dec 13, 2018

@jimmywarting Agreed. There is a feature request here: #133

@egoist
Copy link

egoist commented Jan 30, 2019

https://github.com/egoist/npm-size

npm-size could probably suit your needs, I can add a --size-limit <size> flag for your use case.

@egoist
Copy link

egoist commented Jan 31, 2019

2019-01-31 5 21 19

--limit flag is available now

@styfle
Copy link
Owner

styfle commented Jun 28, 2020

Closing this issue since npm-size . --limit 3mb solves this use case.

Another solution is to run npm pack and measure the size of the resulting tarball.

Also see CLI tools listed in the How is this different? section of the readme.

@styfle styfle closed this as completed Jun 28, 2020
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

4 participants