forked from atomiqio/json-schema-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
63 lines (50 loc) · 1.51 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
var gulp = require('gulp');
var gutil = require('gulp-util');
var mocha = require('gulp-mocha');
var babel = require("gulp-babel");
var sourcemaps = require('gulp-sourcemaps');
var path = require('path');
var del = require('del');
var babelOptions = {
// http://babeljs.io/docs/usage/experimental/
stage: 1,
// http://babeljs.io/docs/usage/runtime/
optional: ['runtime'],
// http://babeljs.io/docs/advanced/transformers/#optional
// whitelist: [],
blacklist: []
};
var paths = {
sourceRoot: path.join(__dirname, 'src'),
src: ['src/**/*.js'],
watch: ['src/**/*.js', 'src/**/*.json'],
dist: 'dist',
test: 'dist/test/test.js'
}
gulp.task('default', ['test', 'watch']);
gulp.task('clean', function(cb) {
del(paths.dist, cb);
});
gulp.task('babel', ['clean'], function () {
return gulp.src(paths.src)
.pipe(sourcemaps.init())
.pipe(babel(babelOptions))
.pipe(sourcemaps.write('.', { sourceRoot: paths.sourceRoot }))
.pipe(gulp.dest(paths.dist));
});
gulp.task('dist', ['babel'], function() {
return gulp.src(['src/**/*', '!**/*.js'], {base: 'src'})
.pipe(gulp.dest(paths.dist));
});
gulp.task('test', ['dist'], function() {
return gulp.src(paths.test, {read: false})
.pipe(mocha({ reporter: 'spec' }));
; //.on('error', gutil.log);
});
gulp.task('watch', function () {
gulp.watch(paths.watch, ['test']);
});
gulp.task('generate-testsuite', ['dist'], function() {
var testSuite = require('./dist/test/testsuite');
testSuite.generate('./src/test/testsuite');
});