revert: revert: revert

This commit is contained in:
Andras Bacsai
2022-11-11 14:25:02 +01:00
parent ac7d4e3645
commit 30d1ae59ec

View File

@@ -2,13 +2,16 @@ import { isDev } from "./common";
import fs from 'fs/promises'; import fs from 'fs/promises';
export async function getTemplates() { export async function getTemplates() {
const templatePath = isDev ? './templates.json' : '/app/templates.json'; const templatePath = isDev ? './templates.json' : '/app/templates.json';
const open = await fs.open(templatePath, 'r');
let data;
try { try {
const ts = await fs.readFile(templatePath, 'utf8') data = await open.readFile({ encoding: 'utf-8' });
if (ts) { return JSON.parse(data);
return JSON.parse(ts); } catch (error) {
} return []
} catch (error) { } } finally {
return []; await open?.close()
}
} }
const compareSemanticVersions = (a: string, b: string) => { const compareSemanticVersions = (a: string, b: string) => {
const a1 = a.split('.'); const a1 = a.split('.');