-
Notifications
You must be signed in to change notification settings - Fork 16
/
docs.js
40 lines (32 loc) · 876 Bytes
/
docs.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
'use strict';
const acquit = require('./lib');
const fs = require('fs');
// Website
const layout = require('./docs/layout');
const props = { version: require('./package').version };
const pages = [
{
path: 'index.html',
content: require('./docs/home')(props),
subtitle: 'Parse BDD tests to generate documentation'
},
{
path: 'docs/examples.html',
content: require('./docs/examples')(props),
subtitle: 'Examples'
},
{
path: 'docs/plugins.html',
content: require('./docs/plugins')(props),
subtitle: 'Plugins'
}
];
for (const page of pages) {
fs.writeFileSync(page.path, layout(Object.assign({}, props, page)));
}
// README
require('acquit-markdown')(acquit);
let md = fs.readFileSync('./HEADER.md');
md += '\n';
md += acquit.parse(fs.readFileSync('./test/main.test.js').toString());
fs.writeFileSync('./README.md', md);