-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.js
47 lines (43 loc) · 963 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const fs = require('fs')
const mustache = require('mustache')
const testFiles = fs.readdirSync('./tests/')
const template = fs.readFileSync('template.md').toString()
var data = {
status: [
{
name: 'Compatible',
href: '#compatible',
tests: []
},
{
name: 'Partially Compatible',
href: '#partially-compatible',
tests: []
},
{
name: 'Not Compatible',
href: '#not-compatible',
tests: []
}
],
}
for (file of testFiles) {
var json = JSON.parse(fs.readFileSync(`tests/${file}`).toString())
for (status of data.status) {
if (status.name == json.status) {
status.tests.push(json)
}
}
}
for (status of data.status) {
if (status.tests.length != 0) {
status.tests.sort((a, b) => {
var indexA = a.title.toUpperCase()
var indexB = b.title.toUpperCase()
if (indexA < indexB) { return -1 }
if (indexA > indexB) { return 1 }
return 0
})
}
}
fs.writeFileSync('README.md', mustache.render(template, data))