mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-30 00:45:49 +08:00
[New] maybe support Windows with WSL, MSYS, Cygwin
This commit is contained in:
committed by
Jordan Harband
parent
d118be8fd4
commit
f2582275f6
@@ -13,4 +13,10 @@ die () { echo "$@" ; cleanup ; exit 1; }
|
||||
# nvm_get_artifact_compression with xz
|
||||
[ "$(nvm_get_artifact_compression "14.0.0")" = 'tar.xz' ] || die 'nvm_get_artifact_compression should return "tar.xz" for this version'
|
||||
|
||||
# nvm_get_artifact_compression with zip on Windows
|
||||
nvm_get_os() {
|
||||
nvm_echo 'win'
|
||||
}
|
||||
[ "$(nvm_get_artifact_compression)" = 'zip' ] || die 'nvm_get_artifact_compression should return "zip" for Windows'
|
||||
|
||||
cleanup
|
||||
|
||||
@@ -43,6 +43,9 @@ if [ -z "$NVM_DIR" ] || [ -z "$tmp_dir" ]; then
|
||||
die 'Unable to create temporary folder'
|
||||
fi
|
||||
|
||||
# Test windows zip
|
||||
test_archi 'win' 'v15.6.0' 'x64' 'node' 'zip' 'zip' '-qr'
|
||||
|
||||
# Test linux tar.xz
|
||||
test_archi 'linux' 'v14.15.4' 'x64' 'bin/node' 'tar.xz' 'tar' '-cJf'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
cleanup () {
|
||||
rm -rf "$NVM_DIR"
|
||||
unset -f die cleanup check_version
|
||||
unset -f die cleanup nvm_get_os check_version
|
||||
unset NVM_DIR NODE_PATH
|
||||
}
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
@@ -44,4 +44,11 @@ type nvm_is_version_installed > /dev/null 2>&1 || die 'nvm_is_version_installed
|
||||
|
||||
check_version '12.0.0' 'node'
|
||||
|
||||
# Checking for Windows
|
||||
nvm_get_os() {
|
||||
echo "win"
|
||||
}
|
||||
check_version '13.0.0' 'node.exe'
|
||||
|
||||
|
||||
cleanup
|
||||
|
||||
Reference in New Issue
Block a user