3 - nodejs_version: "0.10"
4 - nodejs_version: "0.12"
5 - nodejs_version: "1.8"
6 - nodejs_version: "2.5"
7 - nodejs_version: "3.3"
8 - nodejs_version: "4.9"
9 - nodejs_version: "5.12"
10 - nodejs_version: "6.17"
11 - nodejs_version: "7.10"
12 - nodejs_version: "8.17"
13 - nodejs_version: "9.11"
14 - nodejs_version: "10.24"
15 - nodejs_version: "11.15"
16 - nodejs_version: "12.22"
17 - nodejs_version: "13.14"
18 - nodejs_version: "14.18"
24 try { Install-Product node $env:nodejs_version -ErrorAction Stop }
25 catch { Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) }
28 npm config set loglevel error
29 npm config set shrinkwrap false
30 # Remove all non-test dependencies
32 # Remove example dependencies
33 npm rm --silent --save-dev connect-redis
34 # Remove lint dependencies
35 cmd.exe /c "node -pe `"Object.keys(require('./package').devDependencies).join('\n')`"" | `
36 sls "^eslint(-|$)" | `
37 %{ npm rm --silent --save-dev $_ }
38 # Setup Node.js version-specific dependencies
41 # - use 3.x for Node.js < 4
42 # - use 5.x for Node.js < 6
43 # - use 6.x for Node.js < 8
44 # - use 7.x for Node.js < 10
45 if ([int]$env:nodejs_version.split(".")[0] -lt 4) {
46 npm install --silent --save-dev mocha@3.5.3
47 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) {
48 npm install --silent --save-dev mocha@5.2.0
49 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 8) {
50 npm install --silent --save-dev mocha@6.2.2
51 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 10) {
52 npm install --silent --save-dev mocha@7.2.0
55 # supertest for http calls
56 # - use 2.0.0 for Node.js < 4
57 # - use 3.4.2 for Node.js < 6
58 if ([int]$env:nodejs_version.split(".")[0] -lt 4) {
59 npm install --silent --save-dev supertest@2.0.0
60 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) {
61 npm install --silent --save-dev supertest@3.4.2
63 # Update Node.js modules
65 # Prune & rebuild node_modules
66 if (Test-Path -Path node_modules) {
70 # Install Node.js modules