import fs from "node:fs";
import path from "node:path";

const publicDir = path.join(process.cwd(), "public");
const appName = process.env.APP_NAME ?? "HexaHost GameCloud";

fs.mkdirSync(publicDir, { recursive: true });
fs.writeFileSync(
  path.join(publicDir, "index.html"),
  `<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="utf-8" />
  <title>${appName}</title>
</head>
<body>
  <h1>${appName}</h1>
  <p>Phase 0 web build artifact.</p>
</body>
</html>`,
);

console.log(JSON.stringify({ level: "info", msg: "static assets written", dir: publicDir }));
