mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
improve prompts
This commit is contained in:
5
.changeset/beige-mugs-wash.md
Normal file
5
.changeset/beige-mugs-wash.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"create-better-t-stack": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve prompts
|
||||||
@@ -2,28 +2,6 @@ import path from "node:path";
|
|||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import type { ProjectConfig } from "./types";
|
import type { ProjectConfig } from "./types";
|
||||||
|
|
||||||
export const TITLE_TEXT = `
|
|
||||||
╔════════════════════════════════════════════════════════════╗
|
|
||||||
║ ║
|
|
||||||
║ ██████╗ ███████╗████████╗████████╗███████╗██████╗ ║
|
|
||||||
║ ██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗ ║
|
|
||||||
║ ██████╔╝█████╗ ██║ ██║ █████╗ ██████╔╝ ║
|
|
||||||
║ ██╔══██╗██╔══╝ ██║ ██║ ██╔══╝ ██╔══██╗ ║
|
|
||||||
║ ██████╔╝███████╗ ██║ ██║ ███████╗██║ ██║ ║
|
|
||||||
║ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ║
|
|
||||||
║ ║
|
|
||||||
║ ████████╗ ███████╗████████╗ █████╗ ██████╗██╗ ██╗ ║
|
|
||||||
║ ╚══██╔══╝ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ║
|
|
||||||
║ ██║ ███████╗ ██║ ███████║██║ █████╔╝ ║
|
|
||||||
║ ██║ ╚════██║ ██║ ██╔══██║██║ ██╔═██╗ ║
|
|
||||||
║ ██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗ ║
|
|
||||||
║ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ║
|
|
||||||
║ ║
|
|
||||||
║ The Modern Full-Stack Framework ║
|
|
||||||
║ ║
|
|
||||||
╚════════════════════════════════════════════════════════════╝
|
|
||||||
`;
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const distPath = path.dirname(__filename);
|
const distPath = path.dirname(__filename);
|
||||||
export const PKG_ROOT = path.join(distPath, "../");
|
export const PKG_ROOT = path.join(distPath, "../");
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ export async function createProject(options: ProjectConfig) {
|
|||||||
try {
|
try {
|
||||||
const tasksList = [
|
const tasksList = [
|
||||||
{
|
{
|
||||||
title: "Creating project directory",
|
title: "📁 Creating project directory",
|
||||||
task: async () => {
|
task: async () => {
|
||||||
await fs.ensureDir(projectDir);
|
await fs.ensureDir(projectDir);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Cloning template repository",
|
title: "📥 Cloning template repository",
|
||||||
task: async () => {
|
task: async () => {
|
||||||
try {
|
try {
|
||||||
await $`npx degit AmanVarshney01/Better-T-Stack ${projectDir}`;
|
await $`npx degit AmanVarshney01/Better-T-Stack ${projectDir}`;
|
||||||
@@ -37,7 +37,7 @@ export async function createProject(options: ProjectConfig) {
|
|||||||
|
|
||||||
if (options.git) {
|
if (options.git) {
|
||||||
tasksList.push({
|
tasksList.push({
|
||||||
title: "Initializing git repository",
|
title: "🗃️ Initializing git repository",
|
||||||
task: async () => {
|
task: async () => {
|
||||||
await $`git init ${projectDir}`;
|
await $`git init ${projectDir}`;
|
||||||
},
|
},
|
||||||
@@ -51,7 +51,7 @@ export async function createProject(options: ProjectConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const installDepsResponse = await confirm({
|
const installDepsResponse = await confirm({
|
||||||
message: `📦 Install dependencies using ${options.packageManager}?`,
|
message: `📦 Install dependencies with ${options.packageManager}?`,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isCancel(installDepsResponse)) {
|
if (isCancel(installDepsResponse)) {
|
||||||
@@ -62,13 +62,13 @@ export async function createProject(options: ProjectConfig) {
|
|||||||
shouldInstallDeps = installDepsResponse;
|
shouldInstallDeps = installDepsResponse;
|
||||||
|
|
||||||
if (shouldInstallDeps) {
|
if (shouldInstallDeps) {
|
||||||
s.start(`Installing dependencies using ${options.packageManager}...`);
|
s.start(`📦 Installing dependencies using ${options.packageManager}...`);
|
||||||
try {
|
try {
|
||||||
await $({
|
await $({
|
||||||
cwd: projectDir,
|
cwd: projectDir,
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
})`${options.packageManager} install`;
|
})`${options.packageManager} install`;
|
||||||
s.stop("Dependencies installed successfully");
|
s.stop("✅ Dependencies installed successfully");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
s.stop("Failed to install dependencies");
|
s.stop("Failed to install dependencies");
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
@@ -79,16 +79,9 @@ export async function createProject(options: ProjectConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.success("✨ Project created successfully!\n");
|
log.success("✨ Project created successfully!\n");
|
||||||
log.info(chalk.dim("Next steps:"));
|
log.info(`${chalk.dim("Next steps:")}
|
||||||
log.info(` cd ${options.projectName}`);
|
cd ${options.projectName}${!shouldInstallDeps ? `\n${options.packageManager} install` : ""}
|
||||||
if (!shouldInstallDeps) {
|
${options.packageManager === "npm" ? "npm run" : options.packageManager} dev`);
|
||||||
log.info(` ${options.packageManager} install`);
|
|
||||||
}
|
|
||||||
log.info(
|
|
||||||
` ${
|
|
||||||
options.packageManager === "npm" ? "npm run" : options.packageManager
|
|
||||||
} dev`,
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
s.stop("Failed");
|
s.stop("Failed");
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ interface TursoConfig {
|
|||||||
async function loginToTurso() {
|
async function loginToTurso() {
|
||||||
const s = spinner();
|
const s = spinner();
|
||||||
try {
|
try {
|
||||||
s.start("Logging in to Turso...");
|
s.start("🔄 Logging in to Turso...");
|
||||||
await $`turso auth login`;
|
await $`turso auth login`;
|
||||||
s.stop("Logged in to Turso successfully!");
|
s.stop("✅ Logged in to Turso successfully!");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
s.stop("Failed to log in to Turso");
|
s.stop("Failed to log in to Turso");
|
||||||
throw error;
|
throw error;
|
||||||
@@ -38,7 +38,7 @@ async function loginToTurso() {
|
|||||||
async function installTursoCLI(isMac: boolean) {
|
async function installTursoCLI(isMac: boolean) {
|
||||||
const s = spinner();
|
const s = spinner();
|
||||||
try {
|
try {
|
||||||
s.start("Installing Turso CLI...");
|
s.start("🔄 Installing Turso CLI...");
|
||||||
|
|
||||||
if (isMac) {
|
if (isMac) {
|
||||||
await $`brew install tursodatabase/tap/turso`;
|
await $`brew install tursodatabase/tap/turso`;
|
||||||
@@ -48,7 +48,7 @@ async function installTursoCLI(isMac: boolean) {
|
|||||||
await $`bash -c '${installScript}'`;
|
await $`bash -c '${installScript}'`;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.stop("Turso CLI installed successfully!");
|
s.stop("✅ Turso CLI installed successfully!");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error && error.message.includes("User force closed")) {
|
if (error instanceof Error && error.message.includes("User force closed")) {
|
||||||
s.stop();
|
s.stop();
|
||||||
@@ -91,7 +91,7 @@ TURSO_AUTH_TOKEN=`;
|
|||||||
}
|
}
|
||||||
|
|
||||||
function displayManualSetupInstructions() {
|
function displayManualSetupInstructions() {
|
||||||
log.info("📝 Manual Turso Setup Instructions:");
|
log.info("🔧 Manual Turso Setup Instructions:");
|
||||||
log.info("1. Visit https://turso.tech and create an account");
|
log.info("1. Visit https://turso.tech and create an account");
|
||||||
log.info("2. Create a new database from the dashboard");
|
log.info("2. Create a new database from the dashboard");
|
||||||
log.info("3. Get your database URL and authentication token");
|
log.info("3. Get your database URL and authentication token");
|
||||||
@@ -118,7 +118,7 @@ export async function setupTurso(projectDir: string) {
|
|||||||
|
|
||||||
if (!isCliInstalled) {
|
if (!isCliInstalled) {
|
||||||
const shouldInstall = await confirm({
|
const shouldInstall = await confirm({
|
||||||
message: "Would you like to install Turso CLI?",
|
message: "🔧 Would you like to install Turso CLI?",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isCancel(shouldInstall)) {
|
if (isCancel(shouldInstall)) {
|
||||||
@@ -133,7 +133,7 @@ export async function setupTurso(projectDir: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const s = spinner();
|
const s = spinner();
|
||||||
s.start("Installing Turso CLI...");
|
s.start("🔄 Installing Turso CLI...");
|
||||||
try {
|
try {
|
||||||
if (isMac) {
|
if (isMac) {
|
||||||
await $`brew install tursodatabase/tap/turso`;
|
await $`brew install tursodatabase/tap/turso`;
|
||||||
@@ -142,7 +142,7 @@ export async function setupTurso(projectDir: string) {
|
|||||||
await $`curl -sSfL https://get.tur.so/install.sh`;
|
await $`curl -sSfL https://get.tur.so/install.sh`;
|
||||||
await $`bash -c '${installScript}'`;
|
await $`bash -c '${installScript}'`;
|
||||||
}
|
}
|
||||||
s.stop("Turso CLI installed successfully!");
|
s.stop("✅ Turso CLI installed successfully!");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
s.stop("Failed to install Turso CLI");
|
s.stop("Failed to install Turso CLI");
|
||||||
throw error;
|
throw error;
|
||||||
@@ -152,10 +152,10 @@ export async function setupTurso(projectDir: string) {
|
|||||||
const isLoggedIn = await isTursoLoggedIn();
|
const isLoggedIn = await isTursoLoggedIn();
|
||||||
if (!isLoggedIn) {
|
if (!isLoggedIn) {
|
||||||
const s = spinner();
|
const s = spinner();
|
||||||
s.start("Logging in to Turso...");
|
s.start("🔄 Logging in to Turso...");
|
||||||
try {
|
try {
|
||||||
await $`turso auth login`;
|
await $`turso auth login`;
|
||||||
s.stop("Logged in to Turso successfully!");
|
s.stop("✅ Logged in to Turso successfully!");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
s.stop("Failed to log in to Turso");
|
s.stop("Failed to log in to Turso");
|
||||||
throw error;
|
throw error;
|
||||||
@@ -168,7 +168,7 @@ export async function setupTurso(projectDir: string) {
|
|||||||
|
|
||||||
while (!success) {
|
while (!success) {
|
||||||
const dbNameResponse = await text({
|
const dbNameResponse = await text({
|
||||||
message: "Enter database name:",
|
message: "📝 Enter a name for your database:",
|
||||||
defaultValue: suggestedName,
|
defaultValue: suggestedName,
|
||||||
initialValue: suggestedName,
|
initialValue: suggestedName,
|
||||||
placeholder: suggestedName,
|
placeholder: suggestedName,
|
||||||
@@ -183,10 +183,10 @@ export async function setupTurso(projectDir: string) {
|
|||||||
const s = spinner();
|
const s = spinner();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s.start(`Creating Turso database "${dbName}"...`);
|
s.start(`🔄 Creating Turso database "${dbName}"...`);
|
||||||
const config = await createTursoDatabase(dbName);
|
const config = await createTursoDatabase(dbName);
|
||||||
await writeEnvFile(projectDir, config);
|
await writeEnvFile(projectDir, config);
|
||||||
s.stop("Turso database configured successfully!");
|
s.stop("✅ Turso database configured successfully!");
|
||||||
success = true;
|
success = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error && error.message === "DATABASE_EXISTS") {
|
if (error instanceof Error && error.message === "DATABASE_EXISTS") {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ async function gatherConfig(
|
|||||||
|
|
||||||
while (!isValid) {
|
while (!isValid) {
|
||||||
const response = await text({
|
const response = await text({
|
||||||
message: "📝 Project name",
|
message: "📝 What is your project named? (directory name or path)",
|
||||||
placeholder: defaultName,
|
placeholder: defaultName,
|
||||||
initialValue: flags.projectName,
|
initialValue: flags.projectName,
|
||||||
defaultValue: defaultName,
|
defaultValue: defaultName,
|
||||||
@@ -85,17 +85,17 @@ async function gatherConfig(
|
|||||||
database: () =>
|
database: () =>
|
||||||
!flags.database
|
!flags.database
|
||||||
? select<ProjectDatabase>({
|
? select<ProjectDatabase>({
|
||||||
message: "💾 Select database",
|
message: "💾 Which database would you like to use?",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
value: "libsql",
|
value: "libsql",
|
||||||
label: "libSQL",
|
label: "libSQL",
|
||||||
hint: "✨ (Recommended) - Turso's embedded SQLite database",
|
hint: "Turso's embedded SQLite database (recommended)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "postgres",
|
value: "postgres",
|
||||||
label: "PostgreSQL",
|
label: "PostgreSQL",
|
||||||
hint: "🐘 Traditional relational database",
|
hint: "Traditional relational database",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@@ -103,28 +103,29 @@ async function gatherConfig(
|
|||||||
auth: () =>
|
auth: () =>
|
||||||
flags.auth === undefined
|
flags.auth === undefined
|
||||||
? confirm({
|
? confirm({
|
||||||
message: "🔐 Add authentication with Better-Auth?",
|
message:
|
||||||
|
"🔐 Would you like to add authentication with Better-Auth?",
|
||||||
})
|
})
|
||||||
: Promise.resolve(flags.auth),
|
: Promise.resolve(flags.auth),
|
||||||
features: () =>
|
features: () =>
|
||||||
!flags.features
|
!flags.features
|
||||||
? multiselect<ProjectFeature>({
|
? multiselect<ProjectFeature>({
|
||||||
message: "🎯 Select additional features",
|
message: "✨ Which features would you like to add?",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
value: "docker",
|
value: "docker",
|
||||||
label: "Docker setup",
|
label: "Docker setup",
|
||||||
hint: "🐳 Containerize your application",
|
hint: "Containerize your application",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "github-actions",
|
value: "github-actions",
|
||||||
label: "GitHub Actions",
|
label: "GitHub Actions",
|
||||||
hint: "⚡ CI/CD workflows",
|
hint: "CI/CD workflows",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "SEO",
|
value: "SEO",
|
||||||
label: "Basic SEO setup",
|
label: "Basic SEO setup",
|
||||||
hint: "🔍 Search engine optimization configuration",
|
hint: "Search engine optimization configuration",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@@ -132,7 +133,7 @@ async function gatherConfig(
|
|||||||
git: () =>
|
git: () =>
|
||||||
flags.git !== false
|
flags.git !== false
|
||||||
? confirm({
|
? confirm({
|
||||||
message: "🗃️ Initialize Git repository?",
|
message: "🗃️ Initialize a new git repository?",
|
||||||
initialValue: true,
|
initialValue: true,
|
||||||
})
|
})
|
||||||
: Promise.resolve(false),
|
: Promise.resolve(false),
|
||||||
@@ -140,20 +141,15 @@ async function gatherConfig(
|
|||||||
const detectedPackageManager = getUserPkgManager();
|
const detectedPackageManager = getUserPkgManager();
|
||||||
|
|
||||||
const useDetected = await confirm({
|
const useDetected = await confirm({
|
||||||
message: `📦 Use detected package manager (${detectedPackageManager})?`,
|
message: `📦 Use ${detectedPackageManager} as your package manager?`,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (useDetected) return detectedPackageManager;
|
if (useDetected) return detectedPackageManager;
|
||||||
|
|
||||||
return select<PackageManager>({
|
return select<PackageManager>({
|
||||||
message: "📦 Select package manager",
|
message: "📦 Which package manager would you like to use?",
|
||||||
options: [
|
options: [
|
||||||
{ value: "npm", label: "npm", hint: "Node Package Manager" },
|
{ value: "npm", label: "npm", hint: "Node Package Manager" },
|
||||||
{
|
|
||||||
value: "bun",
|
|
||||||
label: "bun",
|
|
||||||
hint: "All-in-one JavaScript runtime & toolkit (recommended)",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: "pnpm",
|
value: "pnpm",
|
||||||
label: "pnpm",
|
label: "pnpm",
|
||||||
@@ -164,7 +160,13 @@ async function gatherConfig(
|
|||||||
label: "yarn",
|
label: "yarn",
|
||||||
hint: "Fast, reliable, and secure dependency management",
|
hint: "Fast, reliable, and secure dependency management",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: "bun",
|
||||||
|
label: "bun",
|
||||||
|
hint: "All-in-one JavaScript runtime & toolkit (recommended)",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
initialValue: "bun",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -191,7 +193,7 @@ async function main() {
|
|||||||
try {
|
try {
|
||||||
process.stdout.write("\x1Bc");
|
process.stdout.write("\x1Bc");
|
||||||
renderTitle();
|
renderTitle();
|
||||||
intro(chalk.bold("Creating a new Better-T Stack project"));
|
intro(chalk.bold("✨ Creating a new Better-T-Stack project"));
|
||||||
program
|
program
|
||||||
.name("create-better-t-stack")
|
.name("create-better-t-stack")
|
||||||
.description("Create a new Better-T Stack project")
|
.description("Create a new Better-T Stack project")
|
||||||
@@ -256,15 +258,15 @@ async function main() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
log.message(
|
log.message(
|
||||||
`${chalk.blue("Project Name: ")}${
|
`${chalk.blue("📝 Project Name: ")}${
|
||||||
colorizedConfig.projectName
|
colorizedConfig.projectName
|
||||||
}\n${chalk.blue("Database: ")}${colorizedConfig.database}\n${chalk.blue(
|
}\n${chalk.blue("💾 Database: ")}${colorizedConfig.database}\n${chalk.blue(
|
||||||
"Authentication: ",
|
"🔐 Authentication: ",
|
||||||
)}${colorizedConfig.auth}\n${chalk.blue("Features: ")}${
|
)}${colorizedConfig.auth}\n${chalk.blue("✨ Features: ")}${
|
||||||
colorizedConfig.features.length
|
colorizedConfig.features.length
|
||||||
? colorizedConfig.features.join(", ")
|
? colorizedConfig.features.join(", ")
|
||||||
: chalk.gray("none")
|
: chalk.gray("none")
|
||||||
}\n${chalk.blue("Git Init: ")}${colorizedConfig.git}\n`,
|
}\n${chalk.blue("🗃️ Git Init: ")}${colorizedConfig.git}\n`,
|
||||||
);
|
);
|
||||||
|
|
||||||
s.stop("Configuration loaded");
|
s.stop("Configuration loaded");
|
||||||
@@ -272,12 +274,11 @@ async function main() {
|
|||||||
|
|
||||||
await createProject(config);
|
await createProject(config);
|
||||||
|
|
||||||
log.message("You can reproduce this setup with the following command:", {
|
log.info(
|
||||||
symbol: chalk.cyan("🔄"),
|
`You can reproduce this setup with the following command:\n${generateReproducibleCommand(config)}`,
|
||||||
});
|
);
|
||||||
log.info(generateReproducibleCommand(config));
|
|
||||||
|
|
||||||
outro("Project created successfully! 🎉");
|
outro("🎉 Project created successfully!");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
s.stop("Failed");
|
s.stop("Failed");
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
import gradient from "gradient-string";
|
import gradient from "gradient-string";
|
||||||
import { TITLE_TEXT } from "./consts";
|
|
||||||
|
export const TITLE_TEXT = `
|
||||||
|
╔════════════════════════════════════════════════════════════╗
|
||||||
|
║ ║
|
||||||
|
║ ██████╗ ███████╗████████╗████████╗███████╗██████╗ ║
|
||||||
|
║ ██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗ ║
|
||||||
|
║ ██████╔╝█████╗ ██║ ██║ █████╗ ██████╔╝ ║
|
||||||
|
║ ██╔══██╗██╔══╝ ██║ ██║ ██╔══╝ ██╔══██╗ ║
|
||||||
|
║ ██████╔╝███████╗ ██║ ██║ ███████╗██║ ██║ ║
|
||||||
|
║ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ║
|
||||||
|
║ ║
|
||||||
|
║ ████████╗ ███████╗████████╗ █████╗ ██████╗██╗ ██╗ ║
|
||||||
|
║ ╚══██╔══╝ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ║
|
||||||
|
║ ██║ ███████╗ ██║ ███████║██║ █████╔╝ ║
|
||||||
|
║ ██║ ╚════██║ ██║ ██╔══██║██║ ██╔═██╗ ║
|
||||||
|
║ ██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗ ║
|
||||||
|
║ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ║
|
||||||
|
║ ║
|
||||||
|
║ The Modern Full-Stack Framework ║
|
||||||
|
║ ║
|
||||||
|
╚════════════════════════════════════════════════════════════╝
|
||||||
|
`;
|
||||||
|
|
||||||
const catppuccinTheme = {
|
const catppuccinTheme = {
|
||||||
rosewater: "#F5E0DC",
|
rosewater: "#F5E0DC",
|
||||||
|
|||||||
@@ -5,6 +5,16 @@ import type { ProjectConfig } from "../types";
|
|||||||
export function generateReproducibleCommand(config: ProjectConfig): string {
|
export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||||
const flags: string[] = [];
|
const flags: string[] = [];
|
||||||
|
|
||||||
|
const isMainlyDefault = Object.entries(config).every(([key, value]) => {
|
||||||
|
if (key === "projectName") return true;
|
||||||
|
if (key === "features" && Array.isArray(value)) return value.length === 0;
|
||||||
|
return value === DEFAULT_CONFIG[key as keyof ProjectConfig];
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isMainlyDefault) {
|
||||||
|
flags.push(chalk.gray("-y"));
|
||||||
|
}
|
||||||
|
|
||||||
if (config.database !== DEFAULT_CONFIG.database) {
|
if (config.database !== DEFAULT_CONFIG.database) {
|
||||||
flags.push(chalk.cyan(`--database ${config.database}`));
|
flags.push(chalk.cyan(`--database ${config.database}`));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user