Some checks failed
deploy-ui / build-and-deploy (push) Has been cancelled
Poll upstream main branch HEAD alongside release tags. When a new commit is detected, build and publish prerelease RPMs to a separate unstable repo at rpm.lair.cafe/fedora/$releasever/$basearch/unstable/. RPM versioning uses the Fedora snapshot convention (e.g. 0.8.1-0.1.20260511git1a2b3c4.fc43) so stable releases automatically supersede any installed prerelease. - RPM spec: conditional Release field via mistralrs_prerelease define - poll-upstream.yml: new check-prerelease job fetches main HEAD + Cargo.toml version - build-prerelease.yml: new workflow for commit-based builds without --locked - UI: fetch both stable/unstable manifests, show channel badges, add unstable repo setup instructions to home page Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import { useEffect, useState } from "react";
|
|
import type { Channel, PackagesManifest, PackageVersion } from "../types/packages.ts";
|
|
|
|
const STABLE_URL = "/fedora/43/x86_64/packages.json";
|
|
const UNSTABLE_URL = "/fedora/43/x86_64/unstable/packages.json";
|
|
|
|
function tagPackages(
|
|
manifest: PackagesManifest,
|
|
channel: Channel,
|
|
): PackageVersion[] {
|
|
return manifest.packages.map((p) => ({
|
|
...p,
|
|
channel,
|
|
baseUrl: manifest.baseUrl,
|
|
}));
|
|
}
|
|
|
|
export function usePackages() {
|
|
const [packages, setPackages] = useState<PackageVersion[]>([]);
|
|
const [loading, setLoading] = useState(true);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
useEffect(() => {
|
|
let cancelled = false;
|
|
|
|
const fetchManifest = async (
|
|
url: string,
|
|
channel: Channel,
|
|
): Promise<PackageVersion[]> => {
|
|
const res = await fetch(url);
|
|
if (!res.ok) {
|
|
if (res.status === 404) return [];
|
|
throw new Error(`HTTP ${res.status} fetching ${channel} manifest`);
|
|
}
|
|
const data = (await res.json()) as PackagesManifest;
|
|
return tagPackages(data, channel);
|
|
};
|
|
|
|
Promise.all([
|
|
fetchManifest(STABLE_URL, "stable"),
|
|
fetchManifest(UNSTABLE_URL, "unstable"),
|
|
])
|
|
.then(([stable, unstable]) => {
|
|
if (!cancelled) setPackages([...stable, ...unstable]);
|
|
})
|
|
.catch((err: unknown) => {
|
|
if (!cancelled)
|
|
setError(err instanceof Error ? err.message : String(err));
|
|
})
|
|
.finally(() => {
|
|
if (!cancelled) setLoading(false);
|
|
});
|
|
|
|
return () => {
|
|
cancelled = true;
|
|
};
|
|
}, []);
|
|
|
|
return { packages, loading, error };
|
|
}
|