Merge branch 'quest-file' into quest

This commit is contained in:
Chen, Tai-Lin committed 2023-11-22 19:28:34 +08:00
commit 956af624c6
69 files changed
+1232 -260

No files matched your search

+9 -1
View File
@@ -85,4 +85,12 @@ async function main() {
}
}
main().then(exit)
main()
.then(exit)
.catch((err) => {
console.log(
'發生預期外的錯誤,請嘗試重新啟動 Quest,如果問題持續發生,請幫我們填寫右上角的錯誤回報表單。'
)
console.error(err)
exit(1)
})
+10 -6
View File
@@ -34,12 +34,16 @@ async function collectFilesInfo(inputPath, level = 0, hiddenFiles = false) {
async function discoverFiles(argv) {
const targetPath = argv._.length < 2 ? ['.'] : argv._.slice(1)
const result = await Promise.all(
targetPath
.map((p) => path.resolve(process.cwd(), p))
.map((p) => collectFilesInfo(p, 0, argv.a || argv.all))
)
return { discover: result.flat() }
try {
const result = await Promise.all(
targetPath
.map((p) => path.resolve(process.cwd(), p))
.map((p) => collectFilesInfo(p, 0, argv.a || argv.all))
)
return { discover: result.flat() }
} catch (err) {
return {}
}
}
module.exports = discoverFiles