@@ -12,42 +12,9 @@ export const getNodeDownloadSnippet = (release: NodeRelease, os: UserOS) => {
1212 CHOCO : '' ,
1313 } ;
1414
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 `
5118 # pulls the Node.js Docker image
5219 docker pull node:${ release . major } -${ release . major >= 4 ? 'alpine' : 'slim' }
5320
@@ -56,41 +23,44 @@ export const getNodeDownloadSnippet = (release: NodeRelease, os: UserOS) => {
5623
5724 # verifies the right NPM version is in the environment
5825 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
6031
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 }
6734
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 } \`
7037
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 } \`` ;
7340
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 }
7644
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 } \`
8247
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 } "
8855
8956 # 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 } \`
9158
9259 # 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 ;
9464 }
9565
9666 return snippets ;
0 commit comments