-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gulpfile.js
45 lines (42 loc) · 1.05 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
const gulp = require('gulp');
gulp.task('peg', () => {
const peg = require('gulp-peg');
return gulp.src('edtfy.pegjs')
.pipe(peg({
optimize: 'speed',
trace: false
}))
.pipe(gulp.dest('tmp'));
});
gulp.task('build', gulp.series('peg', () => {
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const sourcemaps = require('gulp-sourcemaps');
const b = browserify('./edtfy.js', {
standalone: 'edtfy',
plugin: [
["browserify-derequire"]
]
});
return b.bundle()
.pipe(source('edtfy.js'))
.pipe(buffer())
.pipe(gulp.dest('dist'))
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('dist'));
}));
gulp.task('test', () => {
var mocha = require('gulp-mocha');
return gulp.src('tests/**/*.js')
.pipe(mocha());
});