Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how it works #3

Open
luxzeitlos opened this issue Aug 9, 2018 · 5 comments
Open

Document how it works #3

luxzeitlos opened this issue Aug 9, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@luxzeitlos
Copy link

nvm can be quite annoying because it hooks deep into the shell. I've used nodenv so far on *nix, and I really like how transparent the functionality is.
The usage of shims means I dont need any setup code that slows down my shell boot, or any hooks into my shell. I just need to nodenv rehash when I install a new global binary the first time. This especially also makes it compatible with exotic shells like fish.

I would love if nn could become a unified solution that would also work on windows (the one think I dont have with nodenv).

However for now its very unclear how nn handles switching global binaries. Does it manipulate the PATH or does it use something like shims?

@pd4d10
Copy link
Owner

pd4d10 commented Aug 9, 2018

@luxferresum In brief, nn add PATH once at installation. It does not change PATH when using it.

The PATH added are:

  • ~/.nn/bin: executable is placed here, which is nn(for Linux, macOS) or nn.exe(for Windows)
  • ~/.nn/current: A soft link(for Linux, macOS) or junction(for Windows) which points to active version

See install.sh and install.ps1 for more details.

Thanks for your suggestion. Any idea or pull request is welcome.

@luxzeitlos
Copy link
Author

Thanks for clarification. I just realised that nn is far simpler because it does not allow local or shell specific installations. Do you want to keep it that way?

@pd4d10
Copy link
Owner

pd4d10 commented Aug 10, 2018

@luxferresum Do you mean manual installation? Just do the following steps:

  • Download the correct binary from release, rename it to nn(for macOS and Linux) or nn.exe(for Windows)
  • Create a dir named ~/.nn/bin and place the binary downloaded in step 1 to this dir
  • Add path

The install script just did these things. It will detect the default shell, then add PATH to it. For now only zsh and bash are handled.

Maybe we should add a section in README for users who use other shell like fish

@luxzeitlos
Copy link
Author

Thanks! Yes, documentation for manual installation would be nice.

And no, my question was about shell-specific or local node versions.
nvm has the .nvmrc, nodenv the .node-version. Both allow shell specific node versions, or even to specify a node version per folder.
This is not possible with nn. However this seems to be the reason that nn is so simple; it can just guarantee that ~/.nn/current contains the right files. However with this approach you cant support local versions. So I was asking if you plan to keep it that way and not to support local versions?

@pd4d10
Copy link
Owner

pd4d10 commented Aug 11, 2018

It's an interesting point. Seems they dynamically change PATH for every shell instance, while nn just use soft link. So if you run nn use 10.8.0, all shell instances will have 10.8.0 activated because they all point to current soft link.

Seems Nodenv's shims is a reasonable resolution. We'll investigate pros and cons of using such a mechanism

@pd4d10 pd4d10 added the enhancement New feature or request label Aug 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants