mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(cli): clear screen before new nuxt creation
also disables unused watching system (wip)
This commit is contained in:
parent
4bcb8fa791
commit
f0443c2ba6
@ -15,14 +15,13 @@ export async function invoke (args) {
|
||||
|
||||
const { loadNuxt, buildNuxt } = requireModule('@nuxt/kit', rootDir)
|
||||
|
||||
const watcherFiles = new Set()
|
||||
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 0 })
|
||||
|
||||
let currentNuxt
|
||||
const load = async () => {
|
||||
try {
|
||||
showBanner(true)
|
||||
listener.showURL()
|
||||
|
||||
const newNuxt = await loadNuxt({ rootDir, dev: true, ready: false })
|
||||
watcherFiles.add(newNuxt.options.watch)
|
||||
|
||||
let configChanges
|
||||
if (currentNuxt) {
|
||||
@ -37,9 +36,6 @@ export async function invoke (args) {
|
||||
currentNuxt = newNuxt
|
||||
}
|
||||
|
||||
showBanner(true)
|
||||
listener.showURL()
|
||||
|
||||
if (configChanges) {
|
||||
if (configChanges.length) {
|
||||
info('Nuxt config updated:')
|
||||
@ -60,9 +56,12 @@ export async function invoke (args) {
|
||||
}
|
||||
}
|
||||
|
||||
// Watch for config changes
|
||||
// TODO: Watcher service, modules, and requireTree
|
||||
const dLoad = debounce(load, 250)
|
||||
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 1 })
|
||||
watcher.on('all', (_event, file) => {
|
||||
if (watcherFiles.has(file) || file.includes('nuxt.config')) {
|
||||
if (file.includes('nuxt.config') || file.includes('modules')) {
|
||||
dLoad()
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user