From ee2628642d980b59a16bc28aa3d20651150de419 Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Wed, 6 May 2026 23:31:28 -0600 Subject: [PATCH] chore(lint): generate content-collections before tsc/lint Adds a `content:build` script and `pretest` hook so `pnpm test` works from a fresh clone. The `.content-collections/generated/` folder is otherwise only produced by Vite during dev/build, leaving standalone tsc and lint runs unable to resolve the `content-collections` module. --- package.json | 2 ++ scripts/build-content-collections.mjs | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 scripts/build-content-collections.mjs diff --git a/package.json b/package.json index 65210b30..9f83f5d3 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "build": "vite build", "start": "vite start", "start:prod": "pnpm run with-env node scripts/run-built-server.mjs", + "content:build": "node scripts/build-content-collections.mjs", "lint": "oxlint --type-aware --disable-nested-config", "format": "oxfmt --write", "db:generate": "drizzle-kit generate", @@ -21,6 +22,7 @@ "docs:webhooks:plan": "tsx scripts/sync-docs-webhooks.ts --dry-run", "docs:webhooks:sync": "tsx scripts/sync-docs-webhooks.ts", "husky": "pnpm run format && pnpm run test && pnpm run test:smoke", + "pretest": "pnpm run content:build", "test": "run-p test:tsc test:lint", "test:tsc": "tsc", "test:lint": "pnpm run lint", diff --git a/scripts/build-content-collections.mjs b/scripts/build-content-collections.mjs new file mode 100644 index 00000000..d89662b9 --- /dev/null +++ b/scripts/build-content-collections.mjs @@ -0,0 +1,5 @@ +import { createBuilder } from '@content-collections/core' +import path from 'node:path' + +const builder = await createBuilder(path.resolve('content-collections.ts')) +await builder.build()