import fs from "node:fs"; import path from "node:path"; /** Minimal .env loader for scripts (no dotenv dependency). Never logs values. */ const file = path.resolve(process.cwd(), ".env"); if (fs.existsSync(file)) { for (const line of fs.readFileSync(file, "utf8").split("\n")) { const m = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/); if (!m) continue; let v = m[2]; if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) v = v.slice(1, -1); if (process.env[m[1]] === undefined) process.env[m[1]] = v; } }