mirror of
https://github.com/one-among-us/data.git
synced 2024-11-22 19:24:51 +08:00
[F] fix empty dir crash build
This commit is contained in:
parent
10de8cb4ad
commit
7ed05525b5
@ -53,6 +53,7 @@ function buildPeopleInfoAndList() {
|
|||||||
for (const { dirname, srcPath, distPath } of people) {
|
for (const { dirname, srcPath, distPath } of people) {
|
||||||
|
|
||||||
if (excludeList.includes(dirname)) continue;
|
if (excludeList.includes(dirname)) continue;
|
||||||
|
if (isDirEmpty(srcPath)) continue;
|
||||||
|
|
||||||
const infoFile = fs.readFileSync(path.join(srcPath, `info.yml`), "utf-8");
|
const infoFile = fs.readFileSync(path.join(srcPath, `info.yml`), "utf-8");
|
||||||
const info: any = YAML.load(infoFile);
|
const info: any = YAML.load(infoFile);
|
||||||
@ -132,6 +133,7 @@ function buildPeoplePages() {
|
|||||||
for (const { dirname, srcPath, distPath } of people) {
|
for (const { dirname, srcPath, distPath } of people) {
|
||||||
|
|
||||||
if (excludeList.includes(dirname)) continue;
|
if (excludeList.includes(dirname)) continue;
|
||||||
|
if (isDirEmpty(srcPath)) continue;
|
||||||
|
|
||||||
for (const lang of ['', '.zh_hant', '.en'])
|
for (const lang of ['', '.zh_hant', '.en'])
|
||||||
{
|
{
|
||||||
@ -220,3 +222,7 @@ function trim(str: string, ch: string) {
|
|||||||
|
|
||||||
return (start > 0 || end < str.length) ? str.substring(start, end) : str;
|
return (start > 0 || end < str.length) ? str.substring(start, end) : str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDirEmpty(dir: string): boolean {
|
||||||
|
return fs.readdirSync(dir).length == 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user