-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
37 lines (31 loc) · 1023 Bytes
/
gulpfile.js
File metadata and controls
37 lines (31 loc) · 1023 Bytes
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
"use strict";
const gulp = require("gulp");
const del = require("del");
const babel = require("gulp-babel");
const cache = require("gulp-cached");
const sourcemaps = require("gulp-sourcemaps");
const plumber = require("gulp-plumber");
const notify = require("gulp-notify");
const gutil = require("gulp-util");
gulp.task("clean", () => del("lib/**/*"));
function build() {
return gulp.src("src/**/*")
.pipe(plumber({
errorHandler: (err) => gutil.log(`${err}\n${err.codeFrame}`)
}))
.pipe(sourcemaps.init())
.pipe(cache("src"))
.pipe(babel({
plugins: [
"transform-es2015-modules-commonjs"
]
}))
.pipe(sourcemaps.write("."))
.pipe(notify({ message: "flagger: built", onLast: true }))
.pipe(gulp.dest("lib"));
}
gulp.task("build", gulp.series("clean", build));
gulp.task("default", gulp.series("build"));
gulp.task("watch", gulp.series("build", () => {
gulp.watch("src/**/*", build);
}));