Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxi): print resolved public directory after generate #7577

Merged
merged 2 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/nuxi/src/commands/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve } from 'pathe'
import { relative, resolve } from 'pathe'
import consola from 'consola'
import { writeTypes } from '../utils/prepare'
import { loadKit } from '../utils/kit'
Expand All @@ -19,7 +19,7 @@ export default defineNuxtCommand({
const rootDir = resolve(args._[0] || '.')
showVersions(rootDir)

const { loadNuxt, buildNuxt } = await loadKit(rootDir)
const { loadNuxt, buildNuxt, useNitro } = await loadKit(rootDir)

const nuxt = await loadNuxt({
rootDir,
Expand All @@ -28,6 +28,8 @@ export default defineNuxtCommand({
}
})

const nitro = useNitro()

await clearDir(nuxt.options.buildDir)

await writeTypes(nuxt)
Expand All @@ -38,5 +40,11 @@ export default defineNuxtCommand({
})

await buildNuxt(nuxt)

if (args.prerender) {
const dir = nitro?.options.output.publicDir
const publicDir = dir ? relative(rootDir, dir) : '.output/public'
danielroe marked this conversation as resolved.
Show resolved Hide resolved
consola.success(`You can now deploy \`${publicDir}\` to any static hosting!`)
pi0 marked this conversation as resolved.
Show resolved Hide resolved
}
}
})
2 changes: 0 additions & 2 deletions packages/nuxi/src/commands/generate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import consola from 'consola'
import buildCommand from './build'
import { defineNuxtCommand } from './index'

Expand All @@ -11,6 +10,5 @@ export default defineNuxtCommand({
async invoke (args) {
args.prerender = true
await buildCommand.invoke(args)
consola.success('You can now deploy `.output/public` to any static hosting!')
}
})