Activate a nodenv node version from package.json#engines.node field
Switch to version hooks. Fixes #25.
Using version-name
and version-origin
instead of the which
supports more nodenv commands, includeing nodenv version
.
Full explanations of hooks here: https://github.com/rbenv/rbenv/wiki/Authoring-plugins#rbenv-hooks
Extract plugin_root script
To enable moving shared functions into libexec.
Reorganize functions in libexec
Prompted by the need to share precedence checks betweeen version-name and version-origin, I've extracted mosted of the package-json-engine logic into functions in libexec.
Also fixes #10.
Rebase nodenv-shell precedence onto version support
With a slightly different check for nodenv shell
that lets us still
respect shell version even when it matches the global version.
Lint with Shellcheck
And run automatically on travis
Update message to more closely align with stock
The regular failure message is
nodenv: version `12' not installed
We can match that a bit better with:
package-json-engine: version satisfying `12' not installed
Don't emit warnings for unreadable or non-file package.json
Quiet errors from JSON.sh
Credit JSON.sh and link to docs for options
Skip aliases
No need to select aliases since the aliased node would already be included itself.
Handle non-semver node versions
sh-semver emits warnings when non-semver strings are passed to it. So we should filter out and ignore any node versions that don't at least start with a number.
This could be a lot smarter, and currently only works because node versions omit the implicit 'node-' prefix.
Minor spelling fix
Use JSON.sh to parse package.json
This replaces a regex that could match babel-preset-env settings.
Fixes nodenv/nodenv-package-json-engine#31
Switch to depending on semver from npm
Fix script dir lookup to handle symlinks
Refactors script dir lookup into a function
Functions then 'main'
Search for installed versions matching semver range
shellcheck fixes
safe array handling of nodenv versions