-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrunok.js
executable file
·68 lines (62 loc) · 1.97 KB
/
runok.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
#!/usr/bin/env node
const fs = require('fs');
const { runok, stopOnFail, chdir, tasks: { exec, npx, git, copy, writeToFile } } = require('runok');
module.exports = {
async update() {
stopOnFail(false);
const dir = 'website';
if (!fs.existsSync(dir)) {
await git((fn) => {
fn.cloneShallow('-b 3.x [email protected]:codeceptjs/codeceptjs.git', dir);
});
}
await chdir(dir, async () => {
await git(fn => {
fn.pull();
});
});
await copy('website/docs/', 'docs');
await exec('rm -rf docs/api'); // disabling api at this point
writeToFile('docs/docker.md', (cfg) => {
cfg.line('---');
cfg.line('permalink: /docker');
cfg.line('layout: Section');
cfg.line('sidebar: false');
cfg.line('title: Docker');
cfg.line('editLink: false');
cfg.line('---');
cfg.line('');
cfg.textFromFile('website/docker/README.md');
});
writeToFile('docs/changelog.md', (cfg) => {
cfg.line('---');
cfg.line('permalink: /changelog');
cfg.line('sidebar: false');
cfg.line('title: Releases');
cfg.line('editLink: false');
cfg.line('---');
cfg.line('');
cfg.textFromFile('website/CHANGELOG.md');
});
},
async serve() {
await npx('vuepress dev docs');
},
async publish() {
await exec('npm i');
await npx('vuepress build docs');
await chdir('docs/.vuepress/dist', async () => {
writeToFile('CNAME', cfg => cfg.line('codecept.io'));
stopOnFail(false);
await exec('git init');
await exec('git remote add origin [email protected]:codeceptjs/codeceptjs.github.io.git');
await exec('git checkout -b deploy');
await exec('git reset --soft HEAD~$(git rev-list --count HEAD ^master)');
await exec('git add -A');
await exec('git commit -m "deploy"');
stopOnFail(true);
await exec('git push -f origin deploy:master');
});
},
}
if (require.main === module) runok(module.exports);