Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/usage/scanner.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
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";

Comment thread
luojiyin1987 marked this conversation as resolved.
const IGNORED_DIRS = new Set(["node_modules", ".git", "dist", "build", "coverage"]);
const ALLOWED_EXTS = new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"]);

// Matches:
Expand Down Expand Up @@ -57,7 +58,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()) {
Expand Down