This repository has been archived by the owner on Apr 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
update-nodejs-versions.js
executable file
·76 lines (68 loc) · 1.74 KB
/
update-nodejs-versions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /usr/bin/env node
const fs = require('fs')
console.log('Updating Node.js versions')
const versions = [
'8.7.0',
'8.8.0',
'8.8.1',
'8.9.0',
'8.9.1',
'8.9.2',
'8.9.3',
'8.9.4',
'8.10.0',
'8.11.0',
'8.11.1',
'8.11.2',
'8.11.3',
'9.0.0',
'9.1.0',
'9.2.0',
'9.2.1',
'9.3.0',
'9.4.0',
'9.5.0',
'9.6.0',
'9.6.1',
'9.7.0',
'9.7.1',
'9.8.0',
'9.9.0',
'9.10.0',
'9.10.1',
'9.11.0',
'9.11.1',
'10.0.0',
'10.1.0',
'10.4.1'
]
const getVersionXML = (version) => {
return ` <jenkins.plugins.nodejs.tools.NodeJSInstallation>
<name>${version}</name>
<properties>
<hudson.tools.InstallSourceProperty>
<installers>
<jenkins.plugins.nodejs.tools.NodeJSInstaller>
<id>${version}</id>
<npmPackagesRefreshHours>72</npmPackagesRefreshHours>
</jenkins.plugins.nodejs.tools.NodeJSInstaller>
</installers>
</hudson.tools.InstallSourceProperty>
</properties>
</jenkins.plugins.nodejs.tools.NodeJSInstallation>
`
}
const fileHeader = `<?xml version='1.0' encoding='UTF-8'?>
<jenkins.plugins.nodejs.tools.NodeJSInstallation_-DescriptorImpl plugin="nodejs@1.2.4">
<installations class="jenkins.plugins.nodejs.tools.NodeJSInstallation-array">
`
const fileFooter = ` </installations>
</jenkins.plugins.nodejs.tools.NodeJSInstallation_-DescriptorImpl>`
let finalFile = ''
finalFile = finalFile + fileHeader
versions.forEach((version) => {
finalFile = finalFile + getVersionXML(version)
})
finalFile = finalFile + fileFooter
fs.writeFileSync('./config/jenkins.plugins.nodejs.tools.NodeJSInstallation.xml', finalFile)
console.log('Wrote Node.js versions to ./config/jenkins.plugins.nodejs.tools.NodeJSInstallation.xml')