All Projects → nodenv → nodenv-package-json-engine

nodenv / nodenv-package-json-engine

Licence: other
Activate a nodenv node version from package.json#engines.node field

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to nodenv-package-json-engine

xxenv-latest
This **env(pyenv, rbenv, nodenv, goenv, phpenv, luaenv) plugin replaces the version specified in the argument with the latest version.
Stars: ✭ 69 (+115.63%)
Mutual labels:  nodenv-plugin
nodenv-nvmrc
nodenv plugin that detects the node version based on .nvmrc.
Stars: ✭ 30 (-6.25%)
Mutual labels:  nodenv-plugin

nodenv-package-json-engine

Latest GitHub Release Latest npm Release Test

This is a plugin for nodenv that detects the Node version based on the engines field of the current tree's package.json file. The $NODENV_VERSION environment variable (set with nodenv shell) and .node-version files still take precedence.

When engines is configured with a range this plugin chooses the greatest installed version matching the range, or exits with an error if none match.

Installation

Installing with Git

$ git clone https://github.com/nodenv/nodenv-package-json-engine.git $(nodenv root)/plugins/nodenv-package-json-engine

Installing with Homebrew

Mac OS X users can install many nodenv plugins with Homebrew.

This is the recommended method of installation if you installed nodenv with Homebrew.

$ brew tap nodenv/nodenv
$ brew install nodenv-package-json-engine

Usage

Once you've installed the plugin you can verify that it's working by cding into a project that has a package.json file with engines and does not have a .node-version file. From anywhere in the project's tree, run nodenv which node.

Contributing

npm install and npm test from within the project.

Credits

package.json inspection and SemVer integration heavily inspired by nvmish [1] [2] and rbenv-bundler-ruby-version.

Shell semver range support provided by sh-semver.

package.json parsing provided by JSON.sh.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].