-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
27 lines (27 loc) · 877 Bytes
/
build.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
require('https')
.request('https://blueoakcouncil.org/copyleft.json')
.once('response', function (response) {
var chunks = []
response
.on('data', function (chunk) { chunks.push(chunk) })
.once('error', function (error) { throw error })
.once('end', function () {
var parsed = JSON.parse(Buffer.concat(chunks))
var output = {}
var families = parsed.families
Object.keys(families).forEach(function (key) {
var licenses = []
families[key].forEach(function (group) {
group.versions.forEach(function (version) {
version.name = group.name
licenses.push(version)
})
})
output[key] = licenses
})
require('fs').writeFileSync(
'index.json', JSON.stringify(output, null, 2)
)
})
})
.end()