remove ugly emojis

This commit is contained in:
Aman Varshney
2025-02-17 13:19:16 +05:30
parent 6454dc7d07
commit d30adfdb87
6 changed files with 45 additions and 53 deletions

View File

@@ -0,0 +1,5 @@
---
"create-better-t-stack": patch
---
remove ugly emojis

View File

@@ -13,7 +13,7 @@
"url": "git+https://github.com/better-t-stack/create-better-t-stack.git",
"directory": "apps/cli"
},
"homepage": "https://github.com/better-t-stack/create-better-t-stack/tree/main/apps/cli#readme",
"homepage": "https://better-t-stack.pages.dev/",
"scripts": {
"build": "tsup",
"dev": "tsup --watch",

View File

@@ -15,13 +15,13 @@ export async function createProject(options: ProjectConfig) {
try {
const tasksList = [
{
title: "📁 Creating project directory",
title: "Creating project directory",
task: async () => {
await fs.ensureDir(projectDir);
},
},
{
title: "📥 Cloning template repository",
title: "Cloning template repository",
task: async () => {
try {
const emitter = degit("better-t-stack/Better-T-Stack#bare");
@@ -39,7 +39,7 @@ export async function createProject(options: ProjectConfig) {
if (options.git) {
tasksList.push({
title: "🗃️ Initializing git repository",
title: "Initializing git repository",
task: async () => {
await $({
cwd: projectDir,
@@ -55,7 +55,7 @@ export async function createProject(options: ProjectConfig) {
}
const installDepsResponse = await confirm({
message: `📦 Install dependencies with ${pc.magenta(options.packageManager)}?`,
message: `Install dependencies with ${options.packageManager}?`,
});
if (isCancel(installDepsResponse)) {
@@ -66,14 +66,12 @@ export async function createProject(options: ProjectConfig) {
shouldInstallDeps = installDepsResponse;
if (shouldInstallDeps) {
s.start(
`📦 Installing dependencies using ${pc.magenta(options.packageManager)}...`,
);
s.start(`Installing dependencies using ${options.packageManager}...`);
try {
await $({
cwd: projectDir,
})`${options.packageManager} install`;
s.stop("Dependencies installed successfully");
s.stop("Dependencies installed successfully");
} catch (error) {
s.stop(pc.red("Failed to install dependencies"));
if (error instanceof Error) {

View File

@@ -1,14 +1,6 @@
import os from "node:os";
import path from "node:path";
import {
cancel,
confirm,
isCancel,
log,
outro,
spinner,
text,
} from "@clack/prompts";
import { cancel, confirm, isCancel, log, spinner, text } from "@clack/prompts";
import { $ } from "execa";
import fs from "fs-extra";
import pc from "picocolors";
@@ -22,9 +14,9 @@ interface TursoConfig {
async function loginToTurso() {
const s = spinner();
try {
s.start("🔄 Logging in to Turso...");
s.start("Logging in to Turso...");
await $`turso auth login`;
s.stop("Logged in to Turso successfully!");
s.stop("Logged in to Turso successfully!");
} catch (error) {
s.stop(pc.red("Failed to log in to Turso"));
throw error;
@@ -34,7 +26,7 @@ async function loginToTurso() {
async function installTursoCLI(isMac: boolean) {
const s = spinner();
try {
s.start("🔄 Installing Turso CLI...");
s.start("Installing Turso CLI...");
if (isMac) {
await $`brew install tursodatabase/tap/turso`;
@@ -44,7 +36,7 @@ async function installTursoCLI(isMac: boolean) {
await $`bash -c '${installScript}'`;
}
s.stop("Turso CLI installed successfully!");
s.stop("Turso CLI installed successfully!");
} catch (error) {
if (error instanceof Error && error.message.includes("User force closed")) {
s.stop();
@@ -87,7 +79,7 @@ TURSO_AUTH_TOKEN=`;
}
function displayManualSetupInstructions() {
log.info(`🔧 Manual Turso Setup Instructions:
log.info(`Manual Turso Setup Instructions:
1. Visit https://turso.tech and create an account
2. Create a new database from the dashboard
@@ -115,7 +107,7 @@ export async function setupTurso(projectDir: string) {
if (!isCliInstalled) {
const shouldInstall = await confirm({
message: "🔧 Would you like to install Turso CLI?",
message: "Would you like to install Turso CLI?",
});
if (isCancel(shouldInstall)) {
@@ -130,7 +122,7 @@ export async function setupTurso(projectDir: string) {
}
const s = spinner();
s.start("🔄 Installing Turso CLI...");
s.start("Installing Turso CLI...");
try {
if (isMac) {
await $`brew install tursodatabase/tap/turso`;
@@ -139,7 +131,7 @@ export async function setupTurso(projectDir: string) {
await $`curl -sSfL https://get.tur.so/install.sh`;
await $`bash -c '${installScript}'`;
}
s.stop("Turso CLI installed successfully!");
s.stop("Turso CLI installed successfully!");
} catch (error) {
s.stop(pc.red("Failed to install Turso CLI"));
throw error;
@@ -149,10 +141,10 @@ export async function setupTurso(projectDir: string) {
const isLoggedIn = await isTursoLoggedIn();
if (!isLoggedIn) {
const s = spinner();
s.start("🔄 Logging in to Turso...");
s.start("Logging in to Turso...");
try {
await $`turso auth login`;
s.stop("Logged in to Turso successfully!");
s.stop("Logged in to Turso successfully!");
} catch (error) {
s.stop(pc.red("Failed to log in to Turso"));
throw error;
@@ -165,7 +157,7 @@ export async function setupTurso(projectDir: string) {
while (!success) {
const dbNameResponse = await text({
message: "📝 Enter a name for your database:",
message: "Enter a name for your database:",
defaultValue: suggestedName,
initialValue: suggestedName,
placeholder: suggestedName,
@@ -180,10 +172,10 @@ export async function setupTurso(projectDir: string) {
const s = spinner();
try {
s.start(`🔄 Creating Turso database "${dbName}"...`);
s.start(`Creating Turso database "${dbName}"...`);
const config = await createTursoDatabase(dbName);
await writeEnvFile(projectDir, config);
s.stop("Turso database configured successfully!");
s.stop("Turso database configured successfully!");
success = true;
} catch (error) {
if (error instanceof Error && error.message === "DATABASE_EXISTS") {

View File

@@ -53,7 +53,7 @@ async function gatherConfig(
while (!isValid) {
const response = await text({
message: "📝 What is your project named? (directory name or path)",
message: "What is your project named? (directory name or path)",
placeholder: defaultName,
initialValue: flags.projectName,
defaultValue: defaultName,
@@ -87,7 +87,7 @@ async function gatherConfig(
flags.database !== undefined
? Promise.resolve(flags.database)
: select<ProjectDatabase>({
message: "💾 Which database would you like to use?",
message: "Which database would you like to use?",
options: [
{
value: "libsql",
@@ -105,15 +105,14 @@ async function gatherConfig(
flags.auth !== undefined
? Promise.resolve(flags.auth)
: confirm({
message:
"🔐 Would you like to add authentication with Better-Auth?",
message: "Would you like to add authentication with Better-Auth?",
initialValue: DEFAULT_CONFIG.auth,
}),
features: () =>
flags.features !== undefined
? Promise.resolve(flags.features)
: multiselect<ProjectFeature>({
message: "Which features would you like to add?",
message: "Which features would you like to add?",
options: [
{
value: "docker",
@@ -137,7 +136,7 @@ async function gatherConfig(
flags.git !== undefined
? Promise.resolve(flags.git)
: confirm({
message: "🗃️ Initialize a new git repository?",
message: "Initialize a new git repository?",
initialValue: DEFAULT_CONFIG.git,
}),
packageManager: async () => {
@@ -147,13 +146,13 @@ async function gatherConfig(
const detectedPackageManager = getUserPkgManager();
const useDetected = await confirm({
message: `📦 Use ${detectedPackageManager} as your package manager?`,
message: `Use ${detectedPackageManager} as your package manager?`,
});
if (useDetected) return detectedPackageManager;
return select<PackageManager>({
message: "📦 Which package manager would you like to use?",
message: "Which package manager would you like to use?",
options: [
{ value: "npm", label: "npm", hint: "Node Package Manager" },
{
@@ -198,25 +197,23 @@ function displayConfig(config: Partial<ProjectConfig>) {
const configDisplay = [];
if (config.projectName) {
configDisplay.push(`${pc.blue("📝 Project Name:")} ${config.projectName}`);
configDisplay.push(`${pc.blue("Project Name:")} ${config.projectName}`);
}
if (config.database) {
configDisplay.push(`${pc.blue("💾 Database:")} ${config.database}`);
configDisplay.push(`${pc.blue("Database:")} ${config.database}`);
}
if (config.auth !== undefined) {
configDisplay.push(`${pc.blue("🔐 Authentication:")} ${config.auth}`);
configDisplay.push(`${pc.blue("Authentication:")} ${config.auth}`);
}
if (config.features?.length) {
configDisplay.push(
`${pc.blue("✨ Features:")} ${config.features.join(", ")}`,
);
configDisplay.push(`${pc.blue("Features:")} ${config.features.join(", ")}`);
}
if (config.git !== undefined) {
configDisplay.push(`${pc.blue("🗃️ Git Init:")} ${config.git}`);
configDisplay.push(`${pc.blue("Git Init:")} ${config.git}`);
}
if (config.packageManager) {
configDisplay.push(
`${pc.blue("📦 Package Manager:")} ${config.packageManager}`,
`${pc.blue("Package Manager:")} ${config.packageManager}`,
);
}
@@ -228,7 +225,7 @@ async function main() {
try {
process.stdout.write("\x1Bc");
renderTitle();
intro(pc.magenta("Creating a new Better-T-Stack project"));
intro(pc.magenta("Creating a new Better-T-Stack project"));
program
.name("create-better-t-stack")
.description("Create a new Better-T Stack project")
@@ -280,7 +277,7 @@ async function main() {
!options.yes &&
Object.values(flagConfig).some((v) => v !== undefined)
) {
log.info(pc.yellow("🎯 Using these pre-selected options:"));
log.info(pc.yellow("Using these pre-selected options:"));
log.message(displayConfig(flagConfig));
log.message("");
}
@@ -304,7 +301,7 @@ async function main() {
: await gatherConfig(flagConfig);
if (options.yes) {
log.info(pc.yellow("🎯 Using these default options:"));
log.info(pc.yellow("Using these default options:"));
log.message(displayConfig(config));
log.message("");
}
@@ -319,7 +316,7 @@ async function main() {
),
);
outro(pc.magenta("🎉 Project created successfully!"));
outro(pc.magenta("Project created successfully!"));
} catch (error) {
s.stop(pc.red("Failed"));
if (error instanceof Error) {

View File

@@ -2,6 +2,8 @@ export type ProjectFeature = "docker" | "github-actions" | "SEO";
export type ProjectDatabase = "libsql" | "postgres";
export type PackageManager = "npm" | "yarn" | "pnpm" | "bun";
export type ProjectConfig = {
yes?: boolean;
projectName: string;
@@ -11,5 +13,3 @@ export type ProjectConfig = {
packageManager: PackageManager;
features: ProjectFeature[];
};
export type PackageManager = "npm" | "yarn" | "pnpm" | "bun";