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,44 @@
|
||||
export const webBuildSurfaces = ["core", "admin", "portal"] as const;
|
||||
|
||||
export type WebBuildSurface = (typeof webBuildSurfaces)[number];
|
||||
|
||||
export const webBuildDirectories: Record<WebBuildSurface, string> = {
|
||||
core: "build",
|
||||
// Admin shares the immutable Core artifact, while the runtime gate below
|
||||
// gives it a distinct host, process identity, and fail-closed environment.
|
||||
admin: "build",
|
||||
portal: "build-portal",
|
||||
};
|
||||
|
||||
export const webServiceNames: Record<WebBuildSurface, "hivegrid-web" | "hivegrid-admin" | "hivegrid-portal"> = {
|
||||
core: "hivegrid-web",
|
||||
admin: "hivegrid-admin",
|
||||
portal: "hivegrid-portal",
|
||||
};
|
||||
|
||||
export function requireWebBuildSurface(env: Readonly<{ HIVEGRID_RUNTIME_SURFACE?: string }> = process.env, fallback?: WebBuildSurface): WebBuildSurface {
|
||||
const surface = env.HIVEGRID_RUNTIME_SURFACE;
|
||||
if (surface === "core" || surface === "admin" || surface === "portal") {
|
||||
return surface;
|
||||
}
|
||||
if (surface === undefined && fallback) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
throw new Error("HIVEGRID_RUNTIME_SURFACE must be explicitly set to core, admin, or portal");
|
||||
}
|
||||
|
||||
export function getWebBuildDirectory(surface: WebBuildSurface) {
|
||||
return webBuildDirectories[surface];
|
||||
}
|
||||
|
||||
export function getWebServiceName(surface: WebBuildSurface) {
|
||||
return webServiceNames[surface];
|
||||
}
|
||||
|
||||
export function getWebTestBuildSurfaceFallback(
|
||||
env: Readonly<{ NODE_ENV?: string; VITEST?: string }> = process.env,
|
||||
argv: readonly string[] = process.argv
|
||||
): WebBuildSurface | undefined {
|
||||
return env.NODE_ENV === "test" || env.VITEST === "true" || argv.some((argument) => /(?:^|[/\\])vitest(?:\.[cm]?js)?$/u.test(argument)) ? "core" : undefined;
|
||||
}
|
||||
Reference in new issue
Block a user