forked from hiddentao/squel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
101 lines (85 loc) · 2.37 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
97
98
require('coffee-script/register');
const gulp = require('gulp'),
umd = require('gulp-umd'),
path = require('path'),
concat = require('gulp-concat'),
insert = require('gulp-insert'),
mocha = require('gulp-mocha'),
babel = require('gulp-babel'),
replace = require('gulp-replace'),
uglify = require('gulp-uglify'),
runSequence = require('run-sequence');
const SQUEL_VERSION = require('./package.json').version;
gulp.task('build-basic', function() {
return gulp.src([
'./src/core.js',
])
.pipe( concat('squel-basic.js') )
.pipe( replace(/<<VERSION_STRING>>/i, SQUEL_VERSION) )
.pipe( babel({
presets: ['es2015']
}) )
.pipe( umd({
exports: function (file) {
return 'squel';
},
namespace: function(file) {
return 'squel';
}
}))
.pipe( gulp.dest('./') )
.pipe( uglify() )
.pipe( insert.prepend('/*! squel | https://github.com/hiddentao/squel | BSD license */') )
.pipe( concat('squel-basic.min.js') )
.pipe( gulp.dest('./') )
});
gulp.task('build-full', function() {
return gulp.src([
'./src/core.js',
'./src/mssql.js',
'./src/mysql.js',
'./src/postgres.js',
])
.pipe( concat('squel.js') )
.pipe( replace(/<<VERSION_STRING>>/i, SQUEL_VERSION) )
.pipe( babel({
presets: ['es2015']
}) )
.pipe( umd({
exports: function (file) {
return 'squel';
},
namespace: function(file) {
return 'squel';
}
}))
.pipe( gulp.dest('./') )
.pipe( uglify() )
.pipe( insert.prepend('/*! squel | https://github.com/hiddentao/squel | BSD license */') )
.pipe( concat('squel.min.js') )
.pipe( gulp.dest('./') )
});
gulp.task('test', function () {
return gulp.src([
'./test/baseclasses.test.coffee',
'./test/blocks.test.coffee',
'./test/case.test.coffee',
'./test/custom.test.coffee',
'./test/delete.test.coffee',
'./test/expressions.test.coffee',
'./test/insert.test.coffee',
'./test/select.test.coffee',
'./test/update.test.coffee',
'./test/mssql.test.coffee',
'./test/mysql.test.coffee',
'./test/postgres.test.coffee',
], { read: false })
.pipe(mocha({
ui: 'exports',
reporter: 'spec',
}))
;
});
gulp.task('default', function(cb) {
runSequence(['build-basic', 'build-full'], 'test', cb);
});