chore(cli): Show config diff only with DEBUG

This commit is contained in:
Pooya Parsa 2021-04-20 14:22:47 +02:00
parent 8ffb15200e
commit ac9c0b044e

View File

@ -24,25 +24,27 @@ export async function invoke (args) {
const newNuxt = await loadNuxt({ rootDir, dev: true, ready: false }) const newNuxt = await loadNuxt({ rootDir, dev: true, ready: false })
let configChanges if (process.env.DEBUG) {
if (currentNuxt) { let configChanges
configChanges = diff(currentNuxt.options, newNuxt.options, [ if (currentNuxt) {
'generate.staticAssets.version', configChanges = diff(currentNuxt.options, newNuxt.options, [
'env.NITRO_PRESET' 'generate.staticAssets.version',
]) 'env.NITRO_PRESET'
server.setApp(createLoadingHandler('Restarting...', 1)) ])
await currentNuxt.close() server.setApp(createLoadingHandler('Restarting...', 1))
currentNuxt = newNuxt await currentNuxt.close()
} else { currentNuxt = newNuxt
currentNuxt = newNuxt
}
if (configChanges) {
if (configChanges.length) {
info('Nuxt config updated:')
printDiff(configChanges)
} else { } else {
info('Restarted nuxt due to config changes') currentNuxt = newNuxt
}
if (configChanges) {
if (configChanges.length) {
info('Nuxt config updated:')
printDiff(configChanges)
} else {
info('Restarted nuxt due to config changes')
}
} }
} }