Skip to content

DB schema is not generated on nuxt prepare hook #755

@ExEr7um

Description

@ExEr7um

Describe the bug
DB schema is not generated on nuxt prepare hook.

core/src/db/setup.ts

Lines 237 to 241 in 7e00657

if (!nuxt.options._prepare) {
nuxt.hooks.hookOnce('app:templatesGenerated', async () => {
await buildDatabaseSchema(nuxt.options.buildDir, { relativeDir: nuxt.options.rootDir })
})
}

The problem is that I have a CI setup with nuxt typecheck command. And it fails when I use any binding from DB because types are not generated yet.

Steps to reproduce
Steps to reproduce the behavior:

  1. Use types from hub:db (or auto-imports).
  2. Remove .nuxt folder and make clean deps install.
  3. Run nuxt typecheck

Expected behavior
Schema is generated either on nuxt prepare or nuxt typecheck. I think better solution would be generate it on prepare hook, because if it's not generated after deps installation, then VS Code will show type errors until you run dev script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions