Add js web stuff to landing page + documentation
This commit is contained in:
16
go/jsruntime/env.ts
Normal file
16
go/jsruntime/env.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// Compile-time deployment environment: "development" | "staging" | "production".
|
||||
//
|
||||
// `__ENV_TYPE__` is substituted at bundle time by esbuild's `define`, fed the Go
|
||||
// compile-time constant `internal/constants.AppEnvironment` (see the
|
||||
// `esbuildDefine` helper in internal/bundler). The production bundles and the dev
|
||||
// HMR per-module transform both define it. The build-time SSR render of the
|
||||
// public pages does NOT, so the `typeof` guard yields "" there — the env badge
|
||||
// renders only after the client takeover, matching the prior runtime behavior.
|
||||
declare const __ENV_TYPE__: string;
|
||||
|
||||
export const ENV_TYPE: string = typeof __ENV_TYPE__ !== "undefined" ? __ENV_TYPE__ : "";
|
||||
|
||||
// True in every environment except production (and the badge-less SSR render).
|
||||
export function isNonProdEnv(): boolean {
|
||||
return ENV_TYPE !== "" && ENV_TYPE !== "production";
|
||||
}
|
||||
Reference in New Issue
Block a user