diff --git a/README.md b/README.md index 8a7a8c4..59ce745 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,13 @@ version, title, author, repository, description and supported platforms), `src/index.ts` (manifest, navigation and routes), and `src/page.ts` (sidebar UI). The example serves its page at `/ui/` and preserves JSON at `/`. +The registry previews come from `temps.screenshots` in `package.json`. Replace +the light/dark PNGs in `assets/` with screenshots of your own plugin, and update +each repository-relative `path`, descriptive `alt`, and optional `caption`. +Capture only the plugin UI: never include credentials, account details, or +private project data. The catalog resolves these paths at the plugin's pinned +Git commit; changes appear after merging and refreshing the GitHub catalog. + ```sh bun install --frozen-lockfile bun test diff --git a/assets/plugin-dark.png b/assets/plugin-dark.png new file mode 100644 index 0000000..b242d20 Binary files /dev/null and b/assets/plugin-dark.png differ diff --git a/assets/plugin-light.png b/assets/plugin-light.png new file mode 100644 index 0000000..902e071 Binary files /dev/null and b/assets/plugin-light.png differ diff --git a/package.json b/package.json index 4dc3f29..d6931c9 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,18 @@ "title": "My plugin", "category": "Development", "entrypoint": "src/index.ts", + "screenshots": [ + { + "path": "assets/plugin-light.png", + "alt": "My plugin in light mode, showing its online status and hello-world API response", + "caption": "The starter plugin running inside Temps in light mode." + }, + { + "path": "assets/plugin-dark.png", + "alt": "My plugin in dark mode, showing its online status and hello-world API response", + "caption": "The same plugin UI adapts to dark mode." + } + ], "platforms": ["linux-amd64-gnu", "linux-arm64-gnu", "linux-amd64-musl", "linux-arm64-musl", "darwin-amd64", "darwin-arm64"] } } diff --git a/src/screenshots.test.ts b/src/screenshots.test.ts new file mode 100644 index 0000000..e3dd773 --- /dev/null +++ b/src/screenshots.test.ts @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2024-2026 Temps Contributors +// SPDX-License-Identifier: MIT OR Apache-2.0 +import { expect, test } from "bun:test"; +import pkg from "../package.json"; + +test("registry screenshots reference real PNG assets with accessible descriptions", async () => { + expect(pkg.temps.screenshots).toHaveLength(2); + for (const screenshot of pkg.temps.screenshots) { + expect(screenshot.path).toMatch(/^assets\/[a-z-]+\.png$/); + expect(screenshot.alt.length).toBeGreaterThan(20); + const image = Bun.file(new URL(`../${screenshot.path}`, import.meta.url)); + expect(await image.exists()).toBe(true); + const bytes = new Uint8Array(await image.arrayBuffer()); + expect(Array.from(bytes.slice(0, 8))).toEqual([137, 80, 78, 71, 13, 10, 26, 10]); + expect(bytes.length).toBeLessThan(500_000); + } +});