generated from nhcarrigan/template
refactor: use npm_package_version env var for API version
Replaces the readFileSync/path gymnastics with the simpler npm_package_version environment variable that npm injects at runtime.
This commit is contained in:
@@ -1,13 +1,7 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { Hono } from "hono";
|
||||
import type { AboutResponse, GiteaRelease } from "@elysium/types";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const { version: API_VERSION } = JSON.parse(
|
||||
readFileSync(join(__dirname, "../../../package.json"), "utf-8"),
|
||||
) as { version: string };
|
||||
const API_VERSION = process.env.npm_package_version ?? "unknown";
|
||||
|
||||
const GITEA_RELEASES_URL =
|
||||
"https://git.nhcarrigan.com/api/v1/repos/nhcarrigan-ideation/elysium/releases";
|
||||
|
||||
Reference in New Issue
Block a user