-
-
Notifications
You must be signed in to change notification settings - Fork 234
feat: Add lefthook; refactor out Git hooks to their own section #711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
e69fcb2
83d0d66
9d281d5
971ca15
23b3850
40d61ee
9cf5777
a6631ba
0710e58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -41,7 +41,7 @@ Follow the prompts to configure your project or use the `--yes` flag for default | |||||
| | **Database Setup** | • Turso (SQLite)<br>• Cloudflare D1 (SQLite)<br>• Neon (PostgreSQL)<br>• Supabase (PostgreSQL)<br>• Prisma Postgres<br>• MongoDB Atlas<br>• None (manual setup) | | ||||||
| | **Authentication** | Better-Auth (email/password, with more options coming soon) | | ||||||
| | **Styling** | Tailwind CSS with shadcn/ui components | | ||||||
| | **Addons** | • PWA support<br>• Tauri (desktop applications)<br>• Starlight (documentation site)<br>• Biome (linting and formatting)<br>• Husky (Git hooks)<br>• Turborepo (optimized builds) | | ||||||
| | **Addons** | • PWA support<br>• Tauri (desktop applications)<br>• Starlight (documentation site)<br>• Biome (linting and formatting)<br>• Lefthook, Husky (Git hooks)<br>• Turborepo (optimized builds) | | ||||||
| | **Examples** | • Todo app<br>• AI Chat interface (using Vercel AI SDK) | | ||||||
| | **Developer Experience** | • Automatic Git initialization<br>• Package manager choice (npm, pnpm, bun)<br>• Automatic dependency installation | | ||||||
|
|
||||||
|
|
@@ -58,7 +58,7 @@ Options: | |||||
| --auth Include authentication | ||||||
| --no-auth Exclude authentication | ||||||
| --frontend <types...> Frontend types (tanstack-router, react-router, tanstack-start, next, nuxt, svelte, solid, native-bare, native-uniwind, native-unistyles, none) | ||||||
| --addons <types...> Additional addons (pwa, tauri, starlight, biome, husky, turborepo, fumadocs, ultracite, oxlint, none) | ||||||
| --addons <types...> Additional addons (pwa, tauri, starlight, biome, lefthook,husky, turborepo, fumadocs, ultracite, oxlint, none) | ||||||
| --examples <types...> Examples to include (todo, ai, none) | ||||||
|
||||||
| --git Initialize git repository | ||||||
| --no-git Skip git initialization | ||||||
|
|
@@ -192,7 +192,7 @@ npx create-better-t-stack my-app --frontend none --backend hono --api trpc --dat | |||||
| - **ORM 'none'**: Can be used when you want to handle database operations manually or use a different ORM. | ||||||
| - **Runtime 'none'**: Only available with Convex backend or when backend is 'none'. | ||||||
| - **Cloudflare Workers runtime**: Only compatible with Hono backend, Drizzle ORM (or no ORM), and SQLite database (with D1 setup). Not compatible with MongoDB. | ||||||
| - **Addons 'none'**: Skips all addons (PWA, Tauri, Starlight, Biome, Husky, Turborepo). | ||||||
| - **Addons 'none'**: Skips all addons (PWA, Tauri, Starlight, Biome, Lefthook,Husky, Turborepo). | ||||||
|
||||||
| - **Addons 'none'**: Skips all addons (PWA, Tauri, Starlight, Biome, Lefthook,Husky, Turborepo). | |
| - **Addons 'none'**: Skips all addons (PWA, Tauri, Starlight, Biome, Lefthook, Husky, Turborepo). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,23 +58,27 @@ ${pc.cyan("Docs:")} ${pc.underline("https://turborepo.com/docs")} | |
| } | ||
| const hasUltracite = addons.includes("ultracite"); | ||
| const hasBiome = addons.includes("biome"); | ||
| const hasHusky = addons.includes("husky"); | ||
| const gitHook = addons.includes("husky") | ||
| ? "husky" | ||
| : addons.includes("lefthook") | ||
| ? "lefthook" | ||
| : ""; | ||
|
Comment on lines
+61
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enforce “only one git hooks manager”: current logic silently prefers Husky. - const gitHook = addons.includes("husky")
- ? "husky"
- : addons.includes("lefthook")
- ? "lefthook"
- : "";
+ const hasHusky = addons.includes("husky");
+ const hasLefthook = addons.includes("lefthook");
+ if (hasHusky && hasLefthook) {
+ throw new Error("Only one git hooks manager can be selected: husky or lefthook.");
+ }
+ const gitHook = hasHusky ? "husky" : hasLefthook ? "lefthook" : null;(You’ll need to adjust the later Also applies to: 69-82 🤖 Prompt for AI Agents
therealsamyak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const hasOxlint = addons.includes("oxlint"); | ||
|
|
||
| if (hasUltracite) { | ||
| await setupUltracite(config, hasHusky); | ||
| await setupUltracite(config, gitHook); | ||
| } else { | ||
| if (hasBiome) { | ||
| await setupBiome(projectDir); | ||
| } | ||
| if (hasHusky) { | ||
| if (gitHook) { | ||
| let linter: "biome" | "oxlint" | undefined; | ||
| if (hasOxlint) { | ||
| linter = "oxlint"; | ||
| } else if (hasBiome) { | ||
| linter = "biome"; | ||
| } | ||
| await setupHusky(projectDir, linter); | ||
| await setupGitHooks(gitHook, projectDir, linter); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -123,9 +127,13 @@ export async function setupBiome(projectDir: string) { | |
| } | ||
| } | ||
|
|
||
| export async function setupHusky(projectDir: string, linter?: "biome" | "oxlint") { | ||
| export async function setupGitHooks( | ||
| gitHook: string, | ||
| projectDir: string, | ||
| linter?: "biome" | "oxlint", | ||
| ) { | ||
| await addPackageDependency({ | ||
| devDependencies: ["husky", "lint-staged"], | ||
| devDependencies: [`${gitHook === "husky" ? "husky" : "lefthook"}`, "lint-staged"], | ||
therealsamyak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| projectDir, | ||
| }); | ||
|
|
||
|
|
@@ -135,7 +143,7 @@ export async function setupHusky(projectDir: string, linter?: "biome" | "oxlint" | |
|
|
||
| packageJson.scripts = { | ||
| ...packageJson.scripts, | ||
| prepare: "husky", | ||
| prepare: gitHook === "husky" ? "husky" : "lefthook install", | ||
| }; | ||
|
|
||
| if (linter === "oxlint") { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix CLI docs formatting:
lefthook,huskyshould belefthook, husky.Line 61 and Line 195 have missing spacing after the comma, which is easy to copy/paste wrong and looks inconsistent.
Also applies to: 195-195
🤖 Prompt for AI Agents