-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.babel.js
113 lines (91 loc) · 2.81 KB
/
gulpfile.babel.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*eslint no-var: "off"*/
var gulp = require('gulp');
var gutil = require('gulp-util');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var eslint = require('gulp-eslint');
var path = require('path');
var h2Module = [
'modules/@themost/h2/**/*.es6',
'!modules/@themost/h2/node_modules/**/*.es6'
];
var mssqlModule = [
'modules/@themost/mssql/**/*.es6',
'!modules/@themost/mssql/node_modules/**/*.es6'
];
var mysqlModule = [
'modules/@themost/mysql/**/*.es6',
'!modules/@themost/mysql/node_modules/**/*.es6'
];
var oracleModule = [
'modules/@themost/oracle/**/*.es6',
'!modules/@themost/oracle/node_modules/**/*.es6'
];
var pgModule = [
'modules/@themost/pg/**/*.es6',
'!modules/@themost/pg/node_modules/**/*.es6'
];
var poolModule = [
'modules/@themost/pool/**/*.es6',
'!modules/@themost/pool/node_modules/**/*.es6'
];
function lint(files, options) {
return function() {
return gulp.src(files)
.pipe(eslint(options))
.pipe(eslint.format())
};
}
function build(files) {
return function () {
return gulp.src(files)
// .once('data', bundleTimer.start)
.pipe(eslint())
.pipe(eslint.format())
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
// .pipe(bundleTimer)
.pipe(gulp.dest(function (file) {
return file.base;
}));
}
}
// @themost/h2
gulp.task('build:h2', ['lint:h2'],build(h2Module));
//lint @themost/h2
gulp.task('lint:h2', lint(h2Module));
// @themost/mssql
gulp.task('build:mssql', ['lint:mssql'],build(mssqlModule));
// lint @themost/mssql
gulp.task('lint:mssql',lint(mssqlModule));
// @themost/mysql
gulp.task('build:mysql', ['lint:mysql'],build(mysqlModule));
// lint @themost/mysql
gulp.task('lint:mysql',lint(mysqlModule));
// @themost/oracle
gulp.task('build:oracle', ['lint:oracle'],build(oracleModule));
// lint @themost/oracle
gulp.task('lint:oracle',lint(oracleModule));
// @themost/pg
gulp.task('build:pg', ['lint:pg'],build(pgModule));
// lint @themost/pg
gulp.task('lint:pg',lint(pgModule));
// @themost/pool
gulp.task('build:pool', ['lint:pool'],build(poolModule));
// lint @themost/pool
gulp.task('lint:pool',lint(poolModule));
// lint @themost
gulp.task('lint', ['lint:h2','lint:mssql', 'lint:mysql', 'lint:oracle', 'lint:pg', 'lint:pool', 'lint:sqlite']);
// build @themost
gulp.task('build', ['build:h2','build:mssql', 'build:mysql', 'build:oracle', 'build:pg', 'build:pool', 'build:sqlite']);
gulp.task('debug', ['build'], function () {
var files = h2Module.concat(mssqlModule, mysqlModule, oracleModule, pgModule, poolModule, sqliteModule);
gulp.watch(files, function(file) {
gutil.log(gutil.colors.green('Compiling ' + file.path));
return build(file.path)();
});
});
gulp.task('default', ['clean'], function() {
gulp.start('build');
});