This repository has been archived by the owner on Oct 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
96 lines (81 loc) · 1.79 KB
/
gulpfile.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
var gulp = require('gulp');
var todo = require('gulp-todo');
var lint = require('gulp-eslint');
var del = require('del');
var paths = {
src: './',
spec: './spec/*.js',
js: [
'./*.js',
'./src/*.js',
'./src/**/*.js',
'./bundles/**/*.js',
'!./**/node_modules/**'],
};
const report = {
ignore: 0,
warn: 1,
error: 2,
};
var options = {
todo: {
absolute: true,
fileName: 'gulpTODO.md'
},
lint: {
rules: {
'no-reserved-keys': report.ignore,
'no-cond-assign': report.warn,
'no-dupe-args': report.warn,
'no-dupe-keys': report.warn,
'no-duplicate-case': report.warn,
'no-extra-semi': report.warn,
'no-func-assign': report.warn,
'no-sparse-arrays': report.warn,
'yoda': report.warn,
'camelcase': report.warn,
'use-isnan': report.error,
'valid-typeof': report.error,
'no-unreachable': report.error,
'no-undef': report.error,
},
parserOptions: {
'ecmaVersion': 6,
},
}
};
gulp.task('todo', toDoTask);
gulp.task('lint', lintTask);
gulp.task('default', gulp.series('todo', 'lint'));
function lintTask() {
return gulp
.src(paths.js)
.pipe(lint(options.lint))
.pipe(lint.format())
.pipe(lint.failAfterError());
}
function toDoTask() {
return gulp
.src(paths.js)
.pipe(todo(options.todo))
.pipe(gulp.dest(paths.src));
}
gulp.task('clean-logs', function () {
return del([
'data/log/*',
'!.gitignore'
]);
});
gulp.task('clean-bugs', function () {
return del([
'data/bug/*',
'!.gitignore'
]);
});
gulp.task('clean-areas', function () {
return del([
'data/area/*',
'!.gitignore'
]);
});
gulp.task('clean-all', gulp.series('clean-logs', 'clean-bugs', 'clean-areas'));