2020-05-09 14:45:23 +00:00
|
|
|
const path = require("path");
|
|
|
|
|
|
|
|
function requireUncached(module) {
|
|
|
|
delete require.cache[require.resolve(module)];
|
|
|
|
return require(module);
|
|
|
|
}
|
|
|
|
|
|
|
|
function gulptasksJS($, gulp, buildFolder, browserSync) {
|
|
|
|
//// DEV
|
|
|
|
|
|
|
|
gulp.task("js.dev.watch", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.config.js")({
|
|
|
|
watch: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder))
|
|
|
|
.pipe(browserSync.stream());
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("js.dev", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe($.webpackStream(requireUncached("./webpack.config.js")({})))
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
|
|
|
|
2021-03-09 09:07:19 +00:00
|
|
|
//// DEV CHINA
|
|
|
|
|
|
|
|
gulp.task("china.js.dev.watch", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.config.js")({
|
|
|
|
watch: true,
|
|
|
|
chineseVersion: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder))
|
|
|
|
.pipe(browserSync.stream());
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("china.js.dev", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.config.js")({
|
|
|
|
chineseVersion: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
|
|
|
|
2021-05-25 07:19:57 +00:00
|
|
|
//// DEV WEGAME
|
|
|
|
|
|
|
|
gulp.task("wegame.js.dev.watch", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.config.js")({
|
|
|
|
watch: true,
|
|
|
|
wegameVersion: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder))
|
|
|
|
.pipe(browserSync.stream());
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("wegame.js.dev", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.config.js")({
|
|
|
|
wegameVersion: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
|
|
|
|
2020-05-09 14:45:23 +00:00
|
|
|
//// STAGING
|
|
|
|
|
|
|
|
gulp.task("js.staging.transpiled", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.production.config.js")({
|
|
|
|
enableAssert: true,
|
|
|
|
environment: "staging",
|
|
|
|
es6: false,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe($.rename("bundle-transpiled.js"))
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("js.staging.latest", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.production.config.js")({
|
|
|
|
enableAssert: true,
|
|
|
|
environment: "staging",
|
|
|
|
es6: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
2020-06-13 18:44:00 +00:00
|
|
|
gulp.task("js.staging", gulp.parallel("js.staging.transpiled", "js.staging.latest"));
|
2020-05-09 14:45:23 +00:00
|
|
|
|
|
|
|
//// PROD
|
2020-08-07 07:16:23 +00:00
|
|
|
|
2020-05-09 14:45:23 +00:00
|
|
|
gulp.task("js.prod.transpiled", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.production.config.js")({
|
|
|
|
enableAssert: false,
|
|
|
|
environment: "prod",
|
|
|
|
es6: false,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe($.rename("bundle-transpiled.js"))
|
|
|
|
.pipe(gulp.dest(buildFolder))
|
|
|
|
.pipe(browserSync.stream());
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("js.prod.latest", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.production.config.js")({
|
|
|
|
enableAssert: false,
|
|
|
|
environment: "prod",
|
|
|
|
es6: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder))
|
|
|
|
.pipe(browserSync.stream());
|
|
|
|
});
|
|
|
|
|
2020-06-13 18:44:00 +00:00
|
|
|
gulp.task("js.prod", gulp.parallel("js.prod.transpiled", "js.prod.latest"));
|
2020-05-09 14:45:23 +00:00
|
|
|
|
|
|
|
//// STANDALONE
|
|
|
|
|
|
|
|
gulp.task("js.standalone-dev.watch", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.config.js")({
|
|
|
|
watch: true,
|
|
|
|
standalone: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder))
|
|
|
|
.pipe(browserSync.stream());
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("js.standalone-dev", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.config.js")({
|
|
|
|
standalone: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("js.standalone-beta", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.production.config.js")({
|
|
|
|
enableAssert: true,
|
|
|
|
environment: "staging",
|
|
|
|
es6: true,
|
|
|
|
standalone: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task("js.standalone-prod", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.production.config.js")({
|
|
|
|
enableAssert: false,
|
|
|
|
environment: "prod",
|
|
|
|
es6: true,
|
|
|
|
standalone: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
2021-03-09 09:07:19 +00:00
|
|
|
|
|
|
|
gulp.task("china.js.standalone-prod", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.production.config.js")({
|
|
|
|
enableAssert: false,
|
|
|
|
environment: "prod",
|
|
|
|
es6: true,
|
|
|
|
standalone: true,
|
|
|
|
chineseVersion: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
2021-05-25 07:19:57 +00:00
|
|
|
|
|
|
|
gulp.task("wegame.js.standalone-prod", () => {
|
|
|
|
return gulp
|
|
|
|
.src("../src/js/main.js")
|
|
|
|
.pipe(
|
|
|
|
$.webpackStream(
|
|
|
|
requireUncached("./webpack.production.config.js")({
|
|
|
|
enableAssert: false,
|
|
|
|
environment: "prod",
|
2021-05-25 19:29:44 +00:00
|
|
|
es6: false,
|
2021-05-25 07:19:57 +00:00
|
|
|
standalone: true,
|
|
|
|
wegameVersion: true,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
});
|
2020-05-09 14:45:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
gulptasksJS,
|
|
|
|
};
|