-
Notifications
You must be signed in to change notification settings - Fork 0
/
runfile.js
59 lines (48 loc) · 1.15 KB
/
runfile.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
const { run, help, options } = require('runjs');
function build() {
const env = options(this).env === 'dev' ? 'development' : 'production';
run(`webpack --mode=${env}`);
}
function doc() {
run('jsdoc -c jsdoc.json');
}
function test() {
const watch = options(this).watch ? '' : '--single-run';
run(`karma start ${watch}`);
}
function lint() {
const fix = options(this).fix ? '--fix' : '';
run(`eslint . ${fix}`);
}
function release() {
run('git checkout master && git pull origin master && standard-version && git push --follow-tags origin master');
}
help(build, {
description: 'Build JS files',
options: {
env: 'Target environment, defaults to production',
},
});
help(doc, {
description: 'Generate documentation automatically using jsdoc',
});
help(test, {
description: 'Run unit tests using Karma',
options: {
watch: 'Run tests in a watch mode',
},
});
help(lint, {
description: 'Run lint check with Eslint',
options: {
fix: 'Automatically fix errors whenever possible',
},
});
help(release, 'Generate and push a new tag and update changelog');
module.exports = {
build,
doc,
test,
lint,
release,
};