mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(schema): app/
dir backwards compatibility (#27529)
This commit is contained in:
parent
6bbc85ade9
commit
bdf8f9e0dd
@ -1,4 +1,5 @@
|
||||
import { existsSync } from 'node:fs'
|
||||
import { readdir } from 'node:fs/promises'
|
||||
import { defineUntypedSchema } from 'untyped'
|
||||
import { join, relative, resolve } from 'pathe'
|
||||
import { isDebug, isDevelopment, isTest } from 'std-env'
|
||||
@ -117,7 +118,16 @@ export default defineUntypedSchema({
|
||||
}
|
||||
|
||||
const srcDir = resolve(rootDir, 'app')
|
||||
if (!existsSync(srcDir)) {
|
||||
const srcDirFiles = new Set<string>()
|
||||
if (existsSync(srcDir)) {
|
||||
const files = await readdir(srcDir).catch(() => [])
|
||||
for (const file of files) {
|
||||
if (file !== 'spa-loading-template.html' && !file.startsWith('router.options')) {
|
||||
srcDirFiles.add(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (srcDirFiles.size === 0) {
|
||||
for (const file of ['app.vue', 'App.vue']) {
|
||||
if (existsSync(resolve(rootDir, file))) {
|
||||
return rootDir
|
||||
|
Loading…
Reference in New Issue
Block a user