Updates package.json
to use prepare
instead of postinstall
#160
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.
The npm
postinstall
script runs both on local npm install as well asafter being installed as a dependency of someone else’s project. The
prepare
script only runs on local npm install (and before publishing).npm-scripts
vscode
is adevDependency
, not adependency
, so if someone tries toinstall this package as a dependency of their own, the installation
fails because
./node_modules/vscode
does not exist.One example of where it may be useful to install the package directly
would be when using something like
andrewbranch/gatsby-remark-vscode
which uses VS Code syntax highlighting and themes to generate the syntax
highlighting in Gatsby sites.
The
postinstall
toprepare
change issuggested
by the author of the Gatsby plugin as a way to work with languates that
aren't supported by VS Code out-of-the-box.
This change seems to have works successfully in the past for other VS
Code extensions as well:
Testing
After making this change, I was able to add this package as a dependency of my Gatsby project
and successfully have the
gatsby-remark-vscode
plugin highlight Elixir syntax.I also tested that the
build
script still worked:with this I was able to manually add the
vsix
file to VS Code to install the extension.Are there any other suggestions or practices to best test this?