🐛 Fix walks repository not up to date
This commit is contained in:
@@ -19,12 +19,23 @@ export class GitHubIconsRepository extends AbstractIconRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async fetchInternally(): Promise<NormalizedIconRepositoryResult> {
|
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 body = (await response.json()) as GitHubRepo;
|
||||||
|
|
||||||
const normalizedEntries = body.tree
|
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)))
|
.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 => {
|
.map((file): NormalizedIcon => {
|
||||||
const fileNameParts = file.path.split('/');
|
const fileNameParts = file.path.split('/');
|
||||||
const fileName = fileNameParts[fileNameParts.length - 1];
|
const fileName = fileNameParts[fileNameParts.length - 1];
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ export class JsdelivrIconsRepository extends AbstractIconRepository {
|
|||||||
const body = (await response.json()) as JsdelivrResponse;
|
const body = (await response.json()) as JsdelivrResponse;
|
||||||
|
|
||||||
const normalizedEntries = body.files
|
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)))
|
.filter((file) => ['.png', '.svg'].some((x) => file.name.endsWith(x)))
|
||||||
|
|
||||||
.map((file): NormalizedIcon => {
|
.map((file): NormalizedIcon => {
|
||||||
const fileNameParts = file.name.split('/');
|
const fileNameParts = file.name.split('/');
|
||||||
const fileName = fileNameParts[fileNameParts.length - 1];
|
const fileName = fileNameParts[fileNameParts.length - 1];
|
||||||
|
|||||||
Reference in New Issue
Block a user