-
Notifications
You must be signed in to change notification settings - Fork 378
/
publish-docs.js
68 lines (47 loc) · 2.06 KB
/
publish-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
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
/* eslint-disable no-console */
var shell = require('shelljs');
if (!shell.which('git')) {
shell.echo('Sorry, this script requires git');
shell.exit(1);
}
console.info('Running git checkout -b gh-pages');
checkResultCode(shell.exec('git checkout -b gh-pages'));
console.info('Running rm -rf node_modules');
checkResultCode(shell.rm('-rf', 'node_modules'));
console.info('Running rm -rf site/node_modules');
checkResultCode(shell.rm('-rf', 'site/node_modules'));
console.info('Running rm -rf docs');
checkResultCode(shell.rm('-rf', 'docs'));
console.info('Running rm -rf guides');
checkResultCode(shell.rm('-rf', 'guides'));
console.info('Running $(MAKE) -C site build');
checkResultCode(shell.exec('cd site && npm install --no-shrinkwrap && npm run build && cd ..'));
console.info('Running npm install --no-shrinkwrap');
checkResultCode(shell.exec('npm install --no-shrinkwrap'));
console.info('Running npm run document:force');
checkResultCode(shell.exec('npm run document:force'));
console.info('Running git add -f docs/');
checkResultCode(shell.exec('git add -f docs/'));
console.info('Running git add -f guides/');
checkResultCode(shell.exec('git add -f guides/'));
console.info('Running git add -f site/static/');
checkResultCode(shell.exec('git add -f site/static/'));
console.info('Running git add -f examples/');
checkResultCode(shell.exec('git add -f examples/'));
console.info('Running git add -f index.html');
checkResultCode(shell.exec('git add -f index.html'));
console.info('Running git add -f CNAME');
checkResultCode(shell.exec('git add -f CNAME'));
console.info('Running git commit -m "Publish docs"');
checkResultCode(shell.exec('git commit -m "Publish docs"'));
console.info('Running git push -f origin gh-pages');
checkResultCode(shell.exec('git push -f origin gh-pages'));
console.info('Running git checkout -');
checkResultCode(shell.exec('git checkout -'));
console.info('Running git branch -D gh-pages');
checkResultCode(shell.exec('git branch -D gh-pages'));
function checkResultCode(result) {
if (result.code !== 0) {
shell.exit(result.code);
}
}