Add pre-publish build step to fix installing insect from npm #238
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.
Fixes #224
I renamed the
postinstall
script tosetup
to avoid it being run when used as a CLI tool or dependency.The
setup
andbuild
script are run in theprepack
phase of the publish command, so you don't need to do anything. Just runnpm publish
as per usual.For convenience the
setup
script is also run onnpm start
. It's fast, so it's ok to do that and it's convenient to not need to think about any of this when contributing.I listed the files required for publishing in the
package.json
to avoid uploading unnecessary files. From testing it seems to only need theoutput
folder to run. If I'm mistaken, please correct me. I also added theinsect.png
because it is used in the README. README, LICENSE and index.js are included by default.As a small improvement I changed the copy script to copy files in parallel.
You can try this out:
If you want to just see what's being published and the above does not work, you can also do
This will give you the archive that would be published and you can just open it and have a look inside.