Skip to content

Commit afc0f8a

Browse files
committed
refactor: update paths.ts
1 parent 554602a commit afc0f8a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib/paths.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as path from "path";
77
import { ROOT } from "../lib/constants";
88
import { MoveOrRename, SplitPathResult } from "./paths.d";
99

10+
const REPEAT_PATH_STARTS = ["readme", "index"];
1011
/**
1112
* Get metadata for a given path.
1213
*
@@ -42,8 +43,11 @@ export function friendlyFile(filePath: string) {
4243
const { name } = splitPath(filePath);
4344

4445
const nameLower = name.toLowerCase();
45-
if (nameLower.startsWith("readme") || nameLower.startsWith("index")) {
46-
return filePath;
46+
47+
for (const p of REPEAT_PATH_STARTS) {
48+
if (nameLower.startsWith(p)) {
49+
return filePath;
50+
}
4751
}
4852
return name;
4953
}

0 commit comments

Comments
 (0)