mirror of
https://github.com/mifi/lossless-cut.git
synced 2026-09-24 16:00:30 +08:00
17 lines
691 B
TypeScript
17 lines
691 B
TypeScript
import { readdir, readFile, writeFile } from 'node:fs/promises';
|
|
|
|
|
|
const versionsDir = new URL('../versions/', import.meta.url);
|
|
|
|
const versions: { version: string, highlightsMd?: string | undefined }[] = [];
|
|
|
|
for (const file of await readdir(versionsDir, { withFileTypes: true })) {
|
|
if (file.isFile() && file.name.endsWith('.md')) {
|
|
const version = file.name.replace(/.md$/, '');
|
|
const content = await readFile(new URL(file.name, versionsDir), { encoding: 'utf8' });
|
|
versions.push({ version, highlightsMd: content.trim() !== '' ? content : undefined });
|
|
}
|
|
}
|
|
|
|
await writeFile(new URL('../src/renderer/src/versions.json', import.meta.url), JSON.stringify(versions, null, 2));
|