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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ jobs:
- name: Svelte check
run: pnpm check

- name: Test
run: pnpm test

- name: Build site
run: pnpm build
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ or price structured data: the site publishes neither, and invented ratings are
spam. Submitting the sitemap in Google Search Console and 百度搜索资源平台 is a
manual step after deploy.

## Agent results

`/results` and `/zh-CN/results` show the Wright Agent Score. The page holds no
result data: the browser fetches `https://releases.wrightkit.dev/bench/latest.json`
(`wright-agent-results/v1`, published by `wrightkit/wright`), so new results need
no redeploy. The fields the page reads are typed in `src/lib/bench.ts`; a missing
file shows the empty state and another schema version shows the older-format
state. The release bucket must allow cross-origin `GET` from `wrightkit.dev`.

## Stack

- SvelteKit with `@sveltejs/adapter-static`
Expand All @@ -87,6 +96,7 @@ Requires Node.js 20.19+ and `pnpm`.
pnpm install
pnpm dev
pnpm check
pnpm test
```

## Build and preview
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"dev": "vite dev",
"build": "vite build && node scripts/verify-build.mjs",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"test": "vitest run",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.10",
Expand All @@ -18,6 +19,7 @@
"svelte-check": "^4.7.6",
"tailwindcss": "^4.3.3",
"typescript": "^6.0.3",
"vite": "^8.3.1"
"vite": "^8.3.1",
"vitest": "^5.0.3"
}
}
162 changes: 162 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 27 additions & 2 deletions scripts/verify-build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,33 @@ for (const image of images) {
}
}

const resultsPages = [
{ file: 'results.html', lang: 'en', canonical: `${SITE_URL}/results`, title: 'Wright Agent Score' },
{ file: 'zh-CN/results.html', lang: 'zh-CN', canonical: `${SITE_URL}/zh-CN/results`, title: 'Wright Agent Score' }
];
for (const page of resultsPages) {
const path = resolve(ROOT_DIR, 'build', page.file);
if (!existsSync(path)) {
console.error(`[verify-build] Error: build/${page.file} does not exist.`);
process.exit(1);
}
const html = readFileSync(path, 'utf8');
const expected = [
`<html lang="${page.lang}"`,
`<link rel="canonical" href="${page.canonical}"`,
`<link rel="alternate" hreflang="x-default" href="${SITE_URL}/results"`,
page.title
];
for (const snippet of expected) {
if (!html.includes(snippet)) {
console.error(`[verify-build] Error: build/${page.file} is missing: ${snippet}`);
process.exit(1);
}
}
}

const sitemap = readFileSync(resolve(ROOT_DIR, 'build/sitemap.xml'), 'utf8');
for (const page of pages) {
for (const page of [...pages, ...resultsPages]) {
if (!sitemap.includes(`<loc>${page.canonical}</loc>`)) {
console.error(`[verify-build] Error: sitemap.xml is missing ${page.canonical}`);
process.exit(1);
Expand All @@ -112,4 +137,4 @@ if (!robots.includes(`Sitemap: ${SITE_URL}/sitemap.xml`)) {
process.exit(1);
}

console.log(`[verify-build] OK: ${pages.length} localized pages, share images, and sitemap verified.`);
console.log(`[verify-build] OK: ${pages.length + resultsPages.length} localized pages, share images, and sitemap verified.`);
Loading
Loading