Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 38 additions & 50 deletions site/bun.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
"sync:blog": "bun scripts/sync-blog.ts",
"sync:reader": "bun scripts/sync-reader.ts",
"build:theme": "bun scripts/build-theme-bootstrap.ts",
"dev": "bun run sync:readme && bun run sync:docs && bun run sync:blog && bun run sync:reader && bun run build:theme && next dev --webpack",
"prebuild": "bun run sync:readme && bun run sync:docs && bun run sync:blog && bun run sync:reader && bun run build:theme",
"dev": "bun run sync:icons && bun run sync:readme && bun run sync:docs && bun run sync:blog && bun run sync:reader && bun run build:theme && next dev --webpack",
"prebuild": "bun run sync:icons && bun run sync:readme && bun run sync:docs && bun run sync:blog && bun run sync:reader && bun run build:theme",
"build": "next build --webpack",
"postbuild": "bun test ./tests/runtime.test.ts",
"start": "next start",
"lint": "eslint . --ignore-pattern .next",
"test": "bun test ./tests/source.test.ts ./tests/home.test.tsx ./scripts/readme-html.test.ts ./tests/ui-styles.test.tsx ./tests/hosted.test.ts ./tests/blog.test.tsx ./tests/launch-pages.test.tsx",
"typecheck": "tsc --noEmit",
"check": "bun run check:theme && bun run sync:readme && bun run sync:docs && bun run sync:blog && bun run sync:reader && bun run build:theme && bun run test && bun run lint && bun run typecheck && bun run build"
"check": "bun run check:theme && bun run sync:icons && bun run sync:readme && bun run sync:docs && bun run sync:blog && bun run sync:reader && bun run build:theme && bun run test && bun run lint && bun run typecheck && bun run build",
"sync:icons": "bun scripts/sync-icons.ts"
},
"dependencies": {
"@hraness/design-kit": "github:hraness/design-kit#v0.21.0",
"@hraness/design-kit": "github:hraness/design-kit#v0.22.0",
"@hraness/site-footer": "github:hraness/site-footer#v0.19.2",
"@hraness/ui": "github:hraness/ui#v0.5.18",
"@hraness/web-discovery": "github:hraness/web-discovery#v0.9.0",
Expand Down
5 changes: 4 additions & 1 deletion site/public/icons/agent-skill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion site/public/icons/backlinks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion site/public/icons/capture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion site/public/icons/cli.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion site/public/icons/git-provenance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion site/public/icons/markdown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion site/public/icons/scopes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion site/public/icons/sdk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion site/public/icons/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions site/scripts/sync-icons.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { describe, expect, test } from "bun:test";
import { existsSync, readdirSync, readFileSync } from "node:fs";
import { join, resolve } from "node:path";

const SET = "wordcell";
const ICONS_OUT = "public/icons";
const MARKS_OUT = "public/marks";

const specUrl = import.meta.resolve(`@hraness/design-kit/icons/sets/${SET}.json`);
const setsDir = decodeURIComponent(new URL(".", specUrl).pathname);
const iconsDir = resolve(setsDir, "..");

interface SetSpec {
members: { slug: string }[];
marks?: { slug: string }[];
references?: { slug: string; svg: string }[];
}

const spec = JSON.parse(readFileSync(`${setsDir}${SET}.json`, "utf8")) as SetSpec;
const expected = new Map<string, [string, string]>();
for (const member of spec.members) {
expected.set(`${member.slug}.svg`, [ICONS_OUT, `${SET}/${member.slug}.svg`]);
}
for (const mark of spec.marks ?? []) {
expected.set(`${mark.slug}.svg`, [MARKS_OUT, `${SET}/${mark.slug}.svg`]);
}
for (const reference of spec.references ?? []) {
if (existsSync(join(ICONS_OUT, `${reference.slug}.svg`))) {
expected.set(`${reference.slug}.svg`, [ICONS_OUT, reference.svg.replace(/^\.\.\//u, "")]);
}
}

describe("synced topic icons", () => {
test("public icons and marks carry exactly the vetted design-kit set, byte-for-byte", () => {
expect(expected.size).toBeGreaterThan(0);
for (const [name, [out, packagePath]] of expected) {
const local = join(out, name);
expect(existsSync(local), `${local} missing — run bun run sync:icons`).toBe(true);
expect(
readFileSync(local).equals(readFileSync(join(iconsDir, packagePath))),
`${local} differs from the pinned package icon`,
).toBe(true);
}
for (const file of readdirSync(ICONS_OUT)) {
if (file.endsWith(".svg")) {
expect(expected.has(file), `${ICONS_OUT}/${file} is not declared by the ${SET} icon set`).toBe(true);
}
}
});
});
54 changes: 54 additions & 0 deletions site/scripts/sync-icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Sync the vetted wordcell icon set from the pinned @hraness/design-kit
* release into public/icons/ and the product mark into public/marks/.
*
* Usage: bun run sync:icons
*/

import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
import { join, resolve } from "node:path";

const SET = "wordcell";
const ICONS_OUT = "public/icons";
const MARKS_OUT = "public/marks";

const specUrl = import.meta.resolve(`@hraness/design-kit/icons/sets/${SET}.json`);
const setsDir = decodeURIComponent(new URL(".", specUrl).pathname);
const iconsDir = resolve(setsDir, "..");

interface SetSpec {
members: { slug: string }[];
marks?: { slug: string }[];
references?: { slug: string; svg: string }[];
}

const spec = JSON.parse(readFileSync(`${setsDir}${SET}.json`, "utf8")) as SetSpec;
const files = new Map<string, [string, string]>(); // local name -> [out dir, package path]
for (const member of spec.members) {
files.set(`${member.slug}.svg`, [ICONS_OUT, `${SET}/${member.slug}.svg`]);
}
for (const mark of spec.marks ?? []) {
files.set(`${mark.slug}.svg`, [MARKS_OUT, `${SET}/${mark.slug}.svg`]);
}
for (const reference of spec.references ?? []) {
// References are generation-time family anchors; sync only the ones the
// product actually serves today.
if (existsSync(join(ICONS_OUT, `${reference.slug}.svg`))) {
files.set(`${reference.slug}.svg`, [ICONS_OUT, reference.svg.replace(/^\.\.\//u, "")]);
}
}

const written: string[] = [];
for (const [name, [out, packagePath]] of [...files].sort()) {
mkdirSync(out, { recursive: true });
writeFileSync(join(out, name), readFileSync(join(iconsDir, packagePath)));
written.push(`${out}/${name}`);
}
for (const dir of [ICONS_OUT, MARKS_OUT]) {
for (const file of readdirSync(dir)) {
if (file.endsWith(".svg") && !files.has(file)) {
throw new Error(`${dir}/${file} is not declared by the ${SET} icon set — remove it or regenerate the set.`);
}
}
}
console.log(`synced ${written.length} icons from @hraness/design-kit (${SET})`);
2 changes: 1 addition & 1 deletion site/tests/source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe("Wordcell site source contract", () => {
read("app/readme.generated.ts"),
]);
expect(packageJson).toContain('"@hraness/ui": "github:hraness/ui#v0.5.18"');
expect(packageJson).toContain('"@hraness/design-kit": "github:hraness/design-kit#v0.21.0"');
expect(packageJson).toContain('"@hraness/design-kit": "github:hraness/design-kit#v0.22.0"');
expect(home).toContain('import { AskAiAboutThis } from "@hraness/ui"');
expect(home).toContain('<AskAiAboutThis className="ask-ai" url="https://wordcell.io" />');
expect(docs).toContain('<AskAiAboutThis className="ask-ai" url="https://wordcell.io/docs" />');
Expand Down
Loading