fix(nuxi): dx improvements when creating components/ directory (#749)

This commit is contained in:
Sébastien Chopin 2021-10-12 14:32:49 +02:00 committed by GitHub
parent edeafbf6e3
commit b35b111032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,7 @@ export default defineNuxtCommand({
const message = `${reason ? reason + '. ' : ''}${isRestart ? 'Restarting' : 'Starting'} nuxt...`
server.setApp(createLoadingHandler(message))
if (isRestart) {
console.log(message)
consola.info(message)
}
if (currentNuxt) {
await currentNuxt.close()
@ -68,10 +68,13 @@ export default defineNuxtCommand({
dLoad(true, `${relative(rootDir, file)} updated`)
}
if (['addDir', 'unlinkDir'].includes(_event) && file.match(/pages$/)) {
dLoad(true, `pages/ ${_event === 'addDir' ? 'created' : 'removed'}`)
dLoad(true, `Directory \`pages/\` ${_event === 'addDir' ? 'created' : 'removed'}`)
}
if (['addDir', 'unlinkDir'].includes(_event) && file.match(/components$/)) {
dLoad(true, `Directory \`components/\` ${_event === 'addDir' ? 'created' : 'removed'}`)
}
if (['add', 'unlink'].includes(_event) && file.match(/app\.(js|ts|mjs|jsx|tsx|vue)$/)) {
dLoad(true, `${relative(rootDir, file)}/ ${_event === 'add' ? 'created' : 'removed'}`)
dLoad(true, `\`${relative(rootDir, file)}\` ${_event === 'add' ? 'created' : 'removed'}`)
}
})