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
@@ -29,6 +29,7 @@
"@homarr/docker": "workspace:^0.1.0",
"@homarr/integrations": "workspace:^0.1.0",
"@homarr/redis": "workspace:^0.1.0",
"@homarr/version": "workspace:^0.1.0",
"dayjs": "catalog:",
"octokit": "catalog:",
"superjson": "catalog:",
@@ -6,8 +6,7 @@ import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/h
import { createLogger } from "@homarr/core/infrastructure/logs";
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
import { createGetSetChannel, createLockChannel } from "@homarr/redis";
import packageJson from "../../../package.json";
import { VERSION } from "@homarr/version";
const logger = createLogger({ module: "updateCheckerRequestHandler" });
@@ -22,7 +21,7 @@ type UpdateCheckCacheEntry = {
checkedAt: number | null;
};
const updateCheckCacheVersion = `v2:${packageJson.version}`;
const updateCheckCacheVersion = `v2:${VERSION}`;
const freshUpdateCheckChannel = createGetSetChannel<UpdateCheckCacheEntry>(
`update-checker:fresh:${updateCheckCacheVersion}`,
);
@@ -69,7 +68,7 @@ const getCachedAvailableUpdatesAsync = async (): Promise<UpdateCheckCacheEntry>
try {
const attemptedAt = Date.now();
const availableUpdates = await getAvailableUpdatesAsync(packageJson.version);
const availableUpdates = await getAvailableUpdatesAsync(VERSION);
const result: UpdateCheckCacheEntry = {
availableUpdates,
attemptedAt,