Coder Social home page Coder Social logo

nodenv-nvmrc's People

Contributors

aymericbouzy avatar lumaxis avatar ouchxp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nodenv-nvmrc's Issues

nodenv install with no arguments doesn't work

When a directory contains .node-version file you can run nodenv install with node-build installed and node-build picks up the required version then installs it.

Any chance you could allow for that? I realize that requires checking whether another plugin is installed, but I commonly default to nodenv install in bin/setup-type scripts.

PS: Thanks for this plugin, I have a ton of old projects with .nvmrc files all over the place and it's way easier to deal with them with this.

Does not support referencing versions by name

When using e.g. an LTS version by name in .nvmrc (such as lts/dubnium), one of the plugins dependencies, sh-semver, chokes:

/usr/local/bin/../Cellar/nodenv-nvmrc/1.0.1/bin/../node_modules/sh-semver/semver.sh: line 138: [: lts: integer expression expected
/usr/local/bin/../Cellar/nodenv-nvmrc/1.0.1/bin/../node_modules/sh-semver/semver.sh: line 142: [: lts: integer expression expected
/usr/local/bin/../Cellar/nodenv-nvmrc/1.0.1/bin/../node_modules/sh-semver/semver.sh: line 138: [: lts: integer expression expected
/usr/local/bin/../Cellar/nodenv-nvmrc/1.0.1/bin/../node_modules/sh-semver/semver.sh: line 142: [: lts: integer expression expected
/usr/local/bin/../Cellar/nodenv-nvmrc/1.0.1/bin/../node_modules/sh-semver/semver.sh: line 138: [: lts: integer expression expected
/usr/local/bin/../Cellar/nodenv-nvmrc/1.0.1/bin/../node_modules/sh-semver/semver.sh: line 142: [: lts: integer expression expected
[...]
nvmrc: no version satisfying `lts/dubnium' installed

.nvmrc overrides NODENV_VERSION

Without nodenv-nvmrc, NODENV_VERSION supercedes .node-version. It seems like NODENV_VERSION should also supercede .nvmrc when using nodenv-nvmrc.

Repro:

> echo "12.15.0" > .node-version
> nodenv version
nodenv: version `12.15.0' is not installed (set by /Users/matttingen/test/.node-version)
> NODENV_VERSION=12.14.0 nodenv version
nodenv: version `12.14.0' is not installed (set by NODENV_VERSION environment variable)
> rm .node-version
> echo "12.13.0" > .nvmrc
> nodenv version
nodenv: version `12.13.0' is not installed (set by /Users/matttingen/test/.nvmrc)
> NODENV_VERSION=12.14.0 nodenv version
nodenv: version `12.13.0' is not installed (set by /Users/matttingen/test/.nvmrc

Cannot override root directory's .node-version with .nvmrc

nodenv traverses the file hierarchy upwards until it finds a .node-version file or falls back to ~/.nodenv/version, if that exists.
That means I can't override either a root directory's Node version or my global version via a local .nvmrc file because of this skip.

Originally posted by @lumaxis in #5 (comment)

I think the problem here is should_find_in_nvmrc() because for a use case like mine, nodenv local will return the root folder's version from ../.node_version.

Significant slowdown when this plugin is active; node starts 2-seconds slower

With this plugin installed, directories that contain an .nvmrc file cause node to become very slow to start. Directories with a .node-version file are not affected.

$ echo "16.1.0" > .node-version
$ time node -v
v16.1.0

real	0m0.105s
user	0m0.038s
sys	0m0.042s
$ mv .node-version .nvmrc
$ time node -v
v16.1.0

real	0m2.109s
user	0m1.120s
sys	0m1.455s

So it seems that this plugin is making node 2 seconds slower to start.

I am using nodenv and nodev-nvmrc installed via homebrew on macOS 11.3.1 (x86_64).

$ nodenv --version
nodenv 1.4.0
$ brew info nodenv-nvmrc
nodenv/nodenv/nodenv-nvmrc: stable 1.0.5, HEAD
Pick a node version from .nvmrc
https://github.com/ouchxp/nodenv-nvmrc
/usr/local/Cellar/nodenv-nvmrc/1.0.5 (17 files, 29KB) *
  Built from source on 2021-05-13 at 17:16:04
From: https://github.com/nodenv/homebrew-nodenv/blob/HEAD/Formula/nodenv-nvmrc.rb
==> Dependencies
Required: nodenv โœ”
==> Options
--HEAD
	Install HEAD version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.