forked from fairygui/FairyGUI-dom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
64 lines (57 loc) · 1.67 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
const gulp = require('gulp')
const rollup = require('rollup')
const ts = require('gulp-typescript');
const rename = require("gulp-rename");
const uglify = require('gulp-uglify-es').default;
const tsProject = ts.createProject('tsconfig.json', { declaration: true });
const onwarn = warning => {
// Silence circular dependency warning for moment package
if (warning.code === 'CIRCULAR_DEPENDENCY')
return
console.warn(`(!) ${warning.message}`)
}
gulp.task('buildJs', () => {
return tsProject.src().pipe(tsProject()).pipe(gulp.dest('./build'));
})
gulp.task("rollup", async function () {
let config = {
input: "build/FairyGUI.js",
external: ['three'],
onwarn : onwarn,
output: {
file: 'dist/fairygui.js',
format: 'umd',
extend: true,
name: 'fgui',
globals: { three: 'three' }
}
};
const subTask = await rollup.rollup(config);
await subTask.write(config);
let config2 = {
input: "build/FairyGUI.js",
external: ['three'],
output: {
file: 'dist/fairygui.module.js',
format: 'esm',
extend: true,
name: 'fgui',
globals: { three: 'three' }
}
};
const subTask2 = await rollup.rollup(config2);
await subTask2.write(config2);
});
gulp.task("uglify", function () {
return gulp.src("dist/fairygui.js")
.pipe(rename({ suffix: '.min' }))
.pipe(uglify(/* options */))
.pipe(gulp.dest("dist/"));
});
gulp.task('build'
, gulp.series(
gulp.parallel('buildJs'),
gulp.parallel('rollup'),
//gulp.parallel('uglify')
)
)