2020-06-08 11:49:45 +08:00
|
|
|
'use strict';
|
|
|
|
|
const gulp = require("gulp");
|
|
|
|
|
const minify = require('gulp-minify');
|
|
|
|
|
const inject = require("gulp-inject-string");
|
|
|
|
|
const ts = require('gulp-typescript');
|
2020-12-10 16:15:19 +08:00
|
|
|
const merge = require('merge2');
|
2020-06-08 11:49:45 +08:00
|
|
|
const tsProject = ts.createProject('tsconfig.json');
|
|
|
|
|
|
|
|
|
|
gulp.task('buildJs', () => {
|
|
|
|
|
return tsProject.src()
|
|
|
|
|
.pipe(tsProject())
|
2020-08-06 12:01:20 +08:00
|
|
|
.js.pipe(inject.replace('var es;', ''))
|
|
|
|
|
.pipe(inject.prepend('window.es = {};\n'))
|
2020-06-08 11:49:45 +08:00
|
|
|
.pipe(inject.replace('var __extends =', 'window.__extends ='))
|
2020-12-24 11:12:24 +08:00
|
|
|
.pipe(minify({ ext: { min: ".min.js" } }))
|
2020-06-08 11:49:45 +08:00
|
|
|
.pipe(gulp.dest('./bin'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
gulp.task("buildDts", ["buildJs"], () => {
|
|
|
|
|
return tsProject.src()
|
|
|
|
|
.pipe(tsProject())
|
|
|
|
|
// .dts.pipe(inject.append('import e = framework;'))
|
|
|
|
|
.pipe(gulp.dest('./bin'));
|
|
|
|
|
});
|
|
|
|
|
|
2020-12-10 16:15:19 +08:00
|
|
|
gulp.task("copy", ["buildDts"], () => {
|
2020-06-08 11:49:45 +08:00
|
|
|
return gulp.src('bin/**/*')
|
2020-12-10 16:15:19 +08:00
|
|
|
.pipe(gulp.dest('../demo/egret_demo/libs/framework/'))
|
2020-12-24 11:12:24 +08:00
|
|
|
.pipe(gulp.dest('../extensions/behaviourTree-ai/egret-demo/libs/framework/'))
|
2020-12-10 16:15:19 +08:00
|
|
|
});
|
|
|
|
|
|
2020-12-24 11:12:24 +08:00
|
|
|
gulp.task('build', ['copy'], () => {
|
2020-12-10 16:15:19 +08:00
|
|
|
return merge([
|
|
|
|
|
gulp.src('bin/*.js')
|
|
|
|
|
.pipe(gulp.dest('../demo/laya_demo/bin/libs/')),
|
|
|
|
|
gulp.src('bin/*.ts')
|
2020-12-24 11:12:24 +08:00
|
|
|
.pipe(gulp.dest('../demo/laya_demo/libs/')),
|
|
|
|
|
gulp.src('bin/framework.d.ts')
|
|
|
|
|
.pipe(gulp.dest('../extensions/behaviourTree-ai/source/lib/'))
|
|
|
|
|
.pipe(gulp.dest('../extensions/ecs-star/lib/'))
|
2020-12-30 16:28:07 +08:00
|
|
|
.pipe(gulp.dest('../extensions/ecs-tween/lib/'))
|
2020-12-24 11:12:24 +08:00
|
|
|
.pipe(gulp.dest('../engine_support/egret/lib/'))
|
2020-12-10 16:15:19 +08:00
|
|
|
])
|
2020-08-21 19:21:40 +08:00
|
|
|
});
|