@@ -12,42 +12,9 @@ export const getNodeDownloadSnippet = (release: NodeRelease, os: UserOS) => {
12
12
CHOCO : '' ,
13
13
} ;
14
14
15
- if ( os === 'LINUX' || os === 'MAC' ) {
16
- snippets . NVM = dedent `
17
- # installs NVM (Node Version Manager)
18
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
19
-
20
- # download and install Node.js
21
- nvm install ${ release . major }
22
-
23
- # verifies the right Node.js version is in the environment
24
- node -v # should print \`${ release . versionWithPrefix } \`
25
-
26
- # verifies the right NPM version is in the environment
27
- npm -v # should print \`${ release . npm } \`` ;
28
-
29
- snippets . BREW = dedent `
30
- # download and installs Homebrew (macOS/Linux Package Manager)
31
- curl -o- https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
32
-
33
- # download and install Node.js
34
- brew install node@${ release . major }
35
-
36
- # verifies the right Node.js version is in the environment
37
- node -v # should print \`${ release . versionWithPrefix } \`
38
-
39
- # verifies the right NPM version is in the environment
40
- npm -v # should print \`${ release . npm } \`` ;
41
- }
42
-
43
- if ( os === 'MAC' ) {
44
- snippets . DOCKER = dedent `
45
- # installs Homebrew (macOS/Linux Package Manager)
46
- curl -o- https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
47
-
48
- # installs Docker Desktop
49
- brew install docker --cask
50
-
15
+ switch ( true ) {
16
+ case os === 'WIN' || os === 'MAC' || os === 'LINUX' :
17
+ snippets . DOCKER = dedent `
51
18
# pulls the Node.js Docker image
52
19
docker pull node:${ release . major } -${ release . major >= 4 ? 'alpine' : 'slim' }
53
20
@@ -56,41 +23,44 @@ export const getNodeDownloadSnippet = (release: NodeRelease, os: UserOS) => {
56
23
57
24
# verifies the right NPM version is in the environment
58
25
docker run node:${ release . major } -${ release . major >= 4 ? 'alpine' : 'slim' } npm -v # should print \`${ release . npm } \`` ;
59
- }
26
+ // eslint-disable-next-line no-fallthrough
27
+ case os === 'MAC' || os === 'LINUX' :
28
+ snippets . NVM = dedent `
29
+ # installs NVM (Node Version Manager)
30
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
60
31
61
- if ( os === 'WIN' ) {
62
- snippets . CHOCO = dedent `
63
- # installs Chocolatey (Windows Package Manager)
64
- Set-ExecutionPolicy Bypass -Scope Process -Force;
65
- [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
66
- iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
32
+ # download and install Node.js
33
+ nvm install ${ release . major }
67
34
68
- # download and install Node.js
69
- choco install nodejs --version=" ${ release . version } "
35
+ # verifies the right Node.js version is in the environment
36
+ node -v # should print \` ${ release . versionWithPrefix } \`
70
37
71
- # verifies the right Node.js version is in the environment
72
- node -v # should print \`${ release . versionWithPrefix } \`
38
+ # verifies the right NPM version is in the environment
39
+ npm -v # should print \`${ release . npm } \`` ;
73
40
74
- # verifies the right NPM version is in the environment
75
- npm -v # should print \`${ release . npm } \`` ;
41
+ snippets . BREW = dedent `
42
+ # download and install Node.js
43
+ brew install node@${ release . major }
76
44
77
- snippets . DOCKER = dedent `
78
- # installs Chocolatey (Windows Package Manager)
79
- Set-ExecutionPolicy Bypass -Scope Process -Force;
80
- [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
81
- iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
45
+ # verifies the right Node.js version is in the environment
46
+ node -v # should print \`${ release . versionWithPrefix } \`
82
47
83
- # installs Docker Desktop
84
- choco install docker-desktop
85
-
86
- # pulls the Node.js Docker image
87
- docker pull node:${ release . major } -${ release . major >= 4 ? 'alpine' : 'slim' }
48
+ # verifies the right NPM version is in the environment
49
+ npm -v # should print \`${ release . npm } \`` ;
50
+ // eslint-disable-next-line no-fallthrough
51
+ case os === 'WIN' :
52
+ snippets . CHOCO = dedent `
53
+ # download and install Node.js
54
+ choco install nodejs${ release . isLts ? '-lts' : '' } --version="${ release . version } "
88
55
89
56
# verifies the right Node.js version is in the environment
90
- docker run node: ${ release . major } - ${ release . major >= 4 ? 'alpine' : 'slim' } node -v # should print \`${ release . versionWithPrefix } \`
57
+ node -v # should print \`${ release . versionWithPrefix } \`
91
58
92
59
# verifies the right NPM version is in the environment
93
- docker run node:${ release . major } -${ release . major >= 4 ? 'alpine' : 'slim' } npm -v # should print \`${ release . npm } \`` ;
60
+ npm -v # should print \`${ release . npm } \`` ;
61
+ // eslint-disable-next-line no-fallthrough
62
+ default :
63
+ break ;
94
64
}
95
65
96
66
return snippets ;
0 commit comments