@bruxx/cli-tool
Version:
`BRX TEMPLATE` is a production-ready boilerplate for modern React projects. It eliminates the tedious setup process, letting you jump straight into coding with a preconfigured, optimized environment. Built with best practices, it’s designed for scalabilit
26 lines (20 loc) • 719 B
JavaScript
import * as p from "@clack/prompts";
import { promises as fs } from "fs";
import path from "path";
export async function withSpinner(task, message = "Loading... ♻️") {
const s = p.spinner();
s.start(message);
await new Promise((resolve) => setTimeout(resolve, 1000));
s.stop("Done ✅!");
await task();
}
export async function setupEnvFile(projectName) {
const envExamplePath = path.join(projectName, ".env.example");
const envFilePath = path.join(projectName, ".env");
try {
await fs.copyFile(envExamplePath, envFilePath);
console.log(".env file created successfully. ✅");
} catch (error) {
throw new Error("Failed to set up environment file.");
}
}