Подготовить HY2XS к production-сборке

This commit is contained in:
2026-04-25 23:13:12 +05:00
commit 84a4e94567
277 changed files with 26513 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
export async function exists(path: string): Promise<boolean> {
return await Bun.file(path).exists();
}
export async function readText(path: string): Promise<string> {
return await Bun.file(path).text();
}
export async function writeText(path: string, data: string, mode?: number): Promise<void> {
await Bun.write(path, data);
if (mode !== undefined) {
const result = Bun.spawnSync(["chmod", mode.toString(8), path], {
stdout: "pipe",
stderr: "pipe"
});
if (!result.success) {
throw new Error(`chmod failed for ${path}: ${result.stderr.toString()}`);
}
}
}
export function renderTemplate(template: string, values: Record<string, string | number>): string {
let rendered = template;
for (const [key, value] of Object.entries(values)) {
rendered = rendered.replaceAll(`{{${key}}}`, String(value));
}
return rendered;
}