mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
colorize the prompts
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import chalk from "chalk";
|
||||
import { DEFAULT_CONFIG } from "../consts";
|
||||
import type { ProjectConfig } from "../types";
|
||||
import { getUserPkgManager } from "./get-package-manager";
|
||||
@@ -7,23 +8,29 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||
const defaultPackageManager = getUserPkgManager();
|
||||
|
||||
if (config.database !== DEFAULT_CONFIG.database) {
|
||||
flags.push(`--database ${config.database}`);
|
||||
flags.push(chalk.cyan(`--database ${config.database}`));
|
||||
}
|
||||
|
||||
if (config.auth !== DEFAULT_CONFIG.auth) {
|
||||
flags.push("--no-auth");
|
||||
flags.push(chalk.yellow("--no-auth"));
|
||||
}
|
||||
|
||||
if (
|
||||
config.packageManager &&
|
||||
config.packageManager !== defaultPackageManager
|
||||
) {
|
||||
flags.push(`--package-manager ${config.packageManager}`);
|
||||
flags.push(chalk.magenta(`--package-manager ${config.packageManager}`));
|
||||
}
|
||||
|
||||
for (const feature of config.features) {
|
||||
flags.push(`--${feature}`);
|
||||
flags.push(chalk.green(`--${feature}`));
|
||||
}
|
||||
|
||||
return `npx create-better-t-stack${
|
||||
config.projectName ? ` ${config.projectName}` : ""
|
||||
}${flags.length > 0 ? ` ${flags.join(" ")}` : ""}`;
|
||||
const baseCommand = chalk.bold("npx create-better-t-stack");
|
||||
const projectName = config.projectName
|
||||
? chalk.blue(` ${config.projectName}`)
|
||||
: "";
|
||||
const flagString = flags.length > 0 ? ` ${flags.join(" ")}` : "";
|
||||
|
||||
return `${baseCommand}${projectName}${flagString}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user