Skip to content

Commit 94f82af

Browse files
authored
patch: root license (#2617)
1 parent 5b9976c commit 94f82af

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/components/ViewPackagePage/components/important-files-view.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,11 @@ export default function ImportantFilesView({
8080
isOwner || Boolean(organization?.user_permissions?.can_manage_org)
8181
// File type utilities
8282
const isLicenseFile = useCallback((filePath: string) => {
83-
const lowerPath = filePath.toLowerCase()
83+
const lowerPath = filePath.toLowerCase().replace(/^\//, "")
8484
return (
8585
lowerPath === "license" ||
86-
lowerPath.endsWith("/license") ||
8786
lowerPath === "license.txt" ||
88-
lowerPath.endsWith("/license.txt") ||
89-
lowerPath === "license.md" ||
90-
lowerPath.endsWith("/license.md")
87+
lowerPath === "license.md"
9188
)
9289
}, [])
9390

@@ -161,7 +158,12 @@ export default function ImportantFilesView({
161158
const isSubdirReadme =
162159
(lowerPath.endsWith("/readme.md") || lowerPath.endsWith("/readme")) &&
163160
!isReadmeFile(file.file_path)
164-
return !isSubdirReadme
161+
const isSubdirLicense =
162+
(lowerPath.endsWith("/license") ||
163+
lowerPath.endsWith("/license.txt") ||
164+
lowerPath.endsWith("/license.md")) &&
165+
!isLicenseFile(file.file_path)
166+
return !isSubdirReadme && !isSubdirLicense
165167
})
166168

167169
filteredFiles.forEach((file) => {

src/components/ViewPackagePage/utils/is-package-file-important.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const importanceMap = {
33
readme: 200,
44
license: 100,
55
"license.md": 100,
6+
"license.txt": 100,
67
"index.ts": 90,
78
"index.tsx": 90,
89
"circuit.tsx": 90,

0 commit comments

Comments
 (0)