mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
fix(nuxi): print resolved public directory after generate (#7577)
This commit is contained in:
parent
b933015850
commit
f0ad1b02d9
@ -1,4 +1,4 @@
|
|||||||
import { resolve } from 'pathe'
|
import { relative, resolve } from 'pathe'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { writeTypes } from '../utils/prepare'
|
import { writeTypes } from '../utils/prepare'
|
||||||
import { loadKit } from '../utils/kit'
|
import { loadKit } from '../utils/kit'
|
||||||
@ -19,7 +19,7 @@ export default defineNuxtCommand({
|
|||||||
const rootDir = resolve(args._[0] || '.')
|
const rootDir = resolve(args._[0] || '.')
|
||||||
showVersions(rootDir)
|
showVersions(rootDir)
|
||||||
|
|
||||||
const { loadNuxt, buildNuxt } = await loadKit(rootDir)
|
const { loadNuxt, buildNuxt, useNitro } = await loadKit(rootDir)
|
||||||
|
|
||||||
const nuxt = await loadNuxt({
|
const nuxt = await loadNuxt({
|
||||||
rootDir,
|
rootDir,
|
||||||
@ -28,6 +28,8 @@ export default defineNuxtCommand({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const nitro = useNitro()
|
||||||
|
|
||||||
await clearDir(nuxt.options.buildDir)
|
await clearDir(nuxt.options.buildDir)
|
||||||
|
|
||||||
await writeTypes(nuxt)
|
await writeTypes(nuxt)
|
||||||
@ -38,5 +40,12 @@ export default defineNuxtCommand({
|
|||||||
})
|
})
|
||||||
|
|
||||||
await buildNuxt(nuxt)
|
await buildNuxt(nuxt)
|
||||||
|
|
||||||
|
if (args.prerender) {
|
||||||
|
// TODO: revisit later if/when nuxt build --prerender will output hybrid
|
||||||
|
const dir = nitro?.options.output.publicDir
|
||||||
|
const publicDir = dir ? relative(process.cwd(), dir) : '.output/public'
|
||||||
|
consola.success(`You can now deploy \`${publicDir}\` to any static hosting!`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import consola from 'consola'
|
|
||||||
import buildCommand from './build'
|
import buildCommand from './build'
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
|
|
||||||
@ -11,6 +10,5 @@ export default defineNuxtCommand({
|
|||||||
async invoke (args) {
|
async invoke (args) {
|
||||||
args.prerender = true
|
args.prerender = true
|
||||||
await buildCommand.invoke(args)
|
await buildCommand.invoke(args)
|
||||||
consola.success('You can now deploy `.output/public` to any static hosting!')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user