Skip to content

Commit

Permalink
fix(schema): app/ dir backwards compatibility (nuxt#27529)
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw authored Jun 11, 2024
1 parent 6bbc85a commit bdf8f9e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/schema/src/config/common.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bdf8f9e

Please sign in to comment.