X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=node%2Finstall.ps1;h=0d475fcec97dd8cd632766e79214676e4410e9aa;hb=a2bb4dba6b81e126884dfdf7028719edea78b974;hp=64a60969962e9d4a3b85f64072af1fda00ba3c65;hpb=681cccd4d5f2adb81470ee99ede927a6de896c3b;p=webi-installers%2F.git diff --git a/node/install.ps1 b/node/install.ps1 index 64a6096..0d475fc 100644 --- a/node/install.ps1 +++ b/node/install.ps1 @@ -1,5 +1,6 @@ -# Fetch archive +#!/usr/bin/env pwsh +# Fetch archive IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE")) { # TODO: arch detection @@ -17,14 +18,13 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERS # Enter opt pushd .local\tmp - echo "Remove leftover node-v* stuffs" + # Remove any leftover tmp cruft Remove-Item -Path "node-v*" -Recurse -ErrorAction Ignore # Unpack archive # Windows BSD-tar handles zip. Imagine that. echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" & tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" - Get-ChildItem "node-v*" # Settle unpacked archive into place echo "New Name: $Env:PKG_NAME-v$Env:WEBI_VERSION" @@ -36,12 +36,12 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERS popd } -echo "Versioning $Env:PKG_NAME" -Remove-Item -Path "$Env:USERPROFILE\.local\opt\node" -Recurse -ErrorAction Ignore +echo "Copying into '$Env:USERPROFILE\.local\opt\$Env:PKG_NAME' from '$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION'" +Remove-Item -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME" -Recurse -ErrorAction Ignore Copy-Item -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION" -Destination "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME" -Recurse # make npm not act stupid about which node to use... ugh (this should be the default) & .\.local\opt\node\npm.cmd --scripts-prepend-node-path=true config set scripts-prepend-node-path true # Add to path -& "$Env:USERPROFILE\.local\bin\pathman.exe" add .local\opt\node +& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/opt/node