mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
fix(nuxi): generate types with nuxi generate
(#1625)
This commit is contained in:
parent
288e771205
commit
348c82d55a
@ -3,6 +3,7 @@ import { resolve } from 'pathe'
|
||||
import { isNuxt3 } from '@nuxt/kit'
|
||||
|
||||
import { loadKit } from '../utils/kit'
|
||||
import { writeTypes } from '../utils/prepare'
|
||||
import { defineNuxtCommand } from './index'
|
||||
|
||||
export default defineNuxtCommand({
|
||||
@ -16,13 +17,16 @@ export default defineNuxtCommand({
|
||||
const rootDir = resolve(args._[0] || '.')
|
||||
|
||||
const { loadNuxt } = await loadKit(rootDir)
|
||||
const nuxt = await loadNuxt({ rootDir })
|
||||
const nuxt = await loadNuxt({ rootDir, config: { _export: true } })
|
||||
|
||||
if (isNuxt3(nuxt)) {
|
||||
throw new Error('`nuxt generate` is not supported in Nuxt 3. Please follow this RFC: https://git.io/JKfvx')
|
||||
} else {
|
||||
// Generate types and close nuxt instance
|
||||
await writeTypes(nuxt)
|
||||
await nuxt.close()
|
||||
// Forwards argv to `nuxt generate`
|
||||
await execa('npx nuxt', process.argv.slice(2), { stdio: 'inherit' })
|
||||
await execa('npx', ['nuxt', ...process.argv.slice(2)], { stdio: 'inherit' })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user