From da4d73261b6a8d072c2f9b4528000fa8fb9a8686 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Sat, 23 May 2026 11:22:17 +0800 Subject: [PATCH 1/2] refactor(usage): unify excluded dirs with constants.ts - Remove local IGNORED_DIRS duplicate in usage/scanner.ts - Import EXCLUDED_DIRS from constants.ts instead - Keeps hidden-directory skip (!entry.name.startsWith('.')) intact - Ensures .next, .turbo, .angular, .nx are also skipped during --usage scan --- src/usage/scanner.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/usage/scanner.ts b/src/usage/scanner.ts index 3811012..89f4aa0 100644 --- a/src/usage/scanner.ts +++ b/src/usage/scanner.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; +import { EXCLUDED_DIRS } from "../constants.js"; -const IGNORED_DIRS = new Set(["node_modules", ".git", "dist", "build", "coverage"]); const ALLOWED_EXTS = new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"]); // Matches: @@ -57,7 +57,7 @@ export function scanProjectForPackageUsage( const fullPath = path.join(dir, entry.name); if (entry.isDirectory()) { - if (!IGNORED_DIRS.has(entry.name) && !entry.name.startsWith(".")) { + if (!EXCLUDED_DIRS.has(entry.name) && !entry.name.startsWith(".")) { walk(fullPath); } } else if (entry.isFile()) { From 802cc981c83c9ec9b7b3e8af3a90a95e50205aac Mon Sep 17 00:00:00 2001 From: luojiyin Date: Sat, 23 May 2026 23:17:00 +0800 Subject: [PATCH 2/2] docs(usage): clarify shared EXCLUDED_DIRS coupling --- src/usage/scanner.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/usage/scanner.ts b/src/usage/scanner.ts index 89f4aa0..5f9808e 100644 --- a/src/usage/scanner.ts +++ b/src/usage/scanner.ts @@ -1,5 +1,6 @@ import fs from "node:fs"; import path from "node:path"; +// Shared with lockfile scanning in utils/file.ts; additions affect both code paths. import { EXCLUDED_DIRS } from "../constants.js"; const ALLOWED_EXTS = new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"]);