Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { stageWebClientSourcemaps } from "./stage-web-sourcemaps.mjs";
|
||||
import { stagePortalPublicAssets } from "./stage-portal-public-assets.mjs";
|
||||
import { verifyWebBuildSurfaces } from "./verify-web-build-surfaces.mjs";
|
||||
|
||||
const rootDirectory = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const webDirectory = path.join(rootDirectory, "apps", "web");
|
||||
const require = createRequire(import.meta.url);
|
||||
const reactRouterPackageDirectory = path.dirname(require.resolve("@react-router/dev/package.json"));
|
||||
const reactRouterCli = path.join(reactRouterPackageDirectory, "bin.js");
|
||||
|
||||
for (const surface of ["core", "portal"]) {
|
||||
await runReactRouterBuild(surface);
|
||||
if (surface === "portal") {
|
||||
stagePortalPublicAssets(rootDirectory);
|
||||
}
|
||||
}
|
||||
verifyWebBuildSurfaces(rootDirectory);
|
||||
if (process.env.HIVEGRID_BUILD_SOURCEMAPS === "1") {
|
||||
await stageWebClientSourcemaps(rootDirectory);
|
||||
}
|
||||
|
||||
function runReactRouterBuild(surface) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(process.execPath, [reactRouterCli, "build", "."], {
|
||||
cwd: webDirectory,
|
||||
env: {
|
||||
...process.env,
|
||||
HIVEGRID_RUNTIME_SURFACE: surface,
|
||||
VITE_OTEL_SERVICE_NAME: surface === "portal" ? "hivegrid-portal" : process.env.VITE_OTEL_SERVICE_NAME || "hivegrid-web",
|
||||
},
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
child.once("error", reject);
|
||||
child.once("exit", (code, signal) => {
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
reject(new Error(`React Router ${surface} build failed (${signal ?? `exit ${code}`})`));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user