Files
threadcount-community/lib/source.ts
T
ThreadCount f72f0626b0
Release / release (push) Has been skipped
ThreadCount Community edition
Uniform stock management for healthcare linen rooms: the coordinator app, the phone counter and the staff app, for your own server. Built from 794bab5 on 2026-09-16. Licensed under the Functional Source License (FSL-1.1-ALv2).
2026-09-17 05:49:16 +10:00

25 lines
1.3 KiB
TypeScript

import { readFileSync } from "fs";
import path from "path";
/* Which build this server is, and where its source can be had. Server-side only.
*
* Kept apart from lib/edition.ts on purpose. That module is pulled into client bundles through
* lib/plan.ts (PlanChoice, MSignup, Checkout all import it), so a node built-in added there passes
* the typecheck and then fails `next build` with "can't resolve fs". Everything that touches the
* filesystem lives here instead, and only server code imports it: the source notice is a server
* component and /api/app-info runs on the server. */
/** The Community release cut by the publisher, or the hosted release sha. */
export function editionVersion(): string {
try {
// Written into the published tree by the release; absent on the hosted service.
return readFileSync(path.join(process.cwd(), "COMMUNITY_VERSION"), "utf8").trim();
} catch { /* hosted: no file */ }
return process.env.NEXT_PUBLIC_RELEASE || "hosted";
}
/* The AGPL asks that anyone offering a MODIFIED version over a network lets its users get that
* modified source, so a facility running its own build sets SOURCE_URL to wherever it keeps that.
* Unset, it names the release this build came from. */
export const SOURCE_URL = process.env.SOURCE_URL || "https://github.com/pricehq/threadcount-community";