🐞 fix: 修复错误包含 ts 文件

This commit is contained in:
imsyy
2024-06-13 10:12:06 +08:00
parent d5217c3dff
commit b8f7c1ad23

View File

@@ -32,7 +32,11 @@ const findTsFiles = (dirPath: string, allFiles: string[] = [], basePath: string
if (stat.isDirectory()) { if (stat.isDirectory()) {
// 如果是文件夹,递归查找 // 如果是文件夹,递归查找
findTsFiles(fullPath, allFiles, relativePath); findTsFiles(fullPath, allFiles, relativePath);
} else if (stat.isFile() && (item.endsWith(".ts") || item.endsWith(".js"))) { } else if (
stat.isFile() &&
(item.endsWith(".ts") || item.endsWith(".js")) &&
!item.endsWith(".d.ts")
) {
// 符合条件 // 符合条件
allFiles.push(relativePath.replace(/\.(ts|js)$/, "")); allFiles.push(relativePath.replace(/\.(ts|js)$/, ""));
} }