diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 898fd0f..60b8145 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,8 @@ jobs: - name: Build website (client + SSG) run: pnpm build.client && pnpm build.server working-directory: website + env: + GITHUB_TOKEN: ${{ github.token }} # the changelog reads the GitHub releases - name: Typecheck test app run: pnpm build.types && pnpm lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f68f421..a4867c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,7 +138,7 @@ jobs: GH_TOKEN: ${{ github.token }} # The docs show the new version: the version menu, the install commands and - # the changelog read npm when they build. + # the changelog read npm and the GitHub releases when they build. website: needs: published uses: ./.github/workflows/website.yml diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index e105bf5..33c8eb5 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -39,8 +39,12 @@ jobs: - name: Production settings run: npx --yes vercel@65.7.0 pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + # The changelog reads the GitHub releases when it builds: with a token, + # GitHub counts the requests against it, not against the runner's address. - name: Build run: npx --yes vercel@65.7.0 build --prod --token=${{ secrets.VERCEL_TOKEN }} + env: + GITHUB_TOKEN: ${{ github.token }} - name: Deploy run: npx --yes vercel@65.7.0 deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/AGENTS.md b/AGENTS.md index 62023b6..daf3157 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -87,7 +87,8 @@ files — no functions. Build settings live in `vercel.json` at the repo root. P from GitHub Actions (`.github/workflows/website.yml`, Vercel CLI) after each release and on pushes to `v2` that touch `website/`; Vercel's Git integration only builds previews for other branches (`website/scripts/vercel-preview.sh`). Versions, dist-tags and dates on the site come from npm at -build time (`website/src/lib/npm.ts`). Details: `website/README.md`. +build time (`website/src/lib/npm.ts`); the changelog's notes are the published GitHub releases, read +at build time too (`website/src/lib/github.ts`). Details: `website/README.md`. ## Releases diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b50476f..7ade9af 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,8 +69,9 @@ version (`2.0.0-beta.2`…), commits it, tags it and pushes. The tag runs Trusted Publishing (a prerelease under its identifier, like `beta`; a plain version under `latest`); 3. it drafts a GitHub release with the changelog generated from the commits. Edit its notes while it - waits: the generator only lists `feat`, `fix` and `perf` commits, and only marks a change as - breaking when its commit has a `!` or a `BREAKING CHANGE:` footer. + waits: they are also the website's changelog for that version, and the generator only lists + `feat`, `fix` and `perf` commits, and only marks a change as breaking when its commit has a `!` or + a `BREAKING CHANGE:` footer. Nothing is public until a maintainer approves the staged version with 2FA (npm 11.15 or later): diff --git a/website/README.md b/website/README.md index 158190f..dbe44cf 100644 --- a/website/README.md +++ b/website/README.md @@ -18,14 +18,20 @@ pnpm preview # production build served locally by Vite From the repo root, `pnpm build.website` runs the whole chain (library + client + SSG), as Vercel does. -## Versions come from npm +## Versions come from npm, release notes from GitHub The version menu, the install commands, the banners, the Qwik v2 badge and the changelog's versions, dist-tags and dates are read from the npm registry when the site builds (`vite.config.ts` → -`src/lib/npm.ts` → `src/lib/release.ts`). Only the release notes are written by hand, in -`src/lib/changelog.ts`, per `major.minor` series. Offline, a local build shows the repo's version as +`src/lib/npm.ts` → `src/lib/release.ts`). Offline, a local build shows the repo's version as unreleased; in CI (`CI` set) the build fails instead. +The changelog's notes are the published GitHub releases, as GitHub renders them (`vite.config.ts` → +`src/lib/github.ts` → `src/lib/release-notes.ts`): to change what the site says about a version, edit +its release on GitHub and redeploy. A release is a draft until its version is approved on npm, so the +site never shows notes for a version that isn't out (see `CONTRIBUTING.md` → Releases). Set +`GITHUB_TOKEN` to read them with a token. Offline or rate-limited, a local or preview build goes on +without notes; in GitHub Actions the build fails instead. + ## Deployment (Vercel) The site is fully prerendered, so Vercel serves `dist/` as static files: no functions. diff --git a/website/src/components/docs/inline.tsx b/website/src/components/docs/inline.tsx index 2e7267f..a26ddc8 100644 --- a/website/src/components/docs/inline.tsx +++ b/website/src/components/docs/inline.tsx @@ -1,8 +1,8 @@ import type { JSXOutput } from "@qwik.dev/core"; /** - * Renders a tiny markdown subset used by data-driven copy (changelog entries, - * API tables): `code` and **bold**. Everything else is plain text. + * Renders a tiny markdown subset used by data-driven copy (API tables): + * `code` and **bold**. Everything else is plain text. */ export function inline(text: string): JSXOutput { return text.split(/(`[^`]+`|\*\*[^*]+\*\*)/g).map((part, i) => { diff --git a/website/src/lib/changelog.ts b/website/src/lib/changelog.ts deleted file mode 100644 index 4f2da25..0000000 --- a/website/src/lib/changelog.ts +++ /dev/null @@ -1,197 +0,0 @@ -// Release notes, by `major.minor` series. Only the words live here: which version is the newest of a series, its -// dist-tag, its day and the versions before it come from npm when the site builds (see release.ts). - -export type ChangeKind = "breaking" | "feature" | "fix" | "deprecated" | "docs"; - -export interface Change { - kind: ChangeKind; - /** Plain text; wrap code in backticks — rendered as inline ``. */ - text: string; - /** The patch that brought it, when the series has several. */ - version?: string; -} - -export interface SeriesNotes { - /** `major.minor`, e.g. `"2.0"` */ - series: string; - summary?: string; - changes: Change[]; -} - -export const KIND_LABEL: Record = { - breaking: "Breaking", - feature: "Feature", - fix: "Fix", - deprecated: "Deprecated", - docs: "Docs", -}; - -// Curated from the git history (`git log vA..vB`). Newest first. -export const NOTES: SeriesNotes[] = [ - { - series: "2.0", - summary: - "A ground-up port to Qwik 2 (`@qwik.dev/core`) with feature parity with sonner 2.0.7. Zero runtime dependencies.", - changes: [ - { - kind: "breaking", - text: "Requires Qwik 2: `@qwik.dev/core` (>= 2.0.0-beta.37) is now a peer dependency. Qwik 1 (`@builder.io/qwik`) is no longer supported — stay on 1.x for Qwik 1 apps.", - }, - { - kind: "breaking", - text: "ESM-only package. The CommonJS builds (`*.qwik.cjs`) were removed.", - }, - { - kind: "breaking", - text: "String `title`/`description` values render as text instead of sanitized HTML; the DOMPurify dependency is gone. Pass JSX for rich content.", - }, - { - kind: "breaking", - text: "Icons (`icons`, per-toast `icon`, `loadingIcon`) take JSX (`JSXOutput`) instead of a `Component`.", - }, - { - kind: "breaking", - text: "Defaults aligned with sonner 2: viewport `offset` 32px → 24px (new `mobileOffset`, 16px) and swipe threshold 20px → 45px. Markup and stylesheet follow sonner's `data-sonner-*` contract.", - }, - { - kind: "breaking", - text: '`important` no longer switches a toast to `aria-live="assertive"`; all toasts are announced through the toaster\'s polite live region (sonner 2). `theme="system"` stops reading/writing `localStorage.theme`.', - }, - { - kind: "feature", - text: "Swipe to dismiss in any direction with drag dampening, configurable through `swipeDirections`.", - }, - { - kind: "feature", - text: "Multiple toasters: give a `` an `id` and target it with `toasterId`.", - }, - { - kind: "feature", - text: "`topLayer` prop renders toasts above native `` modals and fullscreen elements via the Popover API.", - }, - { - kind: "feature", - text: "`position`, `theme`, `richColors`, `dir` and `invert` accept a `Signal` to change at runtime.", - }, - { - kind: "feature", - text: "`useSonner()` hook, plus `toast.getToasts()` and `toast.getHistory()`.", - }, - { - kind: "feature", - text: "`toast.promise()` gains `unwrap()`, extended results (`{ message, ...options }`), JSX results and automatic error toasts for failed `Response`s and `Error` values.", - }, - { - kind: "feature", - text: "New options: per-toast `richColors` and `testId`, per-side `offset` objects, `mobileOffset`, `icons.close`, `customAriaLabel` and `toastOptions.closeButtonAriaLabel`.", - }, - { - kind: "feature", - text: "New exported types: `ToastClassnames`, `ToastToDismiss` and `Action`.", - }, - { kind: "fix", text: "The first toast animates its enter transition." }, - { - kind: "fix", - text: "Swiped toasts keep sliding off-screen instead of snapping back before fading.", - }, - { - kind: "fix", - text: "Pointer capture is set synchronously, so a swipe no longer sticks to the cursor.", - }, - { - kind: "fix", - text: "The Toaster subscribes on `qinit`, so toasts render in Safari/WebKit and when the Toaster sits below the fold.", - }, - { - kind: "deprecated", - text: "`pauseWhenPageIsHidden` — timers now always pause while the page is hidden.", - }, - { kind: "deprecated", text: "`loadingIcon` — use `icons.loading`." }, - ], - }, - { - series: "1.0", - summary: "The stable line for Qwik 1.", - changes: [ - { - kind: "feature", - text: "New build and publish pipeline, gated on the e2e suite.", - version: "1.0.0", - }, - { kind: "fix", text: "Toasts use the correct CSS class names.", version: "1.0.0" }, - { - kind: "fix", - text: "Fixed the `qwik-sonner/headless` path in `exports`.", - version: "1.0.1", - }, - { - kind: "fix", - text: "Corrected the type declarations of the headless entry.", - version: "1.0.2", - }, - { kind: "fix", text: "`closeButton` works as expected.", version: "1.0.3" }, - ], - }, - { - series: "0.4", - changes: [ - { kind: "feature", text: "`dir` prop: `rtl`, `ltr` or `auto`.", version: "0.4.0" }, - { - kind: "fix", - text: "Higher CSS specificity so app styles don't leak into toasts.", - version: "0.4.0", - }, - ], - }, - { - series: "0.3", - changes: [ - { - kind: "feature", - text: "Headless entry point: `qwik-sonner/headless` ships the core without styles.", - version: "0.3.2", - }, - { - kind: "feature", - text: "`theme` can change at runtime through a signal.", - version: "0.3.4", - }, - { kind: "feature", text: "Updated to Qwik 1.5.1.", version: "0.3.0" }, - { kind: "fix", text: "Headless types are exported.", version: "0.3.1" }, - ], - }, - { - series: "0.2", - changes: [ - { - kind: "feature", - text: "Pass attributes and event handlers through to the toast list.", - version: "0.2.0", - }, - { - kind: "fix", - text: "Resumability: the Toaster no longer eagerly loads its code.", - version: "0.2.0", - }, - { - kind: "fix", - text: "Removed `NodeJS` namespace types from the public API.", - version: "0.2.1", - }, - ], - }, - { - series: "0.1", - changes: [ - { kind: "feature", text: "`ToasterProps` is exported." }, - { kind: "fix", text: "`position` can change dynamically." }, - { kind: "fix", text: "Default styles are applied to the Toaster." }, - { kind: "docs", text: "Documentation website." }, - ], - }, - { - series: "0.0", - summary: "Initial release — a Qwik port of sonner.", - changes: [{ kind: "fix", text: "Toaster type declarations.", version: "0.0.2" }], - }, -]; diff --git a/website/src/lib/github.ts b/website/src/lib/github.ts new file mode 100644 index 0000000..e60115e --- /dev/null +++ b/website/src/lib/github.ts @@ -0,0 +1,68 @@ +// The release notes of qwik-sonner: the body of each published GitHub release, as GitHub renders it. vite.config.ts +// reads them when the site builds, next to npm.ts, so the changelog shows what each release says. +// Plain functions, no Vite globals: vite.config.ts runs them in Node. + +export interface ReleaseNotes { + /** the notes as HTML, rendered and sanitized by GitHub; empty when the release has none */ + html: string; + /** the release's page on GitHub */ + url: string; +} + +/** The notes of each published release, by version (the tag without its `v`). */ +export type Releases = Record; + +const RELEASES = "https://api.github.com/repos/diecodev/qwik-sonner/releases"; +const PER_PAGE = 100; + +interface GitHubRelease { + tag_name: string; + draft: boolean; + html_url: string; + body_html?: string | null; +} + +const readPage = async (page: number): Promise => { + const headers: Record = { + // `body_html`: the body as GitHub renders it on the release page + Accept: "application/vnd.github.html+json", + "X-GitHub-Api-Version": "2022-11-28", + "User-Agent": "qwik-sonner-website", + }; + // without a token GitHub allows 60 requests an hour per address, shared by every build on it + if (process.env.GITHUB_TOKEN) headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`; + const response = await fetch(`${RELEASES}?per_page=${PER_PAGE}&page=${page}`, { + headers, + signal: AbortSignal.timeout(10_000), + }); + if (!response.ok) throw new Error(`${response.status} ${response.statusText}`); + return (await response.json()) as GitHubRelease[]; +}; + +/** + * Reads the published releases (drafts wait for the approval on npm, see CONTRIBUTING.md). Offline or rate-limited, + * a local or preview build goes on without notes; in GitHub Actions (production deploys and the CI) it fails, so a + * deploy never drops the notes. + */ +export const readReleases = async (): Promise => { + try { + const releases: GitHubRelease[] = []; + for (let page = 1; ; page++) { + const batch = await readPage(page); + releases.push(...batch); + if (batch.length < PER_PAGE) break; + } + return Object.fromEntries( + releases + .filter((release) => !release.draft && release.tag_name.startsWith("v")) + .map((release) => [ + release.tag_name.slice(1), + { html: release.body_html?.trim() ?? "", url: release.html_url }, + ]), + ); + } catch (error) { + if (process.env.GITHUB_ACTIONS) throw new Error(`couldn't read ${RELEASES}: ${error}`); + console.warn(`couldn't read ${RELEASES} (${error}): the changelog shows no release notes`); + return {}; + } +}; diff --git a/website/src/lib/npm.ts b/website/src/lib/npm.ts index 2e2a754..11fad0d 100644 --- a/website/src/lib/npm.ts +++ b/website/src/lib/npm.ts @@ -119,42 +119,3 @@ export const lineOf = (npm: Npm, major: number): Line => { const name = tag ?? parts(version).pre[0] ?? "next"; return { ...base, prerelease: true, spec: `qwik-sonner@${name}` }; }; - -/** A section of the changelog: a `major.minor` series and its versions on npm. */ -export interface Series { - major: number; - minor: number; - /** the newest version of the series on npm, or the repo's (or `major.minor.0`) before any */ - version: string; - /** dist-tags pointing at `version` */ - tags: string[]; - /** the day it came out, `null` while it isn't on npm */ - date: string | null; - /** the other versions of the series, newest first */ - earlier: { version: string; date: string }[]; -} - -export const seriesOf = (npm: Npm, major: number, minor: number): Series => { - const inSeries = (version: string) => { - const [x, y] = parts(version).core; - return x === major && y === minor; - }; - const published = Object.keys(npm.dates).filter(inSeries).sort(newestFirst); - const version = published[0] ?? (inSeries(npm.version) ? npm.version : `${major}.${minor}.0`); - return { - major, - minor, - version, - tags: tagsOf(npm, version), - date: npm.dates[version] ?? null, - earlier: published.slice(1).map((other) => ({ version: other, date: npm.dates[other] })), - }; -}; - -/** Every `major.minor` series on npm plus the repo's, newest first: `["2.0", "1.0", "0.4", …]`. */ -export const seriesKeys = (npm: Npm) => { - const keys = new Set( - [...Object.keys(npm.dates), npm.version].map((v) => parts(v).core.slice(0, 2).join(".")), - ); - return [...keys].sort((a, b) => newestFirst(`${a}.0`, `${b}.0`)); -}; diff --git a/website/src/lib/release-notes.ts b/website/src/lib/release-notes.ts new file mode 100644 index 0000000..f40360b --- /dev/null +++ b/website/src/lib/release-notes.ts @@ -0,0 +1,8 @@ +import type { Releases } from "./github"; + +// The notes of each GitHub release: vite.config.ts reads them when the site builds and defines `__RELEASES__` with +// them. A module of its own, so only the changelog carries them. + +declare const __RELEASES__: Releases; + +export const RELEASES: Releases = __RELEASES__; diff --git a/website/src/lib/release.ts b/website/src/lib/release.ts index 28e7b7d..cb39222 100644 --- a/website/src/lib/release.ts +++ b/website/src/lib/release.ts @@ -3,7 +3,7 @@ import { lineOf, type Npm } from "./npm"; // The versions the site shows: vite.config.ts reads npm when the site builds and defines `__NPM__` with it, so they // reach the server and the browser as constants. -export { majorOf, seriesKeys, seriesOf, tagsOf, type Line, type Series } from "./npm"; +export { majorOf, newestFirst, tagsOf, type Line } from "./npm"; declare const __NPM__: Npm; diff --git a/website/src/routes/docs/changelog/index.tsx b/website/src/routes/docs/changelog/index.tsx index 893bc58..4012ac3 100644 --- a/website/src/routes/docs/changelog/index.tsx +++ b/website/src/routes/docs/changelog/index.tsx @@ -1,13 +1,10 @@ import { component$, useSignal } from "@qwik.dev/core"; import { Link, type DocumentHead } from "@qwik.dev/router"; -import { inline } from "~/components/docs/inline"; -import { KIND_LABEL, NOTES, type ChangeKind } from "~/lib/changelog"; -import { NPM, seriesKeys, seriesOf } from "~/lib/release"; +import { majorOf, newestFirst, NPM, tagsOf } from "~/lib/release"; +import { RELEASES } from "~/lib/release-notes"; import { GITHUB_URL, NPM_URL } from "~/lib/versions"; import styles from "../pages.module.css"; -const KIND_ORDER: ChangeKind[] = ["breaking", "feature", "fix", "deprecated", "docs"]; - const FILTERS = [ { id: "all", label: "All" }, { id: 2, label: "2.x · Qwik 2" }, @@ -17,17 +14,23 @@ const FILTERS = [ type Filter = (typeof FILTERS)[number]["id"]; -// Every series npm knows (plus the repo's, before it's published) and every -// series with notes, newest first; versions, tags and days come from npm. -const SERIES = [...new Set([...seriesKeys(NPM), ...NOTES.map((n) => n.series)])] - .sort((a, b) => { - const [am, an] = a.split(".").map(Number); - const [bm, bn] = b.split(".").map(Number); - return bm - am || bn - an; - }) - .map((key) => { - const [major, minor] = key.split(".").map(Number); - return { key, ...seriesOf(NPM, major, minor), notes: NOTES.find((n) => n.series === key) }; +// Every version on npm, newest first, with its notes from the GitHub release +// of its tag; versions, tags and days come from npm. +const VERSIONS = Object.keys(NPM.dates) + .sort(newestFirst) + .map((version, index, all) => { + const major = majorOf(version); + return { + version, + major, + date: NPM.dates[version], + tags: tagsOf(NPM, version), + notes: RELEASES[version] ?? null, + /** the version before it, for the commits between both */ + previous: all[index + 1] ?? null, + /** the newest version of its major carries the link to that major's docs */ + newestOfMajor: all.findIndex((other) => majorOf(other) === major) === index, + }; }); const formatDate = (iso: string) => @@ -41,20 +44,19 @@ const formatDate = (iso: string) => export default component$(() => { const filter = useSignal("all"); - const visible = SERIES.filter((s) => filter.value === "all" || s.major === filter.value); + const visible = VERSIONS.filter((v) => filter.value === "all" || v.major === filter.value); return ( <>

Changelog

- Every release line of qwik-sonner, newest first. Versions, dist-tags and dates come straight - from{" "} + Every version of qwik-sonner, newest first. Versions, dist-tags and dates come straight from{" "} npm - ; releases are tagged on{" "} - - GitHub + ; the notes are the{" "} + + GitHub releases .

@@ -74,105 +76,68 @@ export default component$(() => { ))} - {visible.map((series) => { - const index = SERIES.indexOf(series); - const previous = SERIES.slice(index + 1).find((s) => s.date !== null); - const notes = series.notes; - const kinds = KIND_ORDER.filter((k) => notes?.changes.some((c) => c.kind === k)); + {VERSIONS.length === 0 ? ( +

+ npm couldn't be read when this page was built, so there are no versions to show. +

+ ) : null} - return ( -
-
- {series.date ? ( - - ) : ( - Unreleased - )} - {series.major >= 2 ? "Qwik 2" : "Qwik 1"} -
-
-

- - {series.version} + {visible.map((release) => ( +
+
+ + {release.major >= 2 ? "Qwik 2" : "Qwik 1"} +
+
+

+ + {release.version} + + {release.tags.map((tag) => ( + + {tag} + + ))} +

+ {release.notes?.html ? ( + // rendered and sanitized by GitHub (see lib/github.ts) +
+ ) : ( +

No release notes for this version.

+ )} +
+ + npm + + {release.notes ? ( + + GitHub release - {series.tags.map((tag) => ( - - {tag} - - ))} - {series.date === null ? unreleased : null} -

- {notes?.summary ?

{inline(notes.summary)}

: null} - {kinds.length ? ( -
    - {kinds.flatMap((kind) => - notes!.changes - .filter((c) => c.kind === kind) - .map((change, i) => ( -
  • - - {KIND_LABEL[kind]} - - - {inline(change.text)} - {change.version && series.earlier.length ? ( - {change.version} - ) : null} - -
  • - )), - )} -
- ) : ( -

No release notes for this series yet.

- )} - {series.earlier.length ? ( -

- Earlier in {series.key}:{" "} - {series.earlier.map(({ version, date }, i) => ( - - {i > 0 ? " · " : null} - - {version} - {" "} - ({formatDate(date)}) - - ))} -

) : null} -
- {series.date ? ( - - npm - - ) : null} - {series.date ? ( - - {previous ? "Commits" : "Source"} - - ) : null} - {series.major >= 2 ? ( - Migration guide - ) : series.major === 1 ? ( - v1 docs - ) : null} -
+ + {release.previous ? "Commits" : "Source"} + + {!release.newestOfMajor ? null : release.major >= 2 ? ( + Migration guide + ) : release.major === 1 ? ( + v1 docs + ) : null}
-
- ); - })} + + + ))} ); }); @@ -182,7 +147,8 @@ export const head: DocumentHead = { meta: [ { name: "description", - content: "Release notes for every qwik-sonner series, with versions and dates from npm.", + content: + "Release notes for every qwik-sonner version, from its GitHub release, with dates from npm.", }, ], }; diff --git a/website/src/routes/docs/pages.module.css b/website/src/routes/docs/pages.module.css index bc30f04..3a2d39b 100644 --- a/website/src/routes/docs/pages.module.css +++ b/website/src/routes/docs/pages.module.css @@ -377,72 +377,37 @@ box-shadow: inset 0 0 0 1px var(--success-border); } -.changes { - margin: 12px 0 0 !important; - padding: 0 !important; - list-style: none; -} - -.changes li { - display: grid; - grid-template-columns: 92px minmax(0, 1fr); - gap: 12px; - margin: 0 !important; - padding: 7px 0; +.notes { font-size: 14px; line-height: 1.6; } -@media (max-width: 480px) { - .changes li { - grid-template-columns: minmax(0, 1fr); - gap: 2px; - } +/* GitHub's HTML: the release body, as on the release page */ +.release .notes > :global(:first-child) { + margin-top: 0; } -.kind { - display: inline-flex; - align-items: center; - gap: 6px; - height: 22px; - font-size: 12px; - font-weight: 500; +.release .notes :global(:is(h1, h2, h3, h4, h5, h6)) { + margin: 20px 0 6px; + font-size: 13px; + font-weight: 600; + line-height: 1.4; + letter-spacing: 0.01em; color: var(--gray11); } -.kind::before { - content: ""; - width: 7px; - height: 7px; - border-radius: 50%; - background: var(--k, var(--gray8)); -} - -.kind[data-kind="breaking"] { - --k: var(--error-text); +.release .notes :global(ul) { + margin: 0 0 12px; } -.kind[data-kind="feature"] { - --k: var(--success-text); +.release .notes :global(li) { + margin: 2px 0; } -.kind[data-kind="fix"] { - --k: var(--info-text); -} - -.kind[data-kind="deprecated"] { - --k: var(--warning-text); -} - -.since { - margin-left: 8px; - padding: 1px 6px; - border-radius: 999px; +.release .notes :global(samp) { font-family: var(--font-mono); - font-size: 11px; + font-size: 12px; color: var(--gray10); - background: var(--gray3); - white-space: nowrap; } .noNotes { @@ -451,18 +416,6 @@ color: var(--gray10); } -.earlier { - margin: 14px 0 0 !important; - font-size: 13px; - color: var(--gray10); -} - -.earlier a { - font-family: var(--font-mono); - font-size: 12.5px; - color: var(--gray11); -} - .releaseLinks { display: flex; flex-wrap: wrap; diff --git a/website/vite.config.ts b/website/vite.config.ts index d3ccdc6..587b46c 100644 --- a/website/vite.config.ts +++ b/website/vite.config.ts @@ -3,17 +3,19 @@ import { qwikVite } from "@qwik.dev/core/optimizer"; import { qwikRouter } from "@qwik.dev/router/vite"; import tsconfigPaths from "vite-tsconfig-paths"; import library from "../package.json" with { type: "json" }; +import { readReleases } from "./src/lib/github"; import { readNpm } from "./src/lib/npm"; export default defineConfig(async (): Promise => { - // The published versions, their dist-tags and days, for src/lib/release.ts: - // read once per build (or dev-server start) and inlined as a constant, so - // nothing hits the registry at runtime. - const npm = await readNpm(library.version); + // The published versions, their dist-tags and days, and the notes of each + // GitHub release, for src/lib/release.ts: read once per build (or dev-server + // start) and inlined as constants, so nothing hits npm or GitHub at runtime. + const [npm, releases] = await Promise.all([readNpm(library.version), readReleases()]); return { define: { __NPM__: JSON.stringify(npm), + __RELEASES__: JSON.stringify(releases), }, plugins: [qwikRouter(), qwikVite(), tsconfigPaths()], server: {