@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
51 lines (39 loc) β’ 1.47 kB
JavaScript
import * as p from "@clack/prompts";
import pc from "picocolors";
import { outro } from "@clack/prompts";
import { cloneRepository, initializeGitRepository } from "./modules/git";
import { installDependencies } from "./modules/package";
import {
askCloneOption,
askPackageManager,
askProjectName,
askStartNewGitRepository,
} from "./modules/prompt";
import { setupEnvFile, withSpinner } from "./modules/utils";
async function main() {
p.intro(
`Welcome to ${pc.bold(pc.green("BRUXX CLI"))} π₯
This CLI will scaffold a new ${pc.green("Brx Template")} project.`
);
const projectName = await askProjectName();
const cloneOption = await askCloneOption();
const startNewRepo = await askStartNewGitRepository();
const packageManager = await askPackageManager();
await withSpinner(() => cloneRepository(projectName, cloneOption));
if (startNewRepo) {
await withSpinner(() => initializeGitRepository(projectName));
}
await withSpinner(() => installDependencies(projectName, packageManager));
await withSpinner(() => setupEnvFile(projectName));
console.log(pc.green("Project setup completed successfully. π"));
outro(
`${pc.green("cd " + projectName)}
${pc.green(packageManager + " run dev")}
${pc.green("Happy coding! π₯")}`
);
}
main().catch((error) => {
console.error(pc.red(`Error: ${error.message}`));
process.exit(1);
});