Create a website
styfle opened this issue ยท 10 comments
Have you thought about creating a website so that someone could link to the report to show the cost of a module?
For example, bundlephobia shows you the webpack size if you included the module. See Example.
It would be great to do something like cost-of-modules.com/result?p=ava@0.24.0 and see that the result is 24 MB.
It probably doesn't fit in this repo but a related parallel project
What are the numbers that you'd like to show?
- download size
- ?
It probably doesn't fit in this repo but a related parallel project
I created pastelsky/bundlephobia#40 which might be a good place to put this feature if it is not out of scope.
What are the numbers that you'd like to show?
I think the numbers should show the size on disk.
The way I normally do this myself is the following:
mkdir ava-example
cd ava-example
npm init -y
npm install --save ava
du -sh
This prints 24 M
Note, I add the suffix -example
to avoid the name collision with the package name.
I was going to say something similar: pastelsky/bundlephobia#40 (comment)
the motive of bundlephobia is different but it has all of the code and infra required for this, maybe a fork makes the most sense ๐
@siddharthkp I would like to import this package and use it on the server but it doesn't seem to work.
npm install --save cost-of-modules
var com = require('cost-of-modules');
Error: Cannot find module 'cost-of-modules'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
I thought it might be because of a missing main
but I see that in package.json
but I realize now that that the problem is caused by index.js
not exporting anything.
I started work in this repo if anyone is interested in following:
Oh yeah, it's because it assumes CLI
You can pull the functionality into a function and export that, should work
@siddharthkp I think that it would require quite a bit of refactoring to cost-of-modules
to make the product I want.
The way cost-of-modules
works is assuming you have cloned a repo and you are reading all of the installed dependencies.
The tool I want to build is more like bundlephobia in that you get the cost/size via the web interface, before you install anything.
So I think I'm going to develop this as a separate project and think of a different name. Unless you would like to collaborate and share the same name.
Here's what I came up with: https://github.com/styfle/packagephobia
This is so cool!
Thanks for the kind words!
Keep up the great work on cost-of-modules, it's an excellent tool! ๐