nodeswitch 1.6.1 → 1.6.2

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.
Files changed (2) hide show
  1. package/bin/nodeswitch.sh +51 -44
  2. package/package.json +1 -1
package/bin/nodeswitch.sh CHANGED
@@ -1,62 +1,69 @@
1
- if [ "$#" = "2" ]
1
+ if [ "$1" != "" ]
2
2
  then
3
- if [ "$1" = "remove" ]
3
+ if [ "$2" != "" ]
4
4
  then
5
- if [ -d "$APPDATA/nodeswitch/$2" ]
5
+ if [ "$3" != "" ]
6
6
  then
7
- rm -rf $APPDATA/nodeswitch/$2
7
+ echo "Incorrect command"
8
8
  else
9
- echo "Node version not installed"
10
- fi
11
- elif [ "$1" = "use" ]
12
- then
13
- if [ "$2" = "default" ]
14
- then
15
- if [ ! -z "$nodeswitchDefaultPATH" ]
9
+ if [ "$1" = "remove" ]
16
10
  then
17
- export PATH=$nodeswitchDefaultPATH
18
- fi
19
- else
20
- if [ -d "$APPDATA/nodeswitch/$2" ]
11
+ if [ -d "$APPDATA/nodeswitch/$2" ]
12
+ then
13
+ rm -rf $APPDATA/nodeswitch/$2
14
+ else
15
+ echo "Node version not installed"
16
+ fi
17
+ elif [ "$1" = "use" ]
18
+ then
19
+ if [ "$2" = "default" ]
20
+ then
21
+ if [ ! -z "$nodeswitchDefaultPATH" ]
22
+ then
23
+ export PATH=$nodeswitchDefaultPATH
24
+ fi
25
+ else
26
+ if [ -d "$APPDATA/nodeswitch/$2" ]
27
+ then
28
+ if [ -z "$nodeswitchDefaultPATH" ]
29
+ then
30
+ export nodeswitchDefaultPATH=$PATH
31
+ export PATH=$APPDATA/nodeswitch/$2:$PATH
32
+ else
33
+ export PATH=$APPDATA/nodeswitch/$2:$nodeswitchDefaultPATH
34
+ fi
35
+ else
36
+ echo "Node version not installed"
37
+ fi
38
+ fi
39
+ elif [ "$1" = "add" ]
21
40
  then
22
- if [ -z "$nodeswitchDefaultPATH" ]
41
+ if [ ! -d "$APPDATA/nodeswitch/$2" ]
23
42
  then
24
- export nodeswitchDefaultPATH=$PATH
25
- export PATH=$APPDATA/nodeswitch/$2:$PATH
43
+ curl -f https://nodejs.org/download/release/v$2 &>/dev/null
44
+ if [ $? -eq 0 ]
45
+ then
46
+ curl -s -o $APPDATA/nodeswitch/$2.zip https://nodejs.org/download/release/v$2/node-v$2-win-x64.zip > /dev/null
47
+ unzip -d $APPDATA/nodeswitch -o $APPDATA/nodeswitch/$2.zip > /dev/null
48
+ rm $APPDATA/nodeswitch/$2.zip
49
+ mv $APPDATA/nodeswitch/node-v$2-win-x64 $APPDATA/nodeswitch/$2 > /dev/null
50
+ else
51
+ echo "Node version not found"
52
+ fi
26
53
  else
27
- export PATH=$APPDATA/nodeswitch/$2:$nodeswitchDefaultPATH
54
+ echo "Node version already added"
28
55
  fi
29
56
  else
30
- echo "Node version not installed"
57
+ echo "Incorrect command"
31
58
  fi
32
59
  fi
33
- elif [ "$1" = "add" ]
34
- then
35
- if [ ! -d "$APPDATA/nodeswitch/$2" ]
60
+ else
61
+ if [ "$1" = "list" ]
36
62
  then
37
- curl -f https://nodejs.org/download/release/v$2 &>/dev/null
38
- if [ $? -eq 0 ]
39
- then
40
- curl -s -o $APPDATA/nodeswitch/$2.zip https://nodejs.org/download/release/v$2/node-v$2-win-x64.zip > /dev/null
41
- unzip -d $APPDATA/nodeswitch -o $APPDATA/nodeswitch/$2.zip > /dev/null
42
- rm $APPDATA/nodeswitch/$2.zip
43
- mv $APPDATA/nodeswitch/node-v$2-win-x64 $APPDATA/nodeswitch/$2 > /dev/null
44
- else
45
- echo "Node version not found"
46
- fi
63
+ dir -1 $APPDATA/nodeswitch
47
64
  else
48
- echo "Node version already added"
65
+ echo "Incorrect command"
49
66
  fi
50
- else
51
- echo "Incorrect command"
52
- fi
53
- elif [ "$#" = "1" ]
54
- then
55
- if [ "$1" = "list" ]
56
- then
57
- dir $APPDATA/nodeswitch
58
- else
59
- echo "Incorrect command"
60
67
  fi
61
68
  else
62
69
  echo "Incorrect command"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodeswitch",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Node version switcher for Microsoft Windows x64",
5
5
  "scripts": {
6
6
  "preinstall": "node scripts/preinstall.js",