mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +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 { loadNuxt, buildNuxt } = requireModule('@nuxt/kit', rootDir)
|
||||||
|
|
||||||
const watcherFiles = new Set()
|
|
||||||
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 0 })
|
|
||||||
|
|
||||||
let currentNuxt
|
let currentNuxt
|
||||||
const load = async () => {
|
const load = async () => {
|
||||||
try {
|
try {
|
||||||
|
showBanner(true)
|
||||||
|
listener.showURL()
|
||||||
|
|
||||||
const newNuxt = await loadNuxt({ rootDir, dev: true, ready: false })
|
const newNuxt = await loadNuxt({ rootDir, dev: true, ready: false })
|
||||||
watcherFiles.add(newNuxt.options.watch)
|
|
||||||
|
|
||||||
let configChanges
|
let configChanges
|
||||||
if (currentNuxt) {
|
if (currentNuxt) {
|
||||||
@ -37,9 +36,6 @@ export async function invoke (args) {
|
|||||||
currentNuxt = newNuxt
|
currentNuxt = newNuxt
|
||||||
}
|
}
|
||||||
|
|
||||||
showBanner(true)
|
|
||||||
listener.showURL()
|
|
||||||
|
|
||||||
if (configChanges) {
|
if (configChanges) {
|
||||||
if (configChanges.length) {
|
if (configChanges.length) {
|
||||||
info('Nuxt config updated:')
|
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 dLoad = debounce(load, 250)
|
||||||
|
const watcher = chokidar.watch([rootDir], { ignoreInitial: true, depth: 1 })
|
||||||
watcher.on('all', (_event, file) => {
|
watcher.on('all', (_event, file) => {
|
||||||
if (watcherFiles.has(file) || file.includes('nuxt.config')) {
|
if (file.includes('nuxt.config') || file.includes('modules')) {
|
||||||
dLoad()
|
dLoad()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user