isaacs / nave

Virtual Environments for Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After run `nave use x.x.x` output node and npm versions.

rogeriotaques opened this issue · comments

This's not an issue but a suggestions instead.

It will be really useful if we could have nave outputting the node and npm versions after complete any command that changes current version of these.

I recommend putting $NAVE in your $PS1 environment variable or $PROMPT_COMMAND. Here's what I use, with node -v when $NAVE is unset, so that nave shells show the node version in a different color: https://github.com/isaacs/dotfiles/blob/master/.extra.bashrc#L766-L787 Here's what it looks like:

screenshot 2017-02-02 22 32 49

It's very noisy to have nave print the version every time you enter or exit a shell, and can disrupt scripts that use it. It used to do this, but it was changed.

Another option, you could create a file at ~/.naverc with this in it:

# ~/.naverc
echo node@$(node -v)
echo npm@$(npm -v)

and then it'll print out every time you enter a nave environment.

@isaacs,
Thank you for that.
Let me try it and come back to you later.

@isaacs your suggestion has worked like a charm! Thanks.

Just FYI, check what my ~/.naverc looks like:

# Displays NODE and NPM version always NAVE changes it.
echo node@$(node -v)/ npm@$(npm -v)

It outputs the following, where 0.0.0 is the current versions.

$ node@v0.0.0/ npm@0.0.0