@simpelekees/knowmore-federation
v0.2.1
Published
Typed client, shaping helpers and table components for the footdata federation scraper (FVRZ matchcenter) — shared by FindMore and KnowMore.
Maintainers
Readme
@simpelekees/knowmore-federation
Typed client, shaping helpers and three table components for the footdata
federation scraper (the FVRZ matchcenter mirror at footdata.rappedoos.com).
Shared by FindMore and KnowMore — one copy instead
of two hand-synced ones.
pnpm add @simpelekees/knowmore-federationWhat's in it
| Entry | Contents |
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| @simpelekees/knowmore-federation | federationApi transport (getTeamStandings, getTeamSchedule, getTeamResults, getTeamGroup, getGroupFixtures, getTeamStats, getMatchDetail, …), matchcenter deep links, schedule shaping (mergeScheduleEntries, partitionEntries, isOurTeam, hasMatchDetail, …), standings shaping (sortStandings, recentForm, shortenTeamLabels, …), the FederationLabels context, and Schema / Paths types generated from the scraper's OpenAPI document |
| @simpelekees/knowmore-federation/components | StandingsTable, SquadTable, SoccerPitch (Svelte 5, runes) |
Host setup
1. Scraper base URL. The client reads import.meta.env.VITE_SCRAPER_URL and
falls back to /scraper (a same-origin dev proxy). Set it at build time:
VITE_SCRAPER_URL=https://footdata.rappedoos.com/api2. Tailwind. The components use utility classes on the shadcn theme tokens
(bg-muted, text-foreground, --primary, …) that both apps already define.
Tailwind 4 does not scan node_modules by default, so add to your app.css:
@source '../node_modules/@simpelekees/knowmore-federation/dist';The row-tint tbl-* styles ship inside the components; delete any copy from your
app.css.
3. Labels (optional). Defaults are German. To use your own i18n, set a resolver once in the root layout:
<script lang="ts">
import { setFederationLabels } from '@simpelekees/knowmore-federation';
import * as m from '$lib/paraglide/messages';
setFederationLabels(() => ({
colTeam: m.col_team(),
colPlayed: m.col_played(),
teamsCount: (n) => m.teams_count({ count: n })
// … any key you translate; the rest fall back to German
}));
</script>An English set is exported as EN_LABELS.
Usage
<script lang="ts">
import { getTeamStandings, sortStandings, ourTeamIndex } from '@simpelekees/knowmore-federation';
import { StandingsTable } from '@simpelekees/knowmore-federation/components';
const standings = await getTeamStandings(clubId, teamId);
const table = sortStandings(standings.table);
const ourIdx = ourTeamIndex(table, 'FC Töss');
</script>
<StandingsTable
{table}
{ourIdx}
computed={standings.computed}
hrefFor={(label) => `/teams/${label}`}
/>Generated types
src/lib/schema.gen.ts is produced by openapi-typescript from the live scraper:
pnpm types:gen # regenerate after a scraper release
pnpm types:check # fails when the live schema drifted from the committed fileThe hand-written interfaces in api.ts remain the public surface; the generated
Schema['StandingEntry'] etc. are there to diff against.
Develop
pnpm install
pnpm check # svelte-check
pnpm build # svelte-package → dist/ + publint
pnpm publish # public, from the simpelekees npm loginLocal iteration against an app: pnpm link --global here, then
pnpm link --global @simpelekees/knowmore-federation in the app.
