[8.0.0] published npm package contains unused files (tests; repo config)
See original GitHub issue- Node Version: node v14.16.1 (npm v6.14.12)
- Platform: Fedora 33
- Compiler: Irrelevant
- Module: Irrelevant
Published npm package contains repo configuration/scripts, βtestβ folder, etc.
May want to use the βfilesβ field in package.json
and specify only the actually used files/folders.
$ tree node_modules/node-gyp/ -a
node_modules/node-gyp/
βββ addon.gypi
βββ bin
β βββ node-gyp.js
βββ CHANGELOG.md
βββ CONTRIBUTING.md
βββ .github
β βββ ISSUE_TEMPLATE.md
β βββ PULL_REQUEST_TEMPLATE.md
β βββ workflows
β βββ tests.yml
βββ gyp
β βββ AUTHORS
β βββ CHANGELOG.md
β βββ CODE_OF_CONDUCT.md
β βββ CONTRIBUTING.md
β βββ data
β β βββ win
β β βββ large-pdb-shim.cc
β βββ .flake8
β βββ .github
β β βββ workflows
β β βββ node-gyp.yml
β β βββ nodejs-windows.yml
β β βββ Python_tests.yml
β β βββ release-please.yml
β βββ gyp
β βββ gyp.bat
β βββ gyp_main.py
β βββ LICENSE
β βββ pylib
β β βββ gyp
β β βββ common.py
β β βββ common_test.py
β β βββ easy_xml.py
β β βββ easy_xml_test.py
β β βββ flock_tool.py
β β βββ generator
β β β βββ analyzer.py
β β β βββ android.py
β β β βββ cmake.py
β β β βββ compile_commands_json.py
β β β βββ dump_dependency_json.py
β β β βββ eclipse.py
β β β βββ gypd.py
β β β βββ gypsh.py
β β β βββ __init__.py
β β β βββ make.py
β β β βββ msvs.py
β β β βββ msvs_test.py
β β β βββ ninja.py
β β β βββ ninja_test.py
β β β βββ xcode.py
β β β βββ xcode_test.py
β β βββ __init__.py
β β βββ input.py
β β βββ input_test.py
β β βββ mac_tool.py
β β βββ msvs_emulation.py
β β βββ MSVSNew.py
β β βββ MSVSProject.py
β β βββ MSVSSettings.py
β β βββ MSVSSettings_test.py
β β βββ MSVSToolFile.py
β β βββ MSVSUserFile.py
β β βββ MSVSUtil.py
β β βββ MSVSVersion.py
β β βββ ninja_syntax.py
β β βββ simple_copy.py
β β βββ win_tool.py
β β βββ xcode_emulation.py
β β βββ xcode_ninja.py
β β βββ xcodeproj_file.py
β β βββ xml_fix.py
β βββ README.md
β βββ requirements_dev.txt
β βββ setup.py
β βββ test_gyp.py
β βββ tools
β βββ emacs
β β βββ gyp.el
β β βββ gyp-tests.el
β β βββ README
β β βββ run-unit-tests.sh
β β βββ testdata
β β βββ media.gyp
β β βββ media.gyp.fontified
β βββ graphviz.py
β βββ pretty_gyp.py
β βββ pretty_sln.py
β βββ pretty_vcproj.py
β βββ README
β βββ Xcode
β βββ README
β βββ Specifications
β βββ gyp.pbfilespec
β βββ gyp.xclangspec
βββ lib
β βββ build.js
β βββ clean.js
β βββ configure.js
β βββ find-node-directory.js
β βββ find-python.js
β βββ Find-VisualStudio.cs
β βββ find-visualstudio.js
β βββ install.js
β βββ list.js
β βββ node-gyp.js
β βββ process-release.js
β βββ rebuild.js
β βββ remove.js
β βββ util.js
βββ LICENSE
βββ macOS_Catalina_acid_test.sh
βββ macOS_Catalina.md
βββ package.json
βββ README.md
βββ src
β βββ win_delay_load_hook.cc
βββ test
β βββ common.js
β βββ fixtures
β β βββ ca-bundle.crt
β β βββ ca.crt
β β βββ server.crt
β β βββ server.key
β β βββ test-charmap.py
β β βββ VS_2017_BuildTools_minimal.txt
β β βββ VS_2017_Community_workload.txt
β β βββ VS_2017_Express.txt
β β βββ VS_2017_Unusable.txt
β β βββ VS_2019_BuildTools_minimal.txt
β β βββ VS_2019_Community_workload.txt
β β βββ VS_2019_Preview.txt
β βββ process-exec-sync.js
β βββ simple-proxy.js
β βββ test-addon.js
β βββ test-configure-python.js
β βββ test-download.js
β βββ test-find-accessible-sync.js
β βββ test-find-node-directory.js
β βββ test-find-python.js
β βββ test-find-visualstudio.js
β βββ test-install.js
β βββ test-options.js
β βββ test-process-release.js
βββ update-gyp.py
20 directories, 126 files
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
npm-publish - npm Docs
Description. Publishes a package to the registry so that it can be installed by name. By default npm will publish to the public...
Read more >lerna/CHANGELOG.md at main - GitHub
dragon: Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.
Read more >Semantic Release publishing on package.json - Stack Overflow
I assume when you build locally, you have a build folder with package.json and a cjs folder, but only the file itself is...
Read more >Supported hooks - pre-commit
check-json - checks json files for parseable syntax. check-shebang-scripts-are-executable - ensures that (non-binary) files with a shebang are executable.
Read more >Node.js v19.3.0 Documentation
calls() and will throw an error for functions that have not been called the expected number of times. import assert from 'node:assert'; //...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hereβs my take: Tests etc. represent part of the documentation and are components of the complete project which we occasionally snapshot and publish as a version to npm. On that basis, packages in npm should include stand-alone snapshots of a project. I know this is not a view held by everyone who publises to npm and some want to obsessively remove everything except that which touches the execution pathβwhich is arguably reasonable in a world of trivial dependencies that bloat our development folders. I just think maybe the problem of needless dependency tree bloat should be tackled with greater priority. So Iβm personally not in favour of removing things from a publish unless weβre dealing with unreasonably large items. 2Mb is not unreasonable for us to be able to ship a complete snapshot of the package. If we have extraneous things in the repo then we should be able to add them to .gitignore.
Re server.key, if this is a critical problem for you then perhaps you could help out by contributing a change that shuffles it out of view of low quality auto-audits? Either generate it as required for tests, or maybe more practically, embed it as a string in a test file that can be extracted and removed on each run? Alternatively find a better auditor that isnβt upset by test fixtures?
This is more than a space-saving move. An automated security audit tool found and flagged the presence of https://github.com/nodejs/node-gyp/blob/master/test/fixtures/server.key which, although probably harmless, creates noise for the auditor and makes for an awkward conversation. Is there an estimated time to remove these files from the build?