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

Reduce npm payload size by updating .npmignore #2124

Closed
wants to merge 2 commits into from
Closed

Reduce npm payload size by updating .npmignore #2124

wants to merge 2 commits into from

Conversation

jwngr
Copy link

@jwngr jwngr commented Mar 11, 2016

Thanks for creating a module I used every day! I'm trying to give back in whatever little way I can.

The npm payload delivered from npm install request contains a few files which are not needed for the module to actually work, so I added these things to the .npmignore file. Here is the data for your package before and after this change:

Including deps Excluding deps
Current 5,136 KB 276 KB
Updated 5,120 KB 260 KB
Savings 0.31% 5.80%

I got these numbers using du -shk <directory>

The difference between the "Including / Excluding deps" columns is whether or not the node_modules/ directory containing request's dependencies is included.

According to request's npmjs.com page, request has been downloaded 588,799 times in the last day. At 276 KB per download (ignoring request's dependencies), that is 162.5 GB per day for this module alone! With this change, that number drops by 5.80% to 153.1 GB.

In case you want to double check the resulting package, you can do so locally:

# Create a tarball of the resulting package
$ npm pack

# See the file list of that tarball
$ tar -tf request-<version>.tgz
package/package.json
package/README.md
package/LICENSE
package/index.js
package/request.js
package/CHANGELOG.md
package/lib/auth.js
package/lib/cookies.js
package/lib/getProxyFromURI.js
package/lib/har.js
package/lib/helpers.js
package/lib/multipart.js
package/lib/oauth.js
package/lib/querystring.js
package/lib/redirect.js
package/lib/tunnel.js

# Install the tarball as a local node module
$ npm install request-<version>.tgz

@@ -1,6 +1,9 @@
coverage
tests
node_modules
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, this line is not needed as the node_modules directory is excluded by default.

@jwngr
Copy link
Author

jwngr commented Nov 18, 2016

Closing as obsolete due to #2394.

@jwngr jwngr closed this Nov 18, 2016
@jwngr jwngr deleted the jw-reduce-npm-payload-size branch November 18, 2016 17:51
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

Successfully merging this pull request may close these issues.

None yet

1 participant