forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
f8314e7de1
commit
1fedb9368d
76 files changed
+20556
-2523
No files matched your search
@@ -4,6 +4,8 @@ import { defineConfig } from "vitest/config";
|
||||
import react from "@vitejs/plugin-react";
|
||||
// @ts-expect-error Shared Node HTTP middleware also serves production bundles.
|
||||
import { createBundledContentHandler } from "./server/bundled-content.mjs";
|
||||
// @ts-expect-error Local-only Node middleware is activated only in balance-lab-gui mode.
|
||||
import { createLocalBalanceLabApi } from "./server/local-balance-lab-api.mjs";
|
||||
|
||||
const packageVersion = (JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")) as { version: string }).version;
|
||||
|
||||
@@ -11,9 +13,22 @@ export default defineConfig(({ mode }) => {
|
||||
const androidBuild = mode === "android";
|
||||
const shelvedModesEnabled = mode === "shelved";
|
||||
const balanceLabRuntime = mode === "balance-lab";
|
||||
const localBalanceLabGui = mode === "balance-lab-gui";
|
||||
const downloadableBuild = androidBuild || mode === "production" || shelvedModesEnabled;
|
||||
return {
|
||||
plugins: [react(), {
|
||||
name: "local-balance-lab-api",
|
||||
configureServer(server) {
|
||||
if (!localBalanceLabGui) return;
|
||||
const api = createLocalBalanceLabApi();
|
||||
server.httpServer?.once("close", () => api.close());
|
||||
server.middlewares.use((request, response, next) => {
|
||||
void api.handle(request, response).then((handled: boolean) => {
|
||||
if (!handled) next();
|
||||
}).catch(next);
|
||||
});
|
||||
},
|
||||
}, {
|
||||
name: "bundled-content-preview",
|
||||
configurePreviewServer(server) {
|
||||
const serve = createBundledContentHandler(path.resolve(androidBuild ? "dist-android" : "dist"));
|
||||
@@ -46,6 +61,7 @@ export default defineConfig(({ mode }) => {
|
||||
"import.meta.env.VITE_APP_VERSION": JSON.stringify(packageVersion),
|
||||
"import.meta.env.VITE_CONTENT_MODE": JSON.stringify(downloadableBuild ? "downloadable" : "bundled"),
|
||||
"import.meta.env.VITE_SHELVED_MODES_ENABLED": JSON.stringify(shelvedModesEnabled ? "true" : "false"),
|
||||
"import.meta.env.VITE_LOCAL_BALANCE_LAB_GUI": JSON.stringify(localBalanceLabGui ? "true" : "false"),
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
@@ -90,6 +106,7 @@ export default defineConfig(({ mode }) => {
|
||||
: [
|
||||
"**/dungeon-pipeline/**",
|
||||
"**/playtest-artifacts/**",
|
||||
...(localBalanceLabGui ? ["**/artifacts/balance-lab-gui-runtime/**"] : []),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user