-
Notifications
You must be signed in to change notification settings - Fork 6
/
nofile.js
56 lines (46 loc) · 1.13 KB
/
nofile.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
/*
For help info run "npm run no -- -h"
*/
const kit = require('./lib/kit');
module.exports = function (task, option) {
option('-a, --all', 'rebuild with dependencies');
task('default build b', ['clean', 'lint'], 'build project', function () {
kit.require('drives');
kit.warp('lib/*.js')
.load(kit.drives.comment2md({
h: 2,
tpl: 'doc/readme.jst.md'
})).run()
});
option('-d, --debug', 'enable node debug mode');
option('-p, --port [8283]', 'node debug mode', 8283);
task('lab l', 'run and monitor "test/lab.js"', function (opts) {
const args = ['test/lab.js'];
if (opts.debug) {
args.splice(0, 0, '--nodejs', 'debug');
}
return kit.monitorApp({
bin: 'node',
args,
watchList: ['test/*', 'lib/**']
});
});
task('lint', () => {
return kit.spawn('eslint', ['--cache', '.'])
})
task('clean', 'clean cache', function (opts) {
if (opts.all) {
return kit.all([
kit.remove('.nokit')
]);
}
});
option('-g, --grep <pattern>', 'test pattern', '');
return task('test t', ['build'], 'unit tests', opts =>
kit.spawn('junit', [
'-g', opts.grep,
'-t', 1000 * 20,
'test/basic.js'
])
);
};