mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
44 lines
1,016 B
TypeScript
44 lines
1,016 B
TypeScript
import { Document as YMLDocument } from "yaml";
|
|
import { Game } from "@main/entity";
|
|
import path from "node:path";
|
|
|
|
export const generateYML = (game: Game) => {
|
|
const slugifiedGameTitle = game.title.replace(/\s/g, "-").toLocaleLowerCase();
|
|
|
|
const doc = new YMLDocument({
|
|
name: game.title,
|
|
game_slug: slugifiedGameTitle,
|
|
slug: `${slugifiedGameTitle}-installer`,
|
|
version: "Installer",
|
|
runner: "wine",
|
|
script: {
|
|
game: {
|
|
prefix: "$GAMEDIR",
|
|
arch: "win64",
|
|
working_dir: "$GAMEDIR",
|
|
},
|
|
installer: [
|
|
{
|
|
task: {
|
|
name: "create_prefix",
|
|
arch: "win64",
|
|
prefix: "$GAMEDIR",
|
|
},
|
|
},
|
|
{
|
|
task: {
|
|
executable: path.join(
|
|
game.downloadPath!,
|
|
game.folderName!,
|
|
"setup.exe"
|
|
),
|
|
name: "wineexec",
|
|
prefix: "$GAMEDIR",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
return doc.toString();
|
|
};
|