Add SSR mode and test on Android
This commit is contained in:
@@ -91,4 +91,25 @@ export async function mergeMap(mapFile: string) {
|
||||
await fs.promises.unlink(lockFile)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export async function ssr() {
|
||||
const ret = await build();
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
console.log("Start generate ssr data");
|
||||
const bundleFiles = await glob("bundle/**/*.js");
|
||||
process.env["SSR_BUILD"] = "1";
|
||||
for (let bundleFile of bundleFiles) {
|
||||
console.log(bundleFile);
|
||||
await Shell.exec("node", [bundleFile], {
|
||||
env: process.env,
|
||||
consoleHandler: (info) => {
|
||||
console.log(info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import commander from "commander"
|
||||
import { build, clean } from "./actions";
|
||||
import { build, clean, ssr } from "./actions";
|
||||
import { create, createLib } from "./create"
|
||||
import dev from "./dev"
|
||||
import { run } from "./run";
|
||||
@@ -41,7 +41,18 @@ commander
|
||||
.action(async function () {
|
||||
await clean();
|
||||
})
|
||||
|
||||
commander
|
||||
.command('ssr <action>')
|
||||
.action(async function (action) {
|
||||
if (action === 'build') {
|
||||
const ret = await ssr();
|
||||
if (ret != 0) {
|
||||
process.exit(ret)
|
||||
}
|
||||
} else {
|
||||
console.error("Do not support in ssr mode ", action)
|
||||
}
|
||||
})
|
||||
commander
|
||||
.command('run <platform>')
|
||||
.action(async function (platform, cmd) {
|
||||
|
Reference in New Issue
Block a user