-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat!: use .npmignore file to limit which files are published #2921
Conversation
17a5351
to
a4da8d9
Compare
Looking at: What are the main exclusions with this change?Unlike what the diff shows above, I think one of the bigger things this change would do is avoid shipping Looking into: which exact files are excluded? How many, and how big are they?For what it's worth, I get a larger diff than the PR body text above indicates, when running npm pack with npm@10.2.1. After this change: Full diff of files I see being no-longer included in the npm packed tarball after this change (click to expand):- .github/ISSUE_TEMPLATE.md
- .github/PULL_REQUEST_TEMPLATE.md
- .github/workflows/release-please.yml
- .github/workflows/tests.yml
- .github/workflows/visual-studio.yml
- CHANGELOG.md
- CONTRIBUTING.md
LICENSE
README.md
- SECURITY.md
addon.gypi
bin/node-gyp.js
- docs/Error-pre-versions-of-node-cannot-be-installed.md
- docs/Force-npm-to-use-global-node-gyp.md
- docs/Home.md
- docs/Linking-to-OpenSSL.md
- docs/README.md
- docs/Updating-npm-bundled-node-gyp.md
- docs/binding.gyp-files-in-the-wild.md
- gyp/.github/workflows/Python_tests.yml
- gyp/.github/workflows/node-gyp.yml
- gyp/.github/workflows/nodejs-windows.yml
- gyp/.github/workflows/release-please.yml
- gyp/AUTHORS
- gyp/CHANGELOG.md
- gyp/CODE_OF_CONDUCT.md
- gyp/CONTRIBUTING.md
gyp/LICENSE
gyp/README.md
gyp/data/win/large-pdb-shim.cc
@@ -90,22 +67,6 @@
gyp/pylib/packaging/tags.py
gyp/pylib/packaging/utils.py
gyp/pylib/packaging/version.py
- gyp/pyproject.toml
- gyp/test_gyp.py
- gyp/tools/README
- gyp/tools/Xcode/README
- gyp/tools/Xcode/Specifications/gyp.pbfilespec
- gyp/tools/Xcode/Specifications/gyp.xclangspec
- gyp/tools/emacs/README
- gyp/tools/emacs/gyp-tests.el
- gyp/tools/emacs/gyp.el
- gyp/tools/emacs/run-unit-tests.sh
- gyp/tools/emacs/testdata/media.gyp
- gyp/tools/emacs/testdata/media.gyp.fontified
- gyp/tools/graphviz.py
- gyp/tools/pretty_gyp.py
- gyp/tools/pretty_sln.py
- gyp/tools/pretty_vcproj.py
lib/Find-VisualStudio.cs
lib/build.js
lib/clean.js
@@ -122,33 +83,5 @@
lib/rebuild.js
lib/remove.js
lib/util.js
- macOS_Catalina_acid_test.sh
package.json
src/win_delay_load_hook.cc
- test/common.js
- test/fixtures/VS_2017_BuildTools_minimal.txt
- test/fixtures/VS_2017_Community_workload.txt
- test/fixtures/VS_2017_Express.txt
- test/fixtures/VS_2017_Unusable.txt
- test/fixtures/VS_2019_BuildTools_minimal.txt
- test/fixtures/VS_2019_Community_workload.txt
- test/fixtures/VS_2019_Preview.txt
- test/fixtures/VS_2022_Community_workload.txt
- test/fixtures/certs.js
- test/fixtures/nodedir/include/node/config.gypi
- test/fixtures/test-charmap.py
- test/process-exec-sync.js
- test/reporter.js
- test/simple-proxy.js
- test/test-addon.js
- test/test-configure-python.js
- test/test-create-config-gypi.js
- test/test-download.js
- test/test-find-accessible-sync.js
- test/test-find-node-directory.js
- test/test-find-python.js
- test/test-find-visualstudio.js
- test/test-install.js
- test/test-options.js
- test/test-process-release.js
- update-gyp.py With
I suppose it may be worthwhile from some folks' perspectives to shave off this bit of filesize and reduce I/O just slightly when installing this package. Some feedback: Consider keeping My personal thoughts:I'm personally neutral on the topic of whether to exclude a bunch of files from the package as published to npm package registry. (I'm sympathetic to the person who was worried about Just reducing the size of |
One other thing I would like to do before landing this is to come up with a way to run the test suite against a packed and installed tarball in CI. That will give me more confidence that future changes to |
Those files were showing as still packed when I ran my tests, but I likely made a mistake and changed the files array further after grabbing the diff. I'll confirm through a test in CI that the files we think should be in the tarball are there. |
6eb8a1c
to
719959b
Compare
I made a few changes to this PR:
I also updated the diff in the PR body to show the latest changes to using the |
It is also important to note that with the inclusion of an |
@cclauss Do you have an opinion on running |
I do not use Windows but… four minutes is a long time in CI test runs so I believe you made the right choice. Sometimes I add an on demand option to GitHub workflows and then only on those runs add extra stuff. This allows repo maintainers to see the extra stuff whenever it suits them but does not slow down normal CI runs.
Thanks massively for all your work to modernize node-gyp! Some of the changes might ruffle some feathers but modernization will help to make this software more reliable. You can’t make an omelet… |
Fixes: #2372
There was discussion about this being a breaking change in #2372, so I think v10.0.0 is a good time to make this change out of caution. I did err on the side of caution by not removing any
gyp/pylib/generator
files.Here is the diff of files that will now be excluded from the published tarball with this change: