-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
build: bundle the npm CLI itself for release #4
Conversation
In Yarn we actually had a improvement overall when we switched to a JS bundle + v8-compile-cache. Fewer files to read means fewer stat() calls which means less disk activity. It also significantly reduced the amount of code in our downloads, as modules tend to have a lot of junk (tests, docs, unused files) that are all excluded when you build a bundle. 😃 |
Maybe creating a fork of https://github.com/zeit/pkg that would create a js-bundle instead of an executable would be an idea. pkg already does things such as creating a virtual filesystem, mocking child_process.fork(), etc. so this would probably be the best solution that requires the least changes to npm itself (if deps are missing or not getting picked up by pkg one only has to add a glob to the |
As it stands, this feels like a fool's errand and a massive time sink. I think we should give it another whirl in the future when npm's gotten refactored a bit more and split into more modern/webpackable components (and maybe webpack has time to mature its node-building support?). Until then, I'm gonna close this. I'll leave the branch up on the repo for future reference in case another adventurous soul decides this would be worth their time. In the meantime, I have way better things to do and this won't get any attention from me. |
Trued up committer:get-all, update message, npm publishing commands
This makes it so we can bundle the npm CLI into a handful of files, instead of hundreds of thousands, with some advantages:
npx
So far, I've tried
browserify
,rollup
, and evenparcel
, andwebpack
seems to be the closest thing to working, but it's not quite there yet.Still TODO:
update-notifier
usesrequire-lazy
for its dependencies, and that doesn't get picked up by webpack at all.child_process.spawn/exec
. Those need to be standalone entry points. The workers are the extraction worker and the metrics worker on the npm installer, and the extraction worker inlibcipm
(a dependency).