nodeswitch 1.8.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,6 +33,7 @@ nodeswitch use default
33
33
  nodeswitch list
34
34
 
35
35
  nodeswitch path
36
+ nodeswitch pathopen
36
37
  ```
37
38
 
38
39
  #### How To Uninstall
@@ -33,7 +33,22 @@ if not "%1" == "" (
33
33
  curl -f https://nodejs.org/download/release/v%2 > nul 2>&1
34
34
  if %ERRORLEVEL% equ 0 (
35
35
  curl -s -o %AppData%\nodeswitch\%2.zip https://nodejs.org/download/release/v%2/node-v%2-win-x64.zip > nul
36
+
37
+ if not %ERRORLEVEL% equ 0 (
38
+ del %AppData%\nodeswitch\%2.zip
39
+ echo Node version not created
40
+ exit
41
+ )
42
+
36
43
  tar -xf %AppData%\nodeswitch\%2.zip -C %AppData%\nodeswitch
44
+
45
+ if not %ERRORLEVEL% equ 0 (
46
+ del %AppData%\nodeswitch\%2.zip
47
+ rd /s /q %AppData%\nodeswitch\node-v%2-win-x64
48
+ echo Node version not created
49
+ exit
50
+ )
51
+
37
52
  del %AppData%\nodeswitch\%2.zip
38
53
  move %AppData%\nodeswitch\node-v%2-win-x64 %AppData%\nodeswitch\%2 > nul
39
54
  ) else (
@@ -51,6 +66,8 @@ if not "%1" == "" (
51
66
  dir /b %AppData%\nodeswitch
52
67
  ) else if "%1" == "path" (
53
68
  echo %AppData%\nodeswitch
69
+ ) else if "%1" == "pathopen" (
70
+ powershell explorer "$(nodeswitch path)"
54
71
  ) else (
55
72
  echo Incorrect command
56
73
  )
@@ -34,7 +34,22 @@ if ( $nodeswitch1stParameter -ne $null ) {
34
34
  cmd /c "curl -f https://nodejs.org/download/release/v$nodeswitch2ndParameter > nul 2>&1"
35
35
  if ( $LASTEXITCODE -eq 0 ) {
36
36
  cmd /c "curl -s -o $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip https://nodejs.org/download/release/v$nodeswitch2ndParameter/node-v$nodeswitch2ndParameter-win-x64.zip > nul"
37
+
38
+ if ( $LASTEXITCODE -ne 0 ) {
39
+ del $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip
40
+ echo "Node version not created"
41
+ exit
42
+ }
43
+
37
44
  tar -xf $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip -C $env:AppData\nodeswitch
45
+
46
+ if ( $LASTEXITCODE -ne 0 ) {
47
+ del $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip
48
+ Remove-Item -Recurse $env:AppData\nodeswitch\node-v$nodeswitch2ndParameter-win-x64
49
+ echo "Node version not created"
50
+ exit
51
+ }
52
+
38
53
  del $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip
39
54
  cmd /c "move $env:AppData\nodeswitch\node-v$nodeswitch2ndParameter-win-x64 $env:AppData\nodeswitch\$nodeswitch2ndParameter > nul"
40
55
  } else {
@@ -52,6 +67,8 @@ if ( $nodeswitch1stParameter -ne $null ) {
52
67
  dir -n $env:AppData\nodeswitch
53
68
  } elseif ( $nodeswitch1stParameter -eq "path" ) {
54
69
  echo "$env:AppData\nodeswitch"
70
+ } elseif ( $nodeswitch1stParameter -eq "pathopen" ) {
71
+ explorer $(nodeswitch path)
55
72
  } else {
56
73
  echo "Incorrect command"
57
74
  }
package/bin/nodeswitch.sh CHANGED
@@ -44,7 +44,24 @@ then
44
44
  if [ $? -eq 0 ]
45
45
  then
46
46
  curl -s -o $APPDATA/nodeswitch/$2.zip https://nodejs.org/download/release/v$2/node-v$2-win-x64.zip > /dev/null
47
+
48
+ if [ $? -ne 0 ]
49
+ then
50
+ rm $APPDATA/nodeswitch/$2.zip
51
+ echo "Node version not created"
52
+ exit
53
+ fi
54
+
47
55
  unzip -d $APPDATA/nodeswitch -o $APPDATA/nodeswitch/$2.zip > /dev/null
56
+
57
+ if [ $? -ne 0 ]
58
+ then
59
+ rm $APPDATA/nodeswitch/$2.zip
60
+ rm -rf $APPDATA/nodeswitch/node-v$2-win-x64
61
+ echo "Node version not created"
62
+ exit
63
+ fi
64
+
48
65
  rm $APPDATA/nodeswitch/$2.zip
49
66
  mv $APPDATA/nodeswitch/node-v$2-win-x64 $APPDATA/nodeswitch/$2 > /dev/null
50
67
  else
@@ -64,6 +81,9 @@ then
64
81
  elif [ "$1" = "path" ]
65
82
  then
66
83
  echo "$APPDATA\nodeswitch"
84
+ elif [ "$1" = "pathopen" ]
85
+ then
86
+ start explorer $(nodeswitch path)
67
87
  else
68
88
  echo "Incorrect command"
69
89
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodeswitch",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "Node version switcher for Microsoft Windows x64",
5
5
  "scripts": {
6
6
  "preinstall": "node scripts/preinstall.js",