From be2490cb81389241a150e5dd1dd26b3bbbe96ee4 Mon Sep 17 00:00:00 2001 From: Ashunar0 Date: Wed, 21 Oct 2026 13:27:42 +0900 Subject: [PATCH] fix(init): generate .void types on install in scaffolded starters Starters extend .void/tsconfig.json, which lists db.d.ts and routes.d.ts, but nothing generates them until the first dev or build. .void/ is gitignored, so fresh clones hit the same missing files. Run void prepare from postinstall so both cases get the types on install. --- packages/void/src/cli/init.ts | 1 + packages/void/src/cli/template.ts | 3 +++ packages/void/test/unit/init.test.ts | 2 ++ 3 files changed, 6 insertions(+) diff --git a/packages/void/src/cli/init.ts b/packages/void/src/cli/init.ts index 2fb949629..a1a1c9341 100644 --- a/packages/void/src/cli/init.ts +++ b/packages/void/src/cli/init.ts @@ -241,6 +241,7 @@ const EMPTY_PROJECT_ALLOWED_SCRIPTS: Record | undefined> = { dev: new Set(['vite', 'vp dev']), build: new Set(['vite build', 'vp build']), preview: new Set(['vite preview', 'vp preview']), + postinstall: new Set(['void prepare']), }; const EMPTY_PROJECT_STARTER_SCRIPT_COMMANDS = new Set( Object.values(EMPTY_PROJECT_ALLOWED_SCRIPTS).flatMap((commands) => diff --git a/packages/void/src/cli/template.ts b/packages/void/src/cli/template.ts index ba69109ef..013aa8ac8 100644 --- a/packages/void/src/cli/template.ts +++ b/packages/void/src/cli/template.ts @@ -189,6 +189,9 @@ export function createPagesStarterTemplate(options: { dev: toolchain === 'vite-plus' ? 'vp dev' : 'vite', build: toolchain === 'vite-plus' ? 'vp build' : 'vite build', preview: toolchain === 'vite-plus' ? 'vp preview' : 'vite preview', + // `.void/` is gitignored, so fresh clones and new scaffolds need the + // generated types before the editor opens tsconfig.json. + postinstall: 'void prepare', }, dependencies: { ...SCAFFOLD_BASE_DEPENDENCIES, diff --git a/packages/void/test/unit/init.test.ts b/packages/void/test/unit/init.test.ts index 7261958d5..b35c3e13d 100644 --- a/packages/void/test/unit/init.test.ts +++ b/packages/void/test/unit/init.test.ts @@ -1205,6 +1205,7 @@ describe('isScaffoldableEmptyProject', () => { dev: 'vp dev', build: 'vp build', preview: 'vp preview', + postinstall: 'void prepare', }, dependencies: { hono: '^4.11.9', @@ -1321,6 +1322,7 @@ describe('isScaffoldableEmptyProject', () => { expect(pkg.scripts.dev).toBe('vp dev'); expect(pkg.scripts.build).toBe('vp build'); expect(pkg.scripts.preview).toBe('vp preview'); + expect(pkg.scripts.postinstall).toBe('void prepare'); const reactViteConfig = readFileSync(join(root, 'vite.config.ts'), 'utf-8'); expect(reactViteConfig).toContain('from "@void/react/plugin"');