mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Wegame version & DLC Translation in Chinese
This commit is contained in:
@@ -139,7 +139,12 @@ gulp.task("main.webserver", () => {
|
||||
);
|
||||
});
|
||||
|
||||
function serve({ standalone, chineseVersion = false }) {
|
||||
/**
|
||||
*
|
||||
* @param {object} param0
|
||||
* @param {"web"|"standalone"|"china"|"wegame"} param0.version
|
||||
*/
|
||||
function serve({ version = "web" }) {
|
||||
browserSync.init({
|
||||
server: buildFolder,
|
||||
port: 3005,
|
||||
@@ -163,7 +168,7 @@ function serve({ standalone, chineseVersion = false }) {
|
||||
gulp.watch(["../src/**/*.scss"], gulp.series("css.dev"));
|
||||
|
||||
// Watch .html files, those trigger a html rebuild
|
||||
gulp.watch("../src/**/*.html", gulp.series(standalone ? "html.standalone-dev" : "html.dev"));
|
||||
gulp.watch("../src/**/*.html", gulp.series(version === "web" ? "html.dev" : "html.standalone-dev"));
|
||||
|
||||
// Watch sound files
|
||||
// gulp.watch(["../res_raw/sounds/**/*.mp3", "../res_raw/sounds/**/*.wav"], gulp.series("sounds.dev"));
|
||||
@@ -199,14 +204,25 @@ function serve({ standalone, chineseVersion = false }) {
|
||||
return gulp.src(path).pipe(browserSync.reload({ stream: true }));
|
||||
});
|
||||
|
||||
// Start the webpack watching server (Will never return)
|
||||
if (standalone) {
|
||||
gulp.series("js.standalone-dev.watch")(() => true);
|
||||
} else {
|
||||
if (chineseVersion) {
|
||||
gulp.series("china.js.dev.watch")(() => true);
|
||||
} else {
|
||||
switch (version) {
|
||||
case "web": {
|
||||
gulp.series("js.dev.watch")(() => true);
|
||||
break;
|
||||
}
|
||||
case "standalone": {
|
||||
gulp.series("js.standalone-dev.watch")(() => true);
|
||||
break;
|
||||
}
|
||||
case "china": {
|
||||
gulp.series("china.js.dev.watch")(() => true);
|
||||
break;
|
||||
}
|
||||
case "wegame": {
|
||||
gulp.series("wegame.js.dev.watch")(() => true);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw new Error("Unknown version " + version);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -294,7 +310,7 @@ gulp.task(
|
||||
|
||||
// Builds everything (standalone-prod)
|
||||
|
||||
for (const prefix of ["", "china."]) {
|
||||
for (const prefix of ["", "china.", "wegame."]) {
|
||||
gulp.task(
|
||||
prefix + "step.standalone-prod.code",
|
||||
gulp.series("sounds.fullbuildHQ", "translations.fullBuild", prefix + "js.standalone-prod")
|
||||
@@ -327,25 +343,41 @@ gulp.task(
|
||||
);
|
||||
gulp.task("main.deploy.prod", gulp.series("utils.requireCleanWorkingTree", "build.prod", "ftp.upload.prod"));
|
||||
gulp.task("main.deploy.all", gulp.series("main.deploy.staging", "main.deploy.prod"));
|
||||
|
||||
// steam
|
||||
gulp.task("regular.main.standalone", gulp.series("build.standalone-prod", "standalone.package.prod"));
|
||||
|
||||
// china
|
||||
gulp.task(
|
||||
"china.main.standalone",
|
||||
gulp.series("china.build.standalone-prod", "china.standalone.package.prod")
|
||||
);
|
||||
gulp.task("standalone.all", gulp.series("regular.main.standalone", "china.main.standalone"));
|
||||
|
||||
// wegame
|
||||
gulp.task(
|
||||
"wegame.main.standalone",
|
||||
gulp.series("wegame.build.standalone-prod", "wegame.standalone.package.prod")
|
||||
);
|
||||
|
||||
// all (except wegame)
|
||||
gulp.task("standalone.all", gulp.series("regular.main.standalone", "wegame.main.standalone"));
|
||||
|
||||
// Live-development
|
||||
gulp.task(
|
||||
"main.serveDev",
|
||||
gulp.series("build.dev", () => serve({ standalone: false }))
|
||||
gulp.series("build.dev", () => serve({ version: "web" }))
|
||||
);
|
||||
gulp.task(
|
||||
"main.serveStandalone",
|
||||
gulp.series("build.standalone.dev", () => serve({ standalone: true }))
|
||||
gulp.series("build.standalone.dev", () => serve({ version: "standalone" }))
|
||||
);
|
||||
gulp.task(
|
||||
"china.main.serveDev",
|
||||
gulp.series("build.dev", () => serve({ standalone: false, chineseVersion: true }))
|
||||
gulp.series("build.dev", () => serve({ version: "china" }))
|
||||
);
|
||||
gulp.task(
|
||||
"wegame.main.serveDev",
|
||||
gulp.series("build.dev", () => serve({ version: "wegame" }))
|
||||
);
|
||||
|
||||
gulp.task("default", gulp.series("main.serveDev"));
|
||||
|
||||
47
gulp/js.js
47
gulp/js.js
@@ -59,6 +59,36 @@ function gulptasksJS($, gulp, buildFolder, browserSync) {
|
||||
.pipe(gulp.dest(buildFolder));
|
||||
});
|
||||
|
||||
//// 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));
|
||||
});
|
||||
|
||||
//// STAGING
|
||||
|
||||
gulp.task("js.staging.transpiled", () => {
|
||||
@@ -208,6 +238,23 @@ function gulptasksJS($, gulp, buildFolder, browserSync) {
|
||||
)
|
||||
.pipe(gulp.dest(buildFolder));
|
||||
});
|
||||
|
||||
gulp.task("wegame.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,
|
||||
wegameVersion: true,
|
||||
})
|
||||
)
|
||||
)
|
||||
.pipe(gulp.dest(buildFolder));
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -21,6 +21,11 @@ function gulptasksStandalone($, gulp) {
|
||||
suffix: "china",
|
||||
taskPrefix: "china.",
|
||||
},
|
||||
{
|
||||
tempDestDir: path.join(__dirname, "..", "tmp_standalone_files_wegame"),
|
||||
suffix: "wegame",
|
||||
taskPrefix: "wegame.",
|
||||
},
|
||||
];
|
||||
|
||||
for (const { tempDestDir, suffix, taskPrefix } of targets) {
|
||||
|
||||
@@ -6,7 +6,7 @@ const { getRevision, getVersion, getAllResourceImages } = require("./buildutils"
|
||||
const lzString = require("lz-string");
|
||||
const CircularDependencyPlugin = require("circular-dependency-plugin");
|
||||
|
||||
module.exports = ({ watch = false, standalone = false, chineseVersion = false }) => {
|
||||
module.exports = ({ watch = false, standalone = false, chineseVersion = false, wegameVersion = false }) => {
|
||||
return {
|
||||
mode: "development",
|
||||
devtool: "cheap-source-map",
|
||||
@@ -35,6 +35,7 @@ module.exports = ({ watch = false, standalone = false, chineseVersion = false })
|
||||
lzString.compressToEncodedURIComponent("http://localhost:10005/v1")
|
||||
),
|
||||
G_CHINA_VERSION: JSON.stringify(chineseVersion),
|
||||
G_WEGAME_VERSION: JSON.stringify(wegameVersion),
|
||||
G_IS_DEV: "true",
|
||||
G_IS_RELEASE: "false",
|
||||
G_IS_MOBILE_APP: "false",
|
||||
|
||||
@@ -17,6 +17,7 @@ module.exports = ({
|
||||
isBrowser = true,
|
||||
mobileApp = false,
|
||||
chineseVersion = false,
|
||||
wegameVersion = false,
|
||||
}) => {
|
||||
const globalDefs = {
|
||||
assert: enableAssert ? "window.assert" : "false && window.assert",
|
||||
@@ -25,6 +26,7 @@ module.exports = ({
|
||||
G_IS_DEV: "false",
|
||||
|
||||
G_CHINA_VERSION: JSON.stringify(chineseVersion),
|
||||
G_WEGAME_VERSION: JSON.stringify(wegameVersion),
|
||||
G_IS_RELEASE: environment === "prod" ? "true" : "false",
|
||||
G_IS_STANDALONE: standalone ? "true" : "false",
|
||||
G_IS_BROWSER: isBrowser ? "true" : "false",
|
||||
|
||||
Reference in New Issue
Block a user