import path from "path";
import fs from "fs";

export function createEnvFile(appPath: string, apiKey: string, projectId: string, ordinoURL: string) {
  const envFilePath = path.join(appPath, ".env");

  const envContent = `ORDINO_KEY=${apiKey}\nPROJECT_ID=${projectId}\nORDINO_URL=${ordinoURL}`;

  if (fs.existsSync(envFilePath)) {
    console.log(".env file already exists, skipping creation.");
  } else {
    fs.writeFileSync(envFilePath, envContent, "utf8");
    console.log(".env file created successfully.");
  }
}
