From 877dc663a3f6629975be71ccfc6dbfe7d42755a9 Mon Sep 17 00:00:00 2001 From: Script Raccoon Date: Wed, 21 Oct 2026 06:34:47 +0200 Subject: [PATCH 1/2] reload browser when content page changes --- CLAUDE.md | 2 +- vite.config.ts | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index f75b88c29..2a78c256a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -46,7 +46,7 @@ Database (all scripts run with `tsx` and are type-checked by `pnpm check` via th - `pnpm db:snapshot`: copy the database to `static/databases/catdat-snapshot.db` for the download page. - `pnpm db:update`: run `db:seed`, `db:deduce`, `db:test`, and `db:snapshot` in sequence. **This is the standard command after editing any YAML data.** Use `--watch` to rerun it whenever a file in `database/data/` changes. - `pnpm db:text`: fast path for text-only changes to existing structures (names, notations, alternative notations, descriptions, nLab links, comments, keywords, objects and morphisms of categories, proofs of property assignments), properties (descriptions, nLab links), and implications (proofs). It updates changed fields without rebuilding relations or running deductions. Special objects, special morphisms, and special morphism rules are not covered. Supports `--watch`. -- After `db:update`, and after `db:text` when it changed something, the script writes a timestamp to `database/.last-update` (gitignored). A Vite plugin in [vite.config.ts](vite.config.ts) watches this file and reloads the browser while `pnpm dev` is running. +- After `db:update`, and after `db:text` when it changed something, the script writes a timestamp to `database/.last-update` (gitignored). A Vite plugin in [vite.config.ts](vite.config.ts) watches this file and the Markdown files in `content/`, and reloads the browser when one of them changes while `pnpm dev` is running. - `pnpm db:redundancies`: report property assignments that could already be deduced from others. It reports at most one per structure and kind, so rerun it after each removal. Not part of `db:update`. - `pnpm db:combinations [ ...]`: list the combinations p ∧ ¬q that the given structures (or their duals) witness and that no other structure in the database witnesses. Needs only the IDs, not the type (all IDs must have the same type). Useful to judge whether a structure adds new information. - `pnpm db:structure [group]`: print the property IDs of a structure, grouped into `satisfied`, `unsatisfied`, `unknown`, and `undecidable` with counts (a terminal version of the structure detail page). An optional group argument restricts the output to that group, e.g. `pnpm db:structure Ab unsatisfied`. Needs only the ID, not the type. diff --git a/vite.config.ts b/vite.config.ts index c674bc8e5..dc0c332b5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,22 +3,33 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' import { defineConfig, type Plugin } from 'vite' import { sveltekit } from '@sveltejs/kit/vite' import { UPDATE_MARKER_PATH } from './shared/db.ts' +import path from 'node:path' + +const CONTENT_FOLDER = path.resolve('content') /** * Reloads the browser when a database script marks the database as updated + * or when a content page is edited */ -function reload_on_database_update(): Plugin { +function reload_on_data_update(): Plugin { return { - name: 'reload-on-database-update', + name: 'reload-on-data-update', apply: 'serve', configureServer(server) { - server.watcher.add(UPDATE_MARKER_PATH) + server.watcher.add([UPDATE_MARKER_PATH, CONTENT_FOLDER]) function on_change(file: string) { - if (file === UPDATE_MARKER_PATH) server.ws.send({ type: 'full-reload' }) + const is_content_page = + path.dirname(file) === CONTENT_FOLDER && file.endsWith('.md') + if (file === UPDATE_MARKER_PATH || is_content_page) { + server.ws.send({ type: 'full-reload' }) + } } - server.watcher.on('add', on_change).on('change', on_change) + server.watcher + .on('add', on_change) + .on('change', on_change) + .on('unlink', on_change) } } } @@ -29,6 +40,6 @@ export default defineConfig({ preprocess: vitePreprocess(), adapter: adapter() }), - reload_on_database_update() + reload_on_data_update() ] }) From bec836b63ef48ba5b01906c93f961bc1583986aa Mon Sep 17 00:00:00 2001 From: Script Raccoon Date: Wed, 21 Oct 2026 06:35:21 +0200 Subject: [PATCH 2/2] update description of content list page --- src/routes/content/+page.svelte | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/routes/content/+page.svelte b/src/routes/content/+page.svelte index faddb1661..375465d94 100644 --- a/src/routes/content/+page.svelte +++ b/src/routes/content/+page.svelte @@ -6,15 +6,12 @@

Content pages

-

- For long-form content, particularly longer proofs and reusable lemmas, we use content - pages. -

+

For long-form content and reusable lemmas, we use content pages.

    {#each data.pages as page}