feat: publish only core files to npm package #263
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Situation
The npm package eslint-plugin-cypress published to the npm registry includes files that are not necessary to run the plugin. This bloats the package making it twice the size it needs to be.
The current package.json contains no files options. When this option is omitted, it defaults to
["*"]
, which means it includes all files from the repo.Change
Add a files option to package.json.
For linting add the directory:
For links in the README.md, add
The following files are automatically included:
Other files, that are used to set up the repo for development, in CI, for internal testing, and are not needed to run the plugin as a package, are not published with the package to the npm registry.
Impact
The reduction for each of the following metrics related to the published npm package eslint-plugin-cypress is approximately 65%:
Verification
Execute the following:
and inspect the list of files packed into the npm package. There should be 30 files in the package.
Linting
mv eslint-plugin-cypress-0.0.0-development.tgz test-project cd test-project npm install eslint@latest eslint-plugin-cypress-0.0.0-development.tgz -D npx eslint npx eslint --config eslint-configs/eslint.default.mjs npx eslint --config eslint-configs/eslint.default-deprecated.mjs npx eslint --config eslint-configs/eslint.globals.mjs npx eslint --config eslint-configs/eslint.recommended.mjs
No linting or other errors should be reported.
Markdown links
No link errors should be reported.
Clean up
Clean up temporary files: