Files
Webklar/scripts/setup-env.cjs
Basilosaurusrex 305de38ff6 .env commit
2026-02-06 19:46:26 +01:00

26 lines
831 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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);