refactor(version): centralize Homarr version in @homarr/version package

Replace fragile deep-relative 'package.json' imports across the monorepo
with a single source of truth: the new @homarr/version leaf package reads
the version once from the root package.json and exports it as VERSION.

Consumers now import by package name incl. the new User-Agent header in
fetchWithTrustedCertificatesAsync (packages/core):
  - core, api (info router), analytics, request-handler (update checker)
This also removes all manually-maintained relative version imports.
This commit is contained in:
ajnart committed 2026-08-16 15:24:07 +02:00
1 parent 25b7657a79
commit c08ad3a69a
12 files changed
+67 -11

No files matched your search

+1
View File
@@ -26,6 +26,7 @@
"@homarr/core": "workspace:^0.1.0",
"@homarr/db": "workspace:^0.1.0",
"@homarr/docker": "workspace:^0.1.0",
"@homarr/version": "workspace:^0.1.0",
"posthog-node": "catalog:"
},
"devDependencies": {
@@ -28,8 +28,8 @@ import {
users,
} from "@homarr/db/schema";
import { env as dockerEnv } from "@homarr/docker/env";
import { VERSION } from "@homarr/version";
import packageJson from "../../../package.json";
import { getPostHogClient } from "./client";
const logger = createLogger({ module: "analytics" });
@@ -121,7 +121,7 @@ export const sendServerAnalyticsAsync = async (): Promise<AnalyticsResult> => {
const enabledAuthProviders = (["credentials", "oidc", "ldap"] as const).filter(isProviderEnabled);
const properties: Record<string, unknown> = {
homarrVersion: packageJson.version,
homarrVersion: VERSION,
databaseType: isMysql() ? "mysql" : isPostgresql() ? "postgresql" : "sqlite",
dockerEnabled: Boolean(dockerEnv.ENABLE_DOCKER),
kubernetesEnabled: Boolean(dockerEnv.ENABLE_KUBERNETES),