mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:20:43 +00:00
fix: ignore pnpm progress in deadcode guard
This commit is contained in:
@@ -28,6 +28,10 @@ function uniqueSorted(values) {
|
||||
);
|
||||
}
|
||||
|
||||
function isLikelyRepoFilePath(value) {
|
||||
return /^(apps|docs|extensions|packages|scripts|src|test|ui)\//u.test(normalizeRepoPath(value));
|
||||
}
|
||||
|
||||
export function parseKnipCompactUnusedFiles(output) {
|
||||
const files = [];
|
||||
let inUnusedFilesSection = false;
|
||||
@@ -50,7 +54,10 @@ export function parseKnipCompactUnusedFiles(output) {
|
||||
if (sawUnusedFilesSection && !inUnusedFilesSection) {
|
||||
continue;
|
||||
}
|
||||
files.push(line.slice(separatorIndex + 2).trim());
|
||||
const file = line.slice(separatorIndex + 2).trim();
|
||||
if (isLikelyRepoFilePath(file)) {
|
||||
files.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueSorted(files);
|
||||
|
||||
@@ -29,6 +29,17 @@ left-pad: package.json
|
||||
]);
|
||||
});
|
||||
|
||||
it("ignores pnpm dlx progress lines in files-only compact output", () => {
|
||||
expect(
|
||||
parseKnipCompactUnusedFiles(`
|
||||
Progress: resolved 21, reused 0, downloaded 0, added 0
|
||||
src/b.ts: src/b.ts
|
||||
Progress: resolved 65, reused 20, downloaded 1, added 21, done
|
||||
src/a.ts: src/a.ts
|
||||
`),
|
||||
).toEqual(["src/a.ts", "src/b.ts"]);
|
||||
});
|
||||
|
||||
it("reports unexpected and stale allowlist entries", () => {
|
||||
expect(
|
||||
compareUnusedFilesToAllowlist(["src/a.ts", "src/new.ts"], ["src/a.ts", "src/old.ts"]),
|
||||
|
||||
Reference in New Issue
Block a user