@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
64 lines (51 loc) • 1.48 kB
JavaScript
import * as p from "@clack/prompts";
import pc from "picocolors";
export async function askProjectName() {
const projectName = await p.text({
message: "Enter project name",
validate: (value) => (value ? undefined : "Name cannot be empty."),
});
if (p.isCancel(projectName)) {
p.outro(pc.yellow("Operation cancelled."));
process.exit(0);
}
return projectName;
}
export async function askCloneOption() {
const cloneOption = await p.select({
message: "Choose a clone option",
options: [
{ value: "https", label: "HTTPS" },
{ value: "ssh", label: "SSH" },
],
});
if (p.isCancel(cloneOption)) {
p.outro(pc.yellow("Operation cancelled."));
process.exit(0);
}
return cloneOption;
}
export async function askStartNewGitRepository() {
const startNewRepo = await p.confirm({
message: "Do you want to start a new Git repository?",
});
if (p.isCancel(startNewRepo)) {
p.outro(pc.yellow("Operation cancelled."));
process.exit(0);
}
return startNewRepo;
}
export async function askPackageManager() {
const packageManager = await p.select({
message: "Choose a package manager",
options: [
{ value: "npm", label: "NPM" },
{ value: "pnpm", label: "PNPM" },
],
});
if (p.isCancel(packageManager)) {
p.outro(pc.yellow("Operation cancelled."));
process.exit(0);
}
return packageManager;
}