Skip to content

Commit

Permalink
feat(app): g-config 命令忽略 _. 开头的文件和目录
Browse files Browse the repository at this point in the history
  • Loading branch information
twinh committed May 13, 2024
1 parent 829d255 commit 3639d42
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions commands/g-config.ts
Expand Up @@ -129,6 +129,11 @@ async function scanPages(name: string, rootDir: string, dir: string, pages: Page
}
}

// Ignore file/dir start with underscore or dot
if (['_', '.'].includes(file.substring(0, 1))) {
continue;
}

const fullPath = path.join(dir, file);
if ((await fs.lstat(fullPath)).isDirectory()) {
const result = await scanPages(name, rootDir, fullPath);
Expand All @@ -146,11 +151,7 @@ async function scanPages(name: string, rootDir: string, dir: string, pages: Page

const parsedPath = path.parse(file);

if (!validExts.includes(parsedPath.ext)
// Ignore file start with underscore
|| parsedPath.name.substr(0, 1) === '_'
|| parsedPath.name.substr(-5) === '.test'
) {
if (!validExts.includes(parsedPath.ext) || parsedPath.name.substr(-5) === '.test') {
continue;
}

Expand Down

0 comments on commit 3639d42

Please sign in to comment.