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

Add powershell script for installation on windows #1018

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

Conversation

Yakiyo
Copy link

@Yakiyo Yakiyo commented Jul 26, 2023

This adds a powershell script for installing fnm on windows. The ps script tries to follow the bash script as much as possible. Supported flags are:

  • -version | -v for setting version (string)
  • -skipShell | -s for skipping shell setup (bool)
  • -installDir for setting installation dir (string)

Using only one - seems odd to me but thats how powershell parses arguments. As far as i've tested, it even works with only the first argument too, as in -version, -v and -V all do the same thing.

To install fnm via the script, users would do

$ irm url/to/the/script | iex

The bash script uses the install endpoint, the ps script could do ig https://fnm.vercel.app/install.ps or something.

I've tested the script a few times and ensured that it works.

@changeset-bot
Copy link

changeset-bot bot commented Jul 26, 2023

⚠️ No Changeset found

Latest commit: 311976c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Schniz
Copy link
Owner

Schniz commented Aug 21, 2023

First of all, I'd like to thank you for the time and effort and making the hard thing possible and contributing!

However, in my opinion, any installation script is a toll and out of this project scope, and I originally built the installation script to ease the installation process and it only makes sense for Linux nowadays. Since Windows has WinGet baked in as a standard installation mechanism, I don't really see the point in having a custom PowerShell installer. Do you? can you please explain why should we have an installation script and not offload to WinGet?

@Yakiyo
Copy link
Author

Yakiyo commented Aug 22, 2023

ig stuff like scoop and winget does exist which allows people to install fnm. But i dont think everyone uses them. Winget is certainly popular but its yet to be used by everyone, while powershell is always there in windows and a one liner script can just be used to quickly do installations. package managers are great but you wouldnt install one just to get a single app. the script itself wasnt much work, if u wanna use it, sure. if not then its all good.
tldr theres no disadvantages but nor too many advantages either. good when u need it done quick, thats all.

@beegotsy
Copy link

beegotsy commented Jan 2, 2024

can you please explain why should we have an installation script and not offload to WinGet?

Hi @Yakiyo, I would like to install fnm under %HOMEPATH%/.fnm and node versions under %HOMEPATH%/.fnm/versions (or something like that). -installDir would allow me to do that, but winget doesn't.

Also, since the bash script install fnm under $HOME/.fnm I don't understand why on Windows in installed under %APPDATA%/fnm.
It should be, by default, under %HOMEPATH%/.fnm.
The homepath approach is an approach also used by pyenv-win.

Am I missing something?

@alexeyten
Copy link
Contributor

Also, since the bash script install fnm under $HOME/.fnm I don't understand why on Windows in installed under %APPDATA%/fnm. It should be, by default, under %HOMEPATH%/.fnm. The homepath approach is an approach also used by pyenv-win.

Actually default was changed a while ago and now bash script prefers $XDG_DATA_HOME/fnm (which is roughly an equivalent to %APPDATA%/fnm) for fresh installations. It uses $HOME/.fnm for backward compatibility only if the directory already exists.

See https://github.com/Schniz/fnm/blob/master/.ci/install.sh#L8-L16

@beegotsy
Copy link

beegotsy commented Jan 3, 2024

Actually default was changed a while ago and now bash script prefers $XDG_DATA_HOME/fnm (which is roughly an equivalent to %APPDATA%/fnm) for fresh installations.

Okay, now it is clear; I based my previous sentence on the README file without opening the actual scripts.
Thanks for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants