nodeswitch 1.8.0 → 1.9.0

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.
@@ -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 (
@@ -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 {
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodeswitch",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Node version switcher for Microsoft Windows x64",
5
5
  "scripts": {
6
6
  "preinstall": "node scripts/preinstall.js",