🐛 Fix walks repository not up to date

This commit is contained in:
Thomas Camlong
2023-10-30 16:24:48 +01:00
parent 92ffce1b3b
commit 6273af503b
2 changed files with 15 additions and 3 deletions

View File

@@ -19,12 +19,23 @@ export class GitHubIconsRepository extends AbstractIconRepository {
}
protected async fetchInternally(): Promise<NormalizedIconRepositoryResult> {
const response = await fetch(this.repository.api);
const response = await fetch(this.repository.api, {
});
const body = (await response.json()) as GitHubRepo;
const normalizedEntries = body.tree
.filter((file) => !['_banner.png', '_logo.png'].some((x) => file.path.includes(x)))
.filter((file) => !['banner.png', 'logo.png'].some((x) => file.path.includes(x)))
.filter((file) => ['.png', '.svg'].some((x) => file.path.endsWith(x)))
.sort((a, b) => {
if (a.path.endsWith('.svg') && b.path.endsWith('.png')) {
return -1;
}
if (a.path.endsWith('.png') && b.path.endsWith('.svg')) {
return 1;
}
return 0;
})
.map((file): NormalizedIcon => {
const fileNameParts = file.path.split('/');
const fileName = fileNameParts[fileNameParts.length - 1];

View File

@@ -28,8 +28,9 @@ export class JsdelivrIconsRepository extends AbstractIconRepository {
const body = (await response.json()) as JsdelivrResponse;
const normalizedEntries = body.files
.filter((file) => !['banner.png', 'logo.png'].some((x) => file.name.includes(x)))
.filter((file) => !['_banner.png', '_logo.png'].some((x) => file.name.includes(x)))
.filter((file) => ['.png', '.svg'].some((x) => file.name.endsWith(x)))
.map((file): NormalizedIcon => {
const fileNameParts = file.name.split('/');
const fileName = fileNameParts[fileNameParts.length - 1];