-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
68 lines (60 loc) · 1.75 KB
/
gulpfile.js
File metadata and controls
68 lines (60 loc) · 1.75 KB
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
var babel = require("gulp-babel");
var eslint = require("gulp-eslint");
var gulp = require("gulp");
var gulpIf = require("gulp-if");
var paths = {
serverScripts: [
'js/**/*.js',
'!js/client/**',
],
allScripts: [
'js/**/*.js'
],
allTests: [
'test/**/*.js'
],
ace: [
'thirdparty/ace-builds/src-min-noconflict/**',
],
static: ['static/**', '!**/.*'],
localsettings: ['settings.js', 'localsettings.js', 'buildsettings.js'],
};
function isFixed(file) {
// Has ESLint fixed the file contents?
return file.eslint != null && file.eslint.fixed;
}
gulp.task("scripts", function() {
return gulp.src(paths.serverScripts)
.pipe(babel({
presets: ['es2015'],
}))
.pipe(gulp.dest("build/js/"));
});
gulp.task('ace', function() {
return gulp.src(paths.ace)
.pipe(gulp.dest('./build/static/client/ace/'));
});
gulp.task("static", function() {
return gulp.src(paths.static)
.pipe(gulp.dest("build/static/"));
});
gulp.task("localsettings", function() {
return gulp.src(paths.localsettings)
.pipe(gulp.dest("build/"));
});
gulp.task('lint-js', function() {
return gulp.src(paths.allScripts)
.pipe(eslint({"fix": true}))
.pipe(eslint.format("node_modules/eslint-friendly-formatter"))
.pipe(eslint.failAfterError())
.pipe(gulpIf(isFixed, gulp.dest('js/')));
});
gulp.task('lint-test', function() {
return gulp.src(paths.allTests)
.pipe(eslint({"fix": true, "rules": {'no-unused-expressions': 0}})) // expect()... is an unused expression
.pipe(eslint.format("node_modules/eslint-friendly-formatter"))
.pipe(eslint.failAfterError())
.pipe(gulpIf(isFixed, gulp.dest('test/')));
});
gulp.task('lint', ['lint-js', 'lint-test']);
gulp.task('default', ['localsettings', 'scripts', 'static', 'ace']);