-
Notifications
You must be signed in to change notification settings - Fork 108
hub:db (and @nuxthub/db) does not provide TypeScript definition on nuxt db generate #792
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
In @nuxthub/core v0.10.5, the database schema type definitions (.d.mts) are not generated during nuxt prepare or nuxt db generate, contrary to the intent of PR #758. The types are only generated when running nuxt dev, which breaks CI/CD workflows that rely on nuxt prepare followed by nuxt typecheck.
Steps to reproduce
- Install
@nuxthub/[email protected] - Create a database schema in
server/db/schema.ts - Run
rm -rf .nuxt node_modules/@nuxthub/db && pnpm prepare - Check for
.nuxt/hub/db/schema.d.mtsandnode_modules/@nuxthub/db/schema.d.mts - Run
nuxt typecheck
Expected behavior
.nuxt/hub/db/schema.d.mtsandnode_modules/@nuxthub/db/schema.d.mtsshould be generated afternuxt prepare- Type checking should pass without requiring
nuxt devto be run first - This was the intended behavior of PR fix(db): generate schema types during nuxt prepare #758
Actual behavior
- Schema type definition files are NOT generated by
nuxt prepare - Files are only generated when
nuxt devis started nuxt typecheckfails with errors like:Module '"hub:db"' has no exported member 'db'
Root cause
In src/db/setup.ts, the buildDatabaseSchema() call is inside an if (!nuxt.options._prepare) block with app:templatesGenerated hook, which only fires during nuxt dev, not during nuxt prepare and nuxt db generate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working