-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.babel.js
More file actions
69 lines (62 loc) · 1.56 KB
/
Copy pathGulpfile.babel.js
File metadata and controls
69 lines (62 loc) · 1.56 KB
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
import gulp from "gulp";
import path from "path";
import pump from "pump";
import del from "del";
import babel from "gulp-babel";
import eslint from "gulp-eslint";
import sourcemaps from "gulp-sourcemaps";
const paths = {
main: {
dir: "src",
src: "src/**/*.js",
dest: "dist"
},
tests: {
dir: "tests",
src: "tests/**/*.js",
dest: "dist/tests"
},
clean: "dist/*"
};
const clean = () => del(paths.clean, { dot: true });
export { clean };
export function lint() {
return gulp.src(["src/**/*.js", "tests/**/*.js"])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}
function build_src(done) {
pump([
gulp.src([paths.main.src]),
sourcemaps.init(),
babel(),
sourcemaps.write({
includeContent: false,
sourceRoot: function (file) {
return path.relative(file.relative, path.join(file.cwd, paths.main.dir));
}
}),
gulp.dest(paths.main.dest)
],
done
);
}
function build_test(done) {
pump([
gulp.src([paths.tests.src]),
sourcemaps.init(),
babel(),
sourcemaps.write({
includeContent: false,
sourceRoot: function (file) {
return "../" + path.relative(file.relative, path.join(file.cwd, paths.tests.dir));
}
}),
gulp.dest(paths.tests.dest)
],
done
);
}
export const build = gulp.series(clean, gulp.parallel(build_src, build_test));
export default build;