nodeswitch 1.7.0 → 1.8.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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 alexsch01
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 alexsch01
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,45 +1,47 @@
1
- # nodeswitch
2
-
3
- Node version switcher for Microsoft Windows x64
4
-
5
- https://github.com/alexsch01/nodeswitch
6
-
7
- <br>
8
-
9
- #### How To Install
10
-
11
- ```
12
- npm install -g nodeswitch
13
-
14
- *****
15
- Node versions installed by this tool are in the "C:\Users\YOUR_USERNAME\AppData\Roaming\nodeswitch" folder
16
- *****
17
- ```
18
-
19
- #### Examples
20
-
21
- ```
22
- nodeswitch add 12.16.3
23
- nodeswitch add 18.13.0
24
-
25
- nodeswitch remove 12.16.3
26
- nodeswitch remove 18.13.0
27
-
28
- nodeswitch use 12.16.3
29
- nodeswitch use 18.13.0
30
-
31
- nodeswitch use default
32
-
33
- nodeswitch list
34
- ```
35
-
36
- #### How To Uninstall
37
-
38
- ```
39
- npm uninstall -g nodeswitch
40
-
41
- *****
42
- In the "C:\Users\YOUR_USERNAME\AppData\Roaming\npm" folder, delete 4 files: nodeswitch, nodeswitch.cmd, nodeswitch.ps1, and nodeswitch.sh
43
- In the "C:\Users\YOUR_USERNAME\.bash_profile" file, remove the line [alias nodeswitch="source nodeswitch"]
44
- *****
45
- ```
1
+ # nodeswitch
2
+
3
+ Node version switcher for Microsoft Windows x64
4
+
5
+ https://github.com/alexsch01/nodeswitch
6
+
7
+ <br>
8
+
9
+ #### How To Install
10
+
11
+ ```
12
+ npm install -g nodeswitch
13
+
14
+ *****
15
+ Node versions installed by this tool are in the "C:\Users\YOUR_USERNAME\AppData\Roaming\nodeswitch" folder
16
+ *****
17
+ ```
18
+
19
+ #### Examples
20
+
21
+ ```
22
+ nodeswitch add 12.16.3
23
+ nodeswitch add 18.13.0
24
+
25
+ nodeswitch remove 12.16.3
26
+ nodeswitch remove 18.13.0
27
+
28
+ nodeswitch use 12.16.3
29
+ nodeswitch use 18.13.0
30
+
31
+ nodeswitch use default
32
+
33
+ nodeswitch list
34
+
35
+ nodeswitch path
36
+ ```
37
+
38
+ #### How To Uninstall
39
+
40
+ ```
41
+ npm uninstall -g nodeswitch
42
+
43
+ *****
44
+ In the "C:\Users\YOUR_USERNAME\AppData\Roaming\npm" folder, delete 4 files: nodeswitch, nodeswitch.cmd, nodeswitch.ps1, and nodeswitch.sh
45
+ In the "C:\Users\YOUR_USERNAME\.bash_profile" file, remove the line [alias nodeswitch="source nodeswitch"]
46
+ *****
47
+ ```
package/bin/nodeswitch CHANGED
@@ -1 +1 @@
1
- (return 0 2>/dev/null) && source nodeswitch.sh "$@" || echo "You need to relaunch Git Bash in order to use nodeswitch"
1
+ (return 0 2>/dev/null) && source nodeswitch.sh "$@" || echo "You need to relaunch Git Bash in order to use nodeswitch"
@@ -49,6 +49,8 @@ if not "%1" == "" (
49
49
  ) else (
50
50
  if "%1" == "list" (
51
51
  dir /b %AppData%\nodeswitch
52
+ ) else if "%1" == "path" (
53
+ echo %AppData%\nodeswitch
52
54
  ) else (
53
55
  echo Incorrect command
54
56
  )
@@ -1,59 +1,61 @@
1
- $nodeswitch1stParameter = $args[0]
2
- $nodeswitch2ndParameter = $args[1]
3
-
4
- if ( $nodeswitch1stParameter -ne $null ) {
5
- if ( $nodeswitch2ndParameter -ne $null ) {
6
- if ( $args[2] -ne $null ) {
7
- echo "Incorrect command"
8
- } else {
9
- if ( $nodeswitch1stParameter -eq "remove" ) {
10
- if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
11
- Remove-Item -Recurse $env:AppData\nodeswitch\$nodeswitch2ndParameter
12
- } else {
13
- echo "Node version not installed"
14
- }
15
- } elseif ( $nodeswitch1stParameter -eq "use" ) {
16
- if ( $nodeswitch2ndParameter -eq "default" ) {
17
- if ( $global:nodeswitchDefaultPATH -ne $null ) {
18
- $env:Path = $global:nodeswitchDefaultPATH
19
- }
20
- } else {
21
- if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
22
- if ( $global:nodeswitchDefaultPATH -eq $null ) {
23
- $global:nodeswitchDefaultPATH = $env:Path
24
- $env:Path = "$env:AppData\nodeswitch\$nodeswitch2ndParameter;$env:Path"
25
- } else {
26
- $env:Path = "$env:AppData\nodeswitch\$nodeswitch2ndParameter;$global:nodeswitchDefaultPATH"
27
- }
28
- } else {
29
- echo "Node version not installed"
30
- }
31
- }
32
- } elseif ( $nodeswitch1stParameter -eq "add" ) {
33
- if ( -not ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) ) {
34
- cmd /c "curl -f https://nodejs.org/download/release/v$nodeswitch2ndParameter > nul 2>&1"
35
- if ( $LASTEXITCODE -eq 0 ) {
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
- tar -xf $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip -C $env:AppData\nodeswitch
38
- del $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip
39
- cmd /c "move $env:AppData\nodeswitch\node-v$nodeswitch2ndParameter-win-x64 $env:AppData\nodeswitch\$nodeswitch2ndParameter > nul"
40
- } else {
41
- echo "Node version not found"
42
- }
43
- } else {
44
- echo "Node version already added"
45
- }
46
- } else {
47
- echo "Incorrect command"
48
- }
49
- }
50
- } else {
51
- if ( $nodeswitch1stParameter -eq "list" ) {
52
- dir -n $env:AppData\nodeswitch
53
- } else {
54
- echo "Incorrect command"
55
- }
56
- }
57
- } else {
58
- echo "Incorrect command"
59
- }
1
+ $nodeswitch1stParameter = $args[0]
2
+ $nodeswitch2ndParameter = $args[1]
3
+
4
+ if ( $nodeswitch1stParameter -ne $null ) {
5
+ if ( $nodeswitch2ndParameter -ne $null ) {
6
+ if ( $args[2] -ne $null ) {
7
+ echo "Incorrect command"
8
+ } else {
9
+ if ( $nodeswitch1stParameter -eq "remove" ) {
10
+ if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
11
+ Remove-Item -Recurse $env:AppData\nodeswitch\$nodeswitch2ndParameter
12
+ } else {
13
+ echo "Node version not installed"
14
+ }
15
+ } elseif ( $nodeswitch1stParameter -eq "use" ) {
16
+ if ( $nodeswitch2ndParameter -eq "default" ) {
17
+ if ( $global:nodeswitchDefaultPATH -ne $null ) {
18
+ $env:Path = $global:nodeswitchDefaultPATH
19
+ }
20
+ } else {
21
+ if ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) {
22
+ if ( $global:nodeswitchDefaultPATH -eq $null ) {
23
+ $global:nodeswitchDefaultPATH = $env:Path
24
+ $env:Path = "$env:AppData\nodeswitch\$nodeswitch2ndParameter;$env:Path"
25
+ } else {
26
+ $env:Path = "$env:AppData\nodeswitch\$nodeswitch2ndParameter;$global:nodeswitchDefaultPATH"
27
+ }
28
+ } else {
29
+ echo "Node version not installed"
30
+ }
31
+ }
32
+ } elseif ( $nodeswitch1stParameter -eq "add" ) {
33
+ if ( -not ( Test-Path -Path $env:AppData\nodeswitch\$nodeswitch2ndParameter ) ) {
34
+ cmd /c "curl -f https://nodejs.org/download/release/v$nodeswitch2ndParameter > nul 2>&1"
35
+ if ( $LASTEXITCODE -eq 0 ) {
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
+ tar -xf $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip -C $env:AppData\nodeswitch
38
+ del $env:AppData\nodeswitch\$nodeswitch2ndParameter.zip
39
+ cmd /c "move $env:AppData\nodeswitch\node-v$nodeswitch2ndParameter-win-x64 $env:AppData\nodeswitch\$nodeswitch2ndParameter > nul"
40
+ } else {
41
+ echo "Node version not found"
42
+ }
43
+ } else {
44
+ echo "Node version already added"
45
+ }
46
+ } else {
47
+ echo "Incorrect command"
48
+ }
49
+ }
50
+ } else {
51
+ if ( $nodeswitch1stParameter -eq "list" ) {
52
+ dir -n $env:AppData\nodeswitch
53
+ } elseif ( $nodeswitch1stParameter -eq "path" ) {
54
+ echo "$env:AppData\nodeswitch"
55
+ } else {
56
+ echo "Incorrect command"
57
+ }
58
+ }
59
+ } else {
60
+ echo "Incorrect command"
61
+ }
package/bin/nodeswitch.sh CHANGED
@@ -1,70 +1,73 @@
1
- if [ "$1" != "" ]
2
- then
3
- if [ "$2" != "" ]
4
- then
5
- if [ "$3" != "" ]
6
- then
7
- echo "Incorrect command"
8
- else
9
- if [ "$1" = "remove" ]
10
- then
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" ]
40
- then
41
- if [ ! -d "$APPDATA/nodeswitch/$2" ]
42
- then
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
53
- else
54
- echo "Node version already added"
55
- fi
56
- else
57
- echo "Incorrect command"
58
- fi
59
- fi
60
- else
61
- if [ "$1" = "list" ]
62
- then
63
- dir -1 $APPDATA/nodeswitch
64
- else
65
- echo "Incorrect command"
66
- fi
67
- fi
68
- else
69
- echo "Incorrect command"
70
- fi
1
+ if [ "$1" != "" ]
2
+ then
3
+ if [ "$2" != "" ]
4
+ then
5
+ if [ "$3" != "" ]
6
+ then
7
+ echo "Incorrect command"
8
+ else
9
+ if [ "$1" = "remove" ]
10
+ then
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" ]
40
+ then
41
+ if [ ! -d "$APPDATA/nodeswitch/$2" ]
42
+ then
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
53
+ else
54
+ echo "Node version already added"
55
+ fi
56
+ else
57
+ echo "Incorrect command"
58
+ fi
59
+ fi
60
+ else
61
+ if [ "$1" = "list" ]
62
+ then
63
+ dir -1 $APPDATA/nodeswitch
64
+ elif [ "$1" = "path" ]
65
+ then
66
+ echo "$APPDATA\nodeswitch"
67
+ else
68
+ echo "Incorrect command"
69
+ fi
70
+ fi
71
+ else
72
+ echo "Incorrect command"
73
+ fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodeswitch",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Node version switcher for Microsoft Windows x64",
5
5
  "scripts": {
6
6
  "preinstall": "node scripts/preinstall.js",