mm
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { globSync } from "glob";
|
||||
// 1. 引入 tinyglobby
|
||||
import { globSync } from "tinyglobby";
|
||||
|
||||
interface Config {
|
||||
outputDir: string;
|
||||
@@ -77,13 +78,12 @@ function generateIndexFile(config: Config) {
|
||||
|
||||
// ------ scanDirs forEach start ------------------------
|
||||
config.scanDirs.forEach((dir) => {
|
||||
// 2. 路径模式保持不变,tinyglobby 能够正确处理
|
||||
const scanPattern = path.resolve(currentPath, dir, "**", "*.*");
|
||||
|
||||
const allFilePath = globSync(scanPattern, {
|
||||
absolute: true,
|
||||
windowsPathsNoEscape: true,
|
||||
dot: false,
|
||||
follow: true,
|
||||
// 3. 移除了 windowsPathsNoEscape,tinyglobby 默认处理路径更智能
|
||||
});
|
||||
|
||||
const validFiles = allFilePath.filter((filePath) => {
|
||||
|
||||
Reference in New Issue
Block a user