Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

updated to not change version if already using acceptable version #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

updated to not change version if already using acceptable version #9

wants to merge 4 commits into from

Conversation

nicholasxuu
Copy link

@nicholasxuu nicholasxuu commented May 7, 2018

Kind of annoying when it auto-change version regardless of the node version I'm already on.

This checks current node version with node -v, and won't update version if current version is already acceptable for project.

  • Note: nvm current doesn't work for this case, it will start with default node version with nvm.sh, thus nvm current will not reflect the current node version the terminal is currently on.

tested:

  • updated unit tests and all pass.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 0f40dae on nicholasxuu:feature-no-change-version-if-already-active into fd47799 on wbyoung:master.

@coveralls
Copy link

coveralls commented May 7, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling b95ff06 on nicholasxuu:feature-no-change-version-if-already-active into fd47799 on wbyoung:master.

@wbyoung
Copy link
Owner

wbyoung commented May 10, 2018

@nicholasxuu I like this idea and have had thoughts to make it happen in the past. The trouble is that there are various possibilities of where a version of node is installed, but more important, with which npm packages it's configured.

So let's say that the current version you have installed is 8.11.1, but that's provided by your OS at /usr/bin/node w/ npm looking for packages in /usr/local/lib/node_modules. If you also have the same version installed via n at /usr/local/n/bin/node and your packages are at /usr/local/n/lib/node_modules, then the right thing to do is to switch. (I haven't spent time looking at where npm installs things lately, so if the paths have changed, my bad, but the concept, I think still applies both for npm as well as yarn. Packages w/ binary compilation have to be tied to a specific version of node's libs, so this will likely always remain true.)

Perhaps it'd be best to make this an option that could be configured in ~/.avnrc w/ the default being to not switch (which seems like a sane default to me).

@nicholasxuu nicholasxuu changed the title updated to not change version if already using acceptable version WIP: updated to not change version if already using acceptable version May 16, 2018
@nicholasxuu nicholasxuu changed the title WIP: updated to not change version if already using acceptable version updated to not change version if already using acceptable version May 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants