Skip to content

Commit 31f1271

Browse files
improve prompts
1 parent 184277d commit 31f1271

File tree

7 files changed

+88
-80
lines changed

7 files changed

+88
-80
lines changed

.changeset/beige-mugs-wash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-better-t-stack": patch
3+
---
4+
5+
Improve prompts

apps/cli/src/consts.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,6 @@ import path from "node:path";
22
import { fileURLToPath } from "node:url";
33
import type { ProjectConfig } from "./types";
44

5-
export const TITLE_TEXT = `
6-
╔════════════════════════════════════════════════════════════╗
7-
║ ║
8-
║ ██████╗ ███████╗████████╗████████╗███████╗██████╗ ║
9-
║ ██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗ ║
10-
║ ██████╔╝█████╗ ██║ ██║ █████╗ ██████╔╝ ║
11-
║ ██╔══██╗██╔══╝ ██║ ██║ ██╔══╝ ██╔══██╗ ║
12-
║ ██████╔╝███████╗ ██║ ██║ ███████╗██║ ██║ ║
13-
║ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ║
14-
║ ║
15-
║ ████████╗ ███████╗████████╗ █████╗ ██████╗██╗ ██╗ ║
16-
║ ╚══██╔══╝ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ║
17-
║ ██║ ███████╗ ██║ ███████║██║ █████╔╝ ║
18-
║ ██║ ╚════██║ ██║ ██╔══██║██║ ██╔═██╗ ║
19-
║ ██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗ ║
20-
║ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ║
21-
║ ║
22-
║ The Modern Full-Stack Framework ║
23-
║ ║
24-
╚════════════════════════════════════════════════════════════╝
25-
`;
26-
275
const __filename = fileURLToPath(import.meta.url);
286
const distPath = path.dirname(__filename);
297
export const PKG_ROOT = path.join(distPath, "../");

apps/cli/src/helpers/create-project.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export async function createProject(options: ProjectConfig) {
1414
try {
1515
const tasksList = [
1616
{
17-
title: "Creating project directory",
17+
title: "📁 Creating project directory",
1818
task: async () => {
1919
await fs.ensureDir(projectDir);
2020
},
2121
},
2222
{
23-
title: "Cloning template repository",
23+
title: "📥 Cloning template repository",
2424
task: async () => {
2525
try {
2626
await $`npx degit AmanVarshney01/Better-T-Stack ${projectDir}`;
@@ -37,7 +37,7 @@ export async function createProject(options: ProjectConfig) {
3737

3838
if (options.git) {
3939
tasksList.push({
40-
title: "Initializing git repository",
40+
title: "🗃️ Initializing git repository",
4141
task: async () => {
4242
await $`git init ${projectDir}`;
4343
},
@@ -51,7 +51,7 @@ export async function createProject(options: ProjectConfig) {
5151
}
5252

5353
const installDepsResponse = await confirm({
54-
message: `📦 Install dependencies using ${options.packageManager}?`,
54+
message: `📦 Install dependencies with ${options.packageManager}?`,
5555
});
5656

5757
if (isCancel(installDepsResponse)) {
@@ -62,13 +62,13 @@ export async function createProject(options: ProjectConfig) {
6262
shouldInstallDeps = installDepsResponse;
6363

6464
if (shouldInstallDeps) {
65-
s.start(`Installing dependencies using ${options.packageManager}...`);
65+
s.start(`📦 Installing dependencies using ${options.packageManager}...`);
6666
try {
6767
await $({
6868
cwd: projectDir,
6969
stdio: "inherit",
7070
})`${options.packageManager} install`;
71-
s.stop("Dependencies installed successfully");
71+
s.stop("Dependencies installed successfully");
7272
} catch (error) {
7373
s.stop("Failed to install dependencies");
7474
if (error instanceof Error) {
@@ -79,16 +79,9 @@ export async function createProject(options: ProjectConfig) {
7979
}
8080

8181
log.success("✨ Project created successfully!\n");
82-
log.info(chalk.dim("Next steps:"));
83-
log.info(` cd ${options.projectName}`);
84-
if (!shouldInstallDeps) {
85-
log.info(` ${options.packageManager} install`);
86-
}
87-
log.info(
88-
` ${
89-
options.packageManager === "npm" ? "npm run" : options.packageManager
90-
} dev`,
91-
);
82+
log.info(`${chalk.dim("Next steps:")}
83+
cd ${options.projectName}${!shouldInstallDeps ? `\n${options.packageManager} install` : ""}
84+
${options.packageManager === "npm" ? "npm run" : options.packageManager} dev`);
9285
} catch (error) {
9386
s.stop("Failed");
9487
if (error instanceof Error) {

apps/cli/src/helpers/db-setup.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ interface TursoConfig {
2626
async function loginToTurso() {
2727
const s = spinner();
2828
try {
29-
s.start("Logging in to Turso...");
29+
s.start("🔄 Logging in to Turso...");
3030
await $`turso auth login`;
31-
s.stop("Logged in to Turso successfully!");
31+
s.stop("Logged in to Turso successfully!");
3232
} catch (error) {
3333
s.stop("Failed to log in to Turso");
3434
throw error;
@@ -38,7 +38,7 @@ async function loginToTurso() {
3838
async function installTursoCLI(isMac: boolean) {
3939
const s = spinner();
4040
try {
41-
s.start("Installing Turso CLI...");
41+
s.start("🔄 Installing Turso CLI...");
4242

4343
if (isMac) {
4444
await $`brew install tursodatabase/tap/turso`;
@@ -48,7 +48,7 @@ async function installTursoCLI(isMac: boolean) {
4848
await $`bash -c '${installScript}'`;
4949
}
5050

51-
s.stop("Turso CLI installed successfully!");
51+
s.stop("Turso CLI installed successfully!");
5252
} catch (error) {
5353
if (error instanceof Error && error.message.includes("User force closed")) {
5454
s.stop();
@@ -91,7 +91,7 @@ TURSO_AUTH_TOKEN=`;
9191
}
9292

9393
function displayManualSetupInstructions() {
94-
log.info("📝 Manual Turso Setup Instructions:");
94+
log.info("🔧 Manual Turso Setup Instructions:");
9595
log.info("1. Visit https://turso.tech and create an account");
9696
log.info("2. Create a new database from the dashboard");
9797
log.info("3. Get your database URL and authentication token");
@@ -118,7 +118,7 @@ export async function setupTurso(projectDir: string) {
118118

119119
if (!isCliInstalled) {
120120
const shouldInstall = await confirm({
121-
message: "Would you like to install Turso CLI?",
121+
message: "🔧 Would you like to install Turso CLI?",
122122
});
123123

124124
if (isCancel(shouldInstall)) {
@@ -133,7 +133,7 @@ export async function setupTurso(projectDir: string) {
133133
}
134134

135135
const s = spinner();
136-
s.start("Installing Turso CLI...");
136+
s.start("🔄 Installing Turso CLI...");
137137
try {
138138
if (isMac) {
139139
await $`brew install tursodatabase/tap/turso`;
@@ -142,7 +142,7 @@ export async function setupTurso(projectDir: string) {
142142
await $`curl -sSfL https://get.tur.so/install.sh`;
143143
await $`bash -c '${installScript}'`;
144144
}
145-
s.stop("Turso CLI installed successfully!");
145+
s.stop("Turso CLI installed successfully!");
146146
} catch (error) {
147147
s.stop("Failed to install Turso CLI");
148148
throw error;
@@ -152,10 +152,10 @@ export async function setupTurso(projectDir: string) {
152152
const isLoggedIn = await isTursoLoggedIn();
153153
if (!isLoggedIn) {
154154
const s = spinner();
155-
s.start("Logging in to Turso...");
155+
s.start("🔄 Logging in to Turso...");
156156
try {
157157
await $`turso auth login`;
158-
s.stop("Logged in to Turso successfully!");
158+
s.stop("Logged in to Turso successfully!");
159159
} catch (error) {
160160
s.stop("Failed to log in to Turso");
161161
throw error;
@@ -168,7 +168,7 @@ export async function setupTurso(projectDir: string) {
168168

169169
while (!success) {
170170
const dbNameResponse = await text({
171-
message: "Enter database name:",
171+
message: "📝 Enter a name for your database:",
172172
defaultValue: suggestedName,
173173
initialValue: suggestedName,
174174
placeholder: suggestedName,
@@ -183,10 +183,10 @@ export async function setupTurso(projectDir: string) {
183183
const s = spinner();
184184

185185
try {
186-
s.start(`Creating Turso database "${dbName}"...`);
186+
s.start(`🔄 Creating Turso database "${dbName}"...`);
187187
const config = await createTursoDatabase(dbName);
188188
await writeEnvFile(projectDir, config);
189-
s.stop("Turso database configured successfully!");
189+
s.stop("Turso database configured successfully!");
190190
success = true;
191191
} catch (error) {
192192
if (error instanceof Error && error.message === "DATABASE_EXISTS") {

apps/cli/src/index.ts

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async function gatherConfig(
5252

5353
while (!isValid) {
5454
const response = await text({
55-
message: "📝 Project name",
55+
message: "📝 What is your project named? (directory name or path)",
5656
placeholder: defaultName,
5757
initialValue: flags.projectName,
5858
defaultValue: defaultName,
@@ -85,75 +85,71 @@ async function gatherConfig(
8585
database: () =>
8686
!flags.database
8787
? select<ProjectDatabase>({
88-
message: "💾 Select database",
88+
message: "💾 Which database would you like to use?",
8989
options: [
9090
{
9191
value: "libsql",
9292
label: "libSQL",
93-
hint: "✨ (Recommended) - Turso's embedded SQLite database",
93+
hint: "Turso's embedded SQLite database (recommended)",
9494
},
9595
{
9696
value: "postgres",
9797
label: "PostgreSQL",
98-
hint: "🐘 Traditional relational database",
98+
hint: "Traditional relational database",
9999
},
100100
],
101101
})
102102
: Promise.resolve(flags.database),
103103
auth: () =>
104104
flags.auth === undefined
105105
? confirm({
106-
message: "🔐 Add authentication with Better-Auth?",
106+
message:
107+
"🔐 Would you like to add authentication with Better-Auth?",
107108
})
108109
: Promise.resolve(flags.auth),
109110
features: () =>
110111
!flags.features
111112
? multiselect<ProjectFeature>({
112-
message: "🎯 Select additional features",
113+
message: "✨ Which features would you like to add?",
113114
options: [
114115
{
115116
value: "docker",
116117
label: "Docker setup",
117-
hint: "🐳 Containerize your application",
118+
hint: "Containerize your application",
118119
},
119120
{
120121
value: "github-actions",
121122
label: "GitHub Actions",
122-
hint: "CI/CD workflows",
123+
hint: "CI/CD workflows",
123124
},
124125
{
125126
value: "SEO",
126127
label: "Basic SEO setup",
127-
hint: "🔍 Search engine optimization configuration",
128+
hint: "Search engine optimization configuration",
128129
},
129130
],
130131
})
131132
: Promise.resolve(flags.features),
132133
git: () =>
133134
flags.git !== false
134135
? confirm({
135-
message: "🗃️ Initialize Git repository?",
136+
message: "🗃️ Initialize a new git repository?",
136137
initialValue: true,
137138
})
138139
: Promise.resolve(false),
139140
packageManager: async () => {
140141
const detectedPackageManager = getUserPkgManager();
141142

142143
const useDetected = await confirm({
143-
message: `📦 Use detected package manager (${detectedPackageManager})?`,
144+
message: `📦 Use ${detectedPackageManager} as your package manager?`,
144145
});
145146

146147
if (useDetected) return detectedPackageManager;
147148

148149
return select<PackageManager>({
149-
message: "📦 Select package manager",
150+
message: "📦 Which package manager would you like to use?",
150151
options: [
151152
{ value: "npm", label: "npm", hint: "Node Package Manager" },
152-
{
153-
value: "bun",
154-
label: "bun",
155-
hint: "All-in-one JavaScript runtime & toolkit (recommended)",
156-
},
157153
{
158154
value: "pnpm",
159155
label: "pnpm",
@@ -164,7 +160,13 @@ async function gatherConfig(
164160
label: "yarn",
165161
hint: "Fast, reliable, and secure dependency management",
166162
},
163+
{
164+
value: "bun",
165+
label: "bun",
166+
hint: "All-in-one JavaScript runtime & toolkit (recommended)",
167+
},
167168
],
169+
initialValue: "bun",
168170
});
169171
},
170172
},
@@ -191,7 +193,7 @@ async function main() {
191193
try {
192194
process.stdout.write("\x1Bc");
193195
renderTitle();
194-
intro(chalk.bold("Creating a new Better-T Stack project"));
196+
intro(chalk.bold("Creating a new Better-T-Stack project"));
195197
program
196198
.name("create-better-t-stack")
197199
.description("Create a new Better-T Stack project")
@@ -256,28 +258,27 @@ async function main() {
256258
};
257259

258260
log.message(
259-
`${chalk.blue("Project Name: ")}${
261+
`${chalk.blue("📝 Project Name: ")}${
260262
colorizedConfig.projectName
261-
}\n${chalk.blue("Database: ")}${colorizedConfig.database}\n${chalk.blue(
262-
"Authentication: ",
263-
)}${colorizedConfig.auth}\n${chalk.blue("Features: ")}${
263+
}\n${chalk.blue("💾 Database: ")}${colorizedConfig.database}\n${chalk.blue(
264+
"🔐 Authentication: ",
265+
)}${colorizedConfig.auth}\n${chalk.blue("Features: ")}${
264266
colorizedConfig.features.length
265267
? colorizedConfig.features.join(", ")
266268
: chalk.gray("none")
267-
}\n${chalk.blue("Git Init: ")}${colorizedConfig.git}\n`,
269+
}\n${chalk.blue("🗃️ Git Init: ")}${colorizedConfig.git}\n`,
268270
);
269271

270272
s.stop("Configuration loaded");
271273
}
272274

273275
await createProject(config);
274276

275-
log.message("You can reproduce this setup with the following command:", {
276-
symbol: chalk.cyan("🔄"),
277-
});
278-
log.info(generateReproducibleCommand(config));
277+
log.info(
278+
`You can reproduce this setup with the following command:\n${generateReproducibleCommand(config)}`,
279+
);
279280

280-
outro("Project created successfully! 🎉");
281+
outro("🎉 Project created successfully!");
281282
} catch (error) {
282283
s.stop("Failed");
283284
if (error instanceof Error) {

apps/cli/src/render-title.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
import gradient from "gradient-string";
2-
import { TITLE_TEXT } from "./consts";
2+
3+
export const TITLE_TEXT = `
4+
╔════════════════════════════════════════════════════════════╗
5+
║ ║
6+
║ ██████╗ ███████╗████████╗████████╗███████╗██████╗ ║
7+
║ ██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗ ║
8+
║ ██████╔╝█████╗ ██║ ██║ █████╗ ██████╔╝ ║
9+
║ ██╔══██╗██╔══╝ ██║ ██║ ██╔══╝ ██╔══██╗ ║
10+
║ ██████╔╝███████╗ ██║ ██║ ███████╗██║ ██║ ║
11+
║ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ║
12+
║ ║
13+
║ ████████╗ ███████╗████████╗ █████╗ ██████╗██╗ ██╗ ║
14+
║ ╚══██╔══╝ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ║
15+
║ ██║ ███████╗ ██║ ███████║██║ █████╔╝ ║
16+
║ ██║ ╚════██║ ██║ ██╔══██║██║ ██╔═██╗ ║
17+
║ ██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗ ║
18+
║ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ║
19+
║ ║
20+
║ The Modern Full-Stack Framework ║
21+
║ ║
22+
╚════════════════════════════════════════════════════════════╝
23+
`;
324

425
const catppuccinTheme = {
526
rosewater: "#F5E0DC",

0 commit comments

Comments
 (0)