Add NVM node precedence if available #164
Open
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.
Feature
This PR makes use of NVM if it is available first before trying other node binaries. For example if you use a different node version based on your project using
.nvmrcthen the pre-commit hook will automatically pick that up first and use that node version for running the pre-commit commands.How to test
npm initor use an existing project.nvmrcfile with the desired node version for example18.16.0you can use the following command:echo 18.16.0 > .nvmrcnpm i pre-commit -Dnode_modules/pre-commitfolder and edit thehookfile and add the following contentsAdd pre-commit hooks to your
package.jsonfile as per the Readme of the repo and it should use your desired node version.