Replace log.info with note for post-install instructions and Update

readme
This commit is contained in:
Aman Varshney
2025-04-01 13:41:37 +05:30
parent bcedaee16b
commit 5435dd3530
4 changed files with 52 additions and 66 deletions

View File

@@ -0,0 +1,5 @@
---
"create-better-t-stack": patch
---
Replace log.info with note for post-install instructions

View File

@@ -57,10 +57,6 @@ bun dev:cli
bun dev:web bun dev:web
``` ```
## Contributors ## Want to contribute?
<a href="https://github.com/better-t-stack/create-better-t-stack/graphs/contributors"> Just fork the repository and submit a pull request!
<img src="https://contrib.rocks/image?repo=better-t-stack/create-better-t-stack" />
</a>
Made with [contrib.rocks](https://contrib.rocks).

View File

@@ -34,7 +34,7 @@ Follow the prompts to configure your project or use the `-y` flag for defaults.
- **Desktop Apps**: Build native desktop apps with Tauri integration - **Desktop Apps**: Build native desktop apps with Tauri integration
- **Code Quality**: Biome for linting and formatting - **Code Quality**: Biome for linting and formatting
- **Git Hooks**: Husky with lint-staged for pre-commit checks - **Git Hooks**: Husky with lint-staged for pre-commit checks
- **Examples**: Todo app with full CRUD functionality - **Examples**: Todo app with full CRUD functionality, AI Chat using AI SDK
- **Developer Experience**: Git initialization, various package manager support (npm, pnpm, bun) - **Developer Experience**: Git initialization, various package manager support (npm, pnpm, bun)
## Usage ## Usage
@@ -43,39 +43,27 @@ Follow the prompts to configure your project or use the `-y` flag for defaults.
Usage: create-better-t-stack [project-directory] [options] Usage: create-better-t-stack [project-directory] [options]
Options: Options:
-V, --version Output the version number -V, --version Output the version number
-y, --yes Use default configuration -y, --yes Use default configuration
--no-database Skip database setup --database <type> Database type (none, sqlite, postgres)
--sqlite Use SQLite database --orm <type> ORM type (none, drizzle, prisma)
--postgres Use PostgreSQL database --auth Include authentication
--auth Include authentication --no-auth Exclude authentication
--no-auth Exclude authentication --frontend <types> Frontend types (web,native or both)
--pwa Include Progressive Web App support --addons <types> Additional addons (pwa,tauri,biome,husky)
--tauri Include Tauri desktop app support --no-addons Skip all additional addons
--biome Include Biome for linting and formatting --examples <types> Examples to include (todo,ai)
--husky Include Husky, lint-staged for Git hooks --no-examples Skip all examples
--no-addons Skip all additional addons --git Initialize git repository
--examples <examples> Include specified examples --no-git Skip git initialization
--no-examples Skip all examples --package-manager <pm> Package manager (npm, pnpm, bun)
--git Include git setup (default) --install Install dependencies
--no-git Skip git initialization --no-install Skip installing dependencies
--npm Use npm as package manager --turso Set up Turso for SQLite database
--pnpm Use pnpm as package manager --no-turso Skip Turso setup
--bun Use bun as package manager --backend <framework> Backend framework (hono, elysia)
--drizzle Use Drizzle ORM --runtime <runtime> Runtime (bun, node)
--prisma Use Prisma ORM -h, --help Display help
--install Install dependencies (default)
--no-install Skip installing dependencies
--turso Set up Turso for SQLite database
--no-turso Skip Turso setup for SQLite database
--hono Use Hono backend framework (default)
--elysia Use Elysia backend framework
--runtime <runtime> Specify runtime (bun or node)
--web Include web frontend (default)
--native Include Expo frontend
--no-web Exclude web frontend
--no-native Exclude Expo frontend
-h, --help Display help
``` ```
## Examples ## Examples
@@ -87,17 +75,20 @@ npx create-better-t-stack my-app -y
Create a project with specific options: Create a project with specific options:
```bash ```bash
npx create-better-t-stack my-app --postgres --drizzle --auth --pwa --biome npx create-better-t-stack my-app --database postgres --orm drizzle --auth --addons pwa,biome
``` ```
Create a project with Elysia and Node.js runtime: Create a project with Elysia and Node.js runtime:
```bash ```bash
npx create-better-t-stack my-app --elysia --runtime node npx create-better-t-stack my-app --backend elysia --runtime node
``` ```
Create a project using Hono with no addons: Create a project with specific frontend options:
```bash ```bash
npx create-better-t-stack my-app --hono --no-addons npx create-better-t-stack my-app --frontend web,native
``` ```
Created by [Aman Varshney](https://github.com/AmanVarshney01) & [Nitish Singh](https://github.com/FgrReloaded) Create a project with examples:
```bash
npx create-better-t-stack my-app --examples todo,ai
```

View File

@@ -1,4 +1,4 @@
import { log } from "@clack/prompts"; import { note } from "@clack/prompts";
import pc from "picocolors"; import pc from "picocolors";
import type { import type {
ProjectAddons, ProjectAddons,
@@ -42,8 +42,8 @@ export function displayPostInstallInstructions(
const hasNativeFrontend = frontends?.includes("native"); const hasNativeFrontend = frontends?.includes("native");
const hasFrontend = hasWebFrontend || hasNativeFrontend; const hasFrontend = hasWebFrontend || hasNativeFrontend;
log.info(`${pc.bold("Next steps:")} note(
${pc.cyan("1.")} ${cdCmd} `${pc.cyan("1.")} ${cdCmd}
${!depsInstalled ? `${pc.cyan("2.")} ${packageManager} install\n` : ""}${pc.cyan(depsInstalled ? "2." : "3.")} ${runCmd} dev ${!depsInstalled ? `${pc.cyan("2.")} ${packageManager} install\n` : ""}${pc.cyan(depsInstalled ? "2." : "3.")} ${runCmd} dev
${pc.bold("Your project will be available at:")} ${pc.bold("Your project will be available at:")}
@@ -52,15 +52,17 @@ ${
? `${hasWebFrontend ? `${pc.cyan("•")} Frontend: http://localhost:3001\n` : ""}` ? `${hasWebFrontend ? `${pc.cyan("•")} Frontend: http://localhost:3001\n` : ""}`
: `${pc.yellow("NOTE:")} You are creating a backend-only app (no frontend selected)\n` : `${pc.yellow("NOTE:")} You are creating a backend-only app (no frontend selected)\n`
}${pc.cyan("•")} API: http://localhost:3000 }${pc.cyan("•")} API: http://localhost:3000
${nativeInstructions ? `\n${nativeInstructions.trim()}` : ""}${databaseInstructions ? `\n${databaseInstructions.trim()}` : ""}${tauriInstructions ? `\n${tauriInstructions.trim()}` : ""}${lintingInstructions ? `\n${lintingInstructions.trim()}` : ""}`); ${nativeInstructions ? `\n${nativeInstructions.trim()}` : ""}${databaseInstructions ? `\n${databaseInstructions.trim()}` : ""}${tauriInstructions ? `\n${tauriInstructions.trim()}` : ""}${lintingInstructions ? `\n${lintingInstructions.trim()}` : ""}`,
"Next steps",
);
} }
function getNativeInstructions(): string { function getNativeInstructions(): string {
return `${pc.yellow("NOTE:")} If the Expo app cannot connect to the server, update the EXPO_PUBLIC_SERVER_URL in apps/native/.env to use your local IP address instead of localhost:\n${pc.dim("EXPO_PUBLIC_SERVER_URL=http://192.168.0.103:3000")}\n`; return `${pc.yellow("NOTE:")} If the Expo app cannot connect to the server, update the EXPO_PUBLIC_SERVER_URL in apps/native/.env to use your local IP address instead of localhost:\n${"EXPO_PUBLIC_SERVER_URL=http://192.168.0.103:3000"}\n`;
} }
function getLintingInstructions(runCmd?: string): string { function getLintingInstructions(runCmd?: string): string {
return `${pc.bold("Linting and formatting:")}\n${pc.cyan("•")} Format and lint fix: ${pc.dim(`${runCmd} check`)}\n\n`; return `${pc.bold("\nLinting and formatting:")}\n${pc.cyan("•")} Format and lint fix: ${`${runCmd} check`}\n\n`;
} }
function getDatabaseInstructions( function getDatabaseInstructions(
@@ -75,7 +77,7 @@ function getDatabaseInstructions(
if (database === "sqlite") { if (database === "sqlite") {
instructions.push( instructions.push(
`${pc.yellow("NOTE:")} Turso support with Prisma is in Early Access and requires additional setup.`, `${pc.yellow("NOTE:")} Turso support with Prisma is in Early Access and requires additional setup.`,
`${pc.dim("Learn more at: https://www.prisma.io/docs/orm/overview/databases/turso")}`, `${"Learn more at: https://www.prisma.io/docs/orm/overview/databases/turso"}`,
); );
} }
@@ -85,24 +87,16 @@ function getDatabaseInstructions(
); );
} }
instructions.push( instructions.push(`${pc.cyan("•")} Apply schema: ${`${runCmd} db:push`}`);
`${pc.cyan("•")} Apply schema: ${pc.dim(`${runCmd} db:push`)}`, instructions.push(`${pc.cyan("•")} Database UI: ${`${runCmd} db:studio`}`);
);
instructions.push(
`${pc.cyan("•")} Database UI: ${pc.dim(`${runCmd} db:studio`)}`,
);
} else if (orm === "drizzle") { } else if (orm === "drizzle") {
if (database === "sqlite") { if (database === "sqlite") {
instructions.push( instructions.push(
`${pc.cyan("•")} Start local DB: ${pc.dim(`cd apps/server && ${runCmd} db:local`)}`, `${pc.cyan("•")} Start local DB: ${`cd apps/server && ${runCmd} db:local`}`,
); );
} }
instructions.push( instructions.push(`${pc.cyan("•")} Apply schema: ${`${runCmd} db:push`}`);
`${pc.cyan("•")} Apply schema: ${pc.dim(`${runCmd} db:push`)}`, instructions.push(`${pc.cyan("•")} Database UI: ${`${runCmd} db:studio`}`);
);
instructions.push(
`${pc.cyan("•")} Database UI: ${pc.dim(`${runCmd} db:studio`)}`,
);
} }
return instructions.length return instructions.length
@@ -111,5 +105,5 @@ function getDatabaseInstructions(
} }
function getTauriInstructions(runCmd?: string): string { function getTauriInstructions(runCmd?: string): string {
return `${pc.bold("Desktop app with Tauri:")}\n${pc.cyan("•")} Start desktop app: ${pc.dim(`cd apps/web && ${runCmd} desktop:dev`)}\n${pc.cyan("•")} Build desktop app: ${pc.dim(`cd apps/web && ${runCmd} desktop:build`)}\n${pc.yellow("NOTE:")} Tauri requires Rust and platform-specific dependencies. See: ${pc.dim("https://v2.tauri.app/start/prerequisites/")}\n\n`; return `${pc.bold("Desktop app with Tauri:")}\n${pc.cyan("•")} Start desktop app: ${`cd apps/web && ${runCmd} desktop:dev`}\n${pc.cyan("•")} Build desktop app: ${`cd apps/web && ${runCmd} desktop:build`}\n${pc.yellow("NOTE:")} Tauri requires Rust and platform-specific dependencies. See: ${"https://v2.tauri.app/start/prerequisites/"}\n\n`;
} }