#!/usr/bin/env node /** * Legt .env aus .env.example an, falls .env noch nicht existiert. * .cjs damit es unter "type": "module" (package.json) mit require() läuft. * Für Deployment: deploy.sh kann vor dem Build .env.local aus Container-Env schreiben. */ const fs = require("fs"); const path = require("path"); const envPath = path.join(process.cwd(), ".env"); const examplePath = path.join(process.cwd(), ".env.example"); if (fs.existsSync(envPath)) { console.log(".env existiert bereits – nichts geändert."); process.exit(0); } if (!fs.existsSync(examplePath)) { console.error(".env.example nicht gefunden. Bitte manuell .env anlegen."); process.exit(1); } fs.copyFileSync(examplePath, envPath); console.log(".env wurde aus .env.example erstellt. Bitte danach 'npm run build' ausführen."); process.exit(0);