2021-10-07 13:53:31 +00:00
|
|
|
import { resolve } from 'pathe'
|
2021-10-13 10:44:54 +00:00
|
|
|
import { loadKit } from '../utils/kit'
|
2021-10-07 13:53:31 +00:00
|
|
|
import { writeTypes } from '../utils/prepare'
|
2021-07-26 14:46:19 +00:00
|
|
|
import { defineNuxtCommand } from './index'
|
|
|
|
|
|
|
|
export default defineNuxtCommand({
|
|
|
|
meta: {
|
|
|
|
name: 'prepare',
|
2021-08-10 17:37:03 +00:00
|
|
|
usage: 'npx nuxi prepare',
|
2021-07-26 14:46:19 +00:00
|
|
|
description: 'Prepare nuxt for development/build'
|
|
|
|
},
|
|
|
|
async invoke (args) {
|
|
|
|
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
|
|
|
const rootDir = resolve(args._[0] || '.')
|
|
|
|
|
2021-10-13 10:44:54 +00:00
|
|
|
const { loadNuxt } = await loadKit(rootDir)
|
2021-07-26 14:46:19 +00:00
|
|
|
const nuxt = await loadNuxt({ rootDir })
|
|
|
|
|
2021-10-07 13:53:31 +00:00
|
|
|
await writeTypes(nuxt)
|
2021-07-26 14:46:19 +00:00
|
|
|
}
|
|
|
|
})
|