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.
I noticed that installing this package brings more than it needs for runtime. This is because the shrinkwrap file which is packed has dev dependencies too. Not sure why, but npm installs both dependencies & devDependencies when installing the package.
As I suggested here using a lock file instead and building a shrinkwrap file before packing and after pruning dev-dependencies can fix that.
This PR does the following:
prepack
script to create the runtime dependencies only shrinkwrap filepostpack
script to revert changes(It does not install dev dependencies again, as the publish script runs in github action, and there's no point in doing that)
Note: The reason to delete the lock file is that
npm prune --production
only deletes files from thenode_modules
folder and does not update the lock file, and the npm shrinkwrap only renames the lock file to shrinkwrap file if it exists. When lock file does not exist, the shrinkwrap file is created from the existing dependencies tree (which represent the committed lock file, without the dev dependencies)(I tested using
npm pack
lifecycle, but I thinknpm publish
should use the same script lifecycle)Some numbers to justify this change: