fix migrations
This commit is contained in:
@@ -146,22 +146,25 @@ const compareSemanticVersions = (a: string, b: string) => {
|
||||
const b1 = b.split('.');
|
||||
const len = Math.min(a1.length, b1.length);
|
||||
for (let i = 0; i < len; i++) {
|
||||
const a2 = +a1[ i ] || 0;
|
||||
const b2 = +b1[ i ] || 0;
|
||||
const a2 = +a1[i] || 0;
|
||||
const b2 = +b1[i] || 0;
|
||||
if (a2 !== b2) {
|
||||
return a2 > b2 ? 1 : -1;
|
||||
return a2 > b2 ? 1 : -1;
|
||||
}
|
||||
}
|
||||
return b1.length - a1.length;
|
||||
};
|
||||
export async function getTags(type?: string) {
|
||||
let tags: any = [];
|
||||
if (isDev) {
|
||||
tags = JSON.parse(await (await fs.readFile('./tags.json')).toString())
|
||||
} else {
|
||||
tags = JSON.parse(await (await fs.readFile('/app/tags.json')).toString())
|
||||
export async function getTags(type: string) {
|
||||
if (type) {
|
||||
let tags: any = [];
|
||||
if (isDev) {
|
||||
tags = JSON.parse(await (await fs.readFile('./tags.json')).toString())
|
||||
} else {
|
||||
tags = JSON.parse(await (await fs.readFile('/app/tags.json')).toString())
|
||||
}
|
||||
tags = tags.find((tag: any) => tag.name.includes(type))
|
||||
tags.tags = tags.tags.sort(compareSemanticVersions).reverse();
|
||||
return tags
|
||||
}
|
||||
tags = tags.find((tag: any) => tag.name.includes(type))
|
||||
tags.tags = tags.tags.sort(compareSemanticVersions).reverse();
|
||||
return tags
|
||||
return []
|
||||
}
|
||||
|
Reference in New Issue
Block a user