mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
Add Biome and Husky for code formatting and Git hooks
This commit is contained in:
5
.changeset/fluffy-dodos-act.md
Normal file
5
.changeset/fluffy-dodos-act.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"create-better-t-stack": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Add Biome and Husky for code formatting and Git hooks
|
||||||
14
.github/workflows/main.yaml
vendored
Normal file
14
.github/workflows/main.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
- run: bun install --frozen-lockfile
|
||||||
|
- run: bun run check
|
||||||
@@ -1,32 +1,28 @@
|
|||||||
name: Release
|
name: Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'packages/cli/**'
|
- 'apps/cli/**'
|
||||||
- '.changeset/**'
|
- '.changeset/**'
|
||||||
- 'package.json'
|
- 'package.json'
|
||||||
- 'bun.lock'
|
- 'bun.lock'
|
||||||
|
|
||||||
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
publish:
|
||||||
name: Release
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
|
||||||
- name: Setup Bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
|
- run: bun install --frozen-lockfile
|
||||||
- name: Install Dependencies
|
- name: Create Release Pull Request
|
||||||
run: bun install
|
id: changesets
|
||||||
|
|
||||||
- name: Create Release Pull Request or Publish
|
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@v1
|
||||||
with:
|
with:
|
||||||
publish: bun run publish-packages
|
publish: bun run publish-packages
|
||||||
@@ -33,6 +33,11 @@ export const dependencyVersionMap = {
|
|||||||
"@vite-pwa/assets-generator": "^0.2.6",
|
"@vite-pwa/assets-generator": "^0.2.6",
|
||||||
|
|
||||||
"@tauri-apps/cli": "^2.4.0",
|
"@tauri-apps/cli": "^2.4.0",
|
||||||
|
|
||||||
|
"@biomejs/biome": "1.9.4",
|
||||||
|
|
||||||
|
husky: "^9.1.7",
|
||||||
|
"lint-staged": "^15.5.0",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type AvailableDependencies = keyof typeof dependencyVersionMap;
|
export type AvailableDependencies = keyof typeof dependencyVersionMap;
|
||||||
|
|||||||
@@ -19,6 +19,66 @@ export async function setupAddons(
|
|||||||
if (addons.includes("tauri")) {
|
if (addons.includes("tauri")) {
|
||||||
await setupTauri(projectDir, packageManager);
|
await setupTauri(projectDir, packageManager);
|
||||||
}
|
}
|
||||||
|
if (addons.includes("biome")) {
|
||||||
|
await setupBiome(projectDir);
|
||||||
|
}
|
||||||
|
if (addons.includes("husky")) {
|
||||||
|
await setupHusky(projectDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setupBiome(projectDir: string) {
|
||||||
|
const biomeTemplateDir = path.join(PKG_ROOT, "template/with-biome");
|
||||||
|
if (await fs.pathExists(biomeTemplateDir)) {
|
||||||
|
await fs.copy(biomeTemplateDir, projectDir, { overwrite: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
addPackageDependency({
|
||||||
|
devDependencies: ["@biomejs/biome"],
|
||||||
|
projectDir,
|
||||||
|
});
|
||||||
|
|
||||||
|
const packageJsonPath = path.join(projectDir, "package.json");
|
||||||
|
if (await fs.pathExists(packageJsonPath)) {
|
||||||
|
const packageJson = await fs.readJson(packageJsonPath);
|
||||||
|
|
||||||
|
packageJson.scripts = {
|
||||||
|
...packageJson.scripts,
|
||||||
|
check: "biome check --write .",
|
||||||
|
};
|
||||||
|
|
||||||
|
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setupHusky(projectDir: string) {
|
||||||
|
const huskyTemplateDir = path.join(PKG_ROOT, "template/with-husky");
|
||||||
|
if (await fs.pathExists(huskyTemplateDir)) {
|
||||||
|
await fs.copy(huskyTemplateDir, projectDir, { overwrite: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
addPackageDependency({
|
||||||
|
devDependencies: ["husky", "lint-staged"],
|
||||||
|
projectDir,
|
||||||
|
});
|
||||||
|
|
||||||
|
const packageJsonPath = path.join(projectDir, "package.json");
|
||||||
|
if (await fs.pathExists(packageJsonPath)) {
|
||||||
|
const packageJson = await fs.readJson(packageJsonPath);
|
||||||
|
|
||||||
|
packageJson.scripts = {
|
||||||
|
...packageJson.scripts,
|
||||||
|
prepare: "husky",
|
||||||
|
};
|
||||||
|
|
||||||
|
packageJson["lint-staged"] = {
|
||||||
|
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
|
||||||
|
"biome check --no-errors-on-unmatched --files-ignore-unknown=true",
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setupDocker(projectDir: string) {
|
async function setupDocker(projectDir: string) {
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
import { log, spinner } from "@clack/prompts";
|
import { log, spinner } from "@clack/prompts";
|
||||||
import { $ } from "execa";
|
import { $ } from "execa";
|
||||||
import pc from "picocolors";
|
import pc from "picocolors";
|
||||||
|
import type { ProjectAddons } from "../types";
|
||||||
import type { PackageManager } from "../utils/get-package-manager";
|
import type { PackageManager } from "../utils/get-package-manager";
|
||||||
|
|
||||||
interface InstallDependenciesOptions {
|
|
||||||
projectDir: string;
|
|
||||||
packageManager: PackageManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function installDependencies({
|
export async function installDependencies({
|
||||||
projectDir,
|
projectDir,
|
||||||
packageManager,
|
packageManager,
|
||||||
}: InstallDependenciesOptions) {
|
addons = [],
|
||||||
|
}: {
|
||||||
|
projectDir: string;
|
||||||
|
packageManager: PackageManager;
|
||||||
|
addons?: ProjectAddons[];
|
||||||
|
}) {
|
||||||
const s = spinner();
|
const s = spinner();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -34,6 +35,11 @@ export async function installDependencies({
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.stop("Dependencies installed successfully");
|
s.stop("Dependencies installed successfully");
|
||||||
|
|
||||||
|
// Run Biome check if Biome or Husky is enabled
|
||||||
|
if (addons.includes("biome") || addons.includes("husky")) {
|
||||||
|
await runBiomeCheck(projectDir, packageManager);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
s.stop(pc.red("Failed to install dependencies"));
|
s.stop(pc.red("Failed to install dependencies"));
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
@@ -42,3 +48,21 @@ export async function installDependencies({
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function runBiomeCheck(
|
||||||
|
projectDir: string,
|
||||||
|
packageManager: PackageManager,
|
||||||
|
) {
|
||||||
|
const s = spinner();
|
||||||
|
|
||||||
|
try {
|
||||||
|
s.start("Running Biome format check...");
|
||||||
|
|
||||||
|
await $({ cwd: projectDir })`${packageManager} biome check --write .`;
|
||||||
|
|
||||||
|
s.stop("Biome check completed successfully");
|
||||||
|
} catch (error) {
|
||||||
|
s.stop(pc.yellow("Biome check encountered issues"));
|
||||||
|
log.warn(pc.yellow("Some files may need manual formatting"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,17 @@ export function displayPostInstallInstructions(
|
|||||||
) {
|
) {
|
||||||
const runCmd = packageManager === "npm" ? "npm run" : packageManager;
|
const runCmd = packageManager === "npm" ? "npm run" : packageManager;
|
||||||
const cdCmd = `cd ${projectName}`;
|
const cdCmd = `cd ${projectName}`;
|
||||||
|
const hasHuskyOrBiome =
|
||||||
|
addons?.includes("husky") || addons?.includes("biome");
|
||||||
|
|
||||||
|
const databaseInstructions =
|
||||||
|
database !== "none" ? getDatabaseInstructions(database, orm, runCmd) : "";
|
||||||
|
const tauriInstructions = addons?.includes("tauri")
|
||||||
|
? getTauriInstructions(runCmd)
|
||||||
|
: "";
|
||||||
|
const lintingInstructions = hasHuskyOrBiome
|
||||||
|
? getLintingInstructions(runCmd)
|
||||||
|
: "";
|
||||||
|
|
||||||
log.info(`${pc.cyan("Project created successfully!")}
|
log.info(`${pc.cyan("Project created successfully!")}
|
||||||
|
|
||||||
@@ -27,9 +38,11 @@ ${!depsInstalled ? `${pc.cyan("2.")} ${packageManager} install\n` : ""}${pc.cyan
|
|||||||
${pc.bold("Your project will be available at:")}
|
${pc.bold("Your project will be available at:")}
|
||||||
${pc.cyan("•")} Frontend: http://localhost:3001
|
${pc.cyan("•")} Frontend: http://localhost:3001
|
||||||
${pc.cyan("•")} API: http://localhost:3000
|
${pc.cyan("•")} API: http://localhost:3000
|
||||||
|
${databaseInstructions ? `\n${databaseInstructions.trim()}` : ""}${tauriInstructions ? `\n${tauriInstructions.trim()}` : ""}${lintingInstructions ? `\n${lintingInstructions.trim()}` : ""}`);
|
||||||
|
}
|
||||||
|
|
||||||
${database !== "none" ? getDatabaseInstructions(database, orm, runCmd) : ""}
|
function getLintingInstructions(runCmd?: string): string {
|
||||||
${addons?.includes("tauri") ? getTauriInstructions(runCmd) : ""}`);
|
return `${pc.bold("Linting and formatting:")}\n${pc.cyan("•")} Format and lint fix: ${pc.dim(`${runCmd} check`)}\n\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatabaseInstructions(
|
function getDatabaseInstructions(
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ async function main() {
|
|||||||
.option("--docker", "Include Docker setup")
|
.option("--docker", "Include Docker setup")
|
||||||
.option("--pwa", "Include Progressive Web App support")
|
.option("--pwa", "Include Progressive Web App support")
|
||||||
.option("--tauri", "Include Tauri desktop app support")
|
.option("--tauri", "Include Tauri desktop app support")
|
||||||
|
.option("--biome", "Include Biome for linting and formatting")
|
||||||
|
.option("--husky", "Include Husky, lint-staged for Git hooks")
|
||||||
.option("--no-addons", "Skip all additional addons")
|
.option("--no-addons", "Skip all additional addons")
|
||||||
.option("--git", "Include git setup")
|
.option("--git", "Include git setup")
|
||||||
.option("--no-git", "Skip git initialization")
|
.option("--no-git", "Skip git initialization")
|
||||||
@@ -75,6 +77,8 @@ async function main() {
|
|||||||
...((options.docker ||
|
...((options.docker ||
|
||||||
options.pwa ||
|
options.pwa ||
|
||||||
options.tauri ||
|
options.tauri ||
|
||||||
|
options.biome ||
|
||||||
|
options.husky ||
|
||||||
options.addons === false) && {
|
options.addons === false) && {
|
||||||
addons:
|
addons:
|
||||||
options.addons === false
|
options.addons === false
|
||||||
@@ -83,6 +87,8 @@ async function main() {
|
|||||||
...(options.docker ? ["docker"] : []),
|
...(options.docker ? ["docker"] : []),
|
||||||
...(options.pwa ? ["pwa"] : []),
|
...(options.pwa ? ["pwa"] : []),
|
||||||
...(options.tauri ? ["tauri"] : []),
|
...(options.tauri ? ["tauri"] : []),
|
||||||
|
...(options.biome ? ["biome"] : []),
|
||||||
|
...(options.husky ? ["husky"] : []),
|
||||||
] as ProjectAddons[]),
|
] as ProjectAddons[]),
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@@ -141,6 +147,7 @@ async function main() {
|
|||||||
await installDependencies({
|
await installDependencies({
|
||||||
projectDir,
|
projectDir,
|
||||||
packageManager: config.packageManager,
|
packageManager: config.packageManager,
|
||||||
|
addons: config.addons,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ export async function getAddonsChoice(
|
|||||||
label: "Tauri Desktop App",
|
label: "Tauri Desktop App",
|
||||||
hint: "Build native desktop apps from your web frontend",
|
hint: "Build native desktop apps from your web frontend",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: "biome",
|
||||||
|
label: "Biome",
|
||||||
|
hint: "Add Biome for linting and formatting",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "husky",
|
||||||
|
label: "Husky",
|
||||||
|
hint: "Add Git hooks with Husky, lint-staged (requires Biome)",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
required: false,
|
required: false,
|
||||||
});
|
});
|
||||||
@@ -34,5 +44,9 @@ export async function getAddonsChoice(
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.includes("husky") && !response.includes("biome")) {
|
||||||
|
response.push("biome");
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export type ProjectDatabase = "sqlite" | "postgres" | "none";
|
export type ProjectDatabase = "sqlite" | "postgres" | "none";
|
||||||
export type ProjectOrm = "drizzle" | "prisma" | "none";
|
export type ProjectOrm = "drizzle" | "prisma" | "none";
|
||||||
export type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
export type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
||||||
export type ProjectAddons = "docker" | "pwa" | "tauri";
|
export type ProjectAddons = "docker" | "pwa" | "tauri" | "biome" | "husky";
|
||||||
|
|
||||||
export interface ProjectConfig {
|
export interface ProjectConfig {
|
||||||
projectName: string;
|
projectName: string;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "better-t-stack",
|
"name": "better-t-stack",
|
||||||
"private": true,
|
"private": true,
|
||||||
"workspaces": [
|
"workspaces": ["packages/*"],
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "turbo dev",
|
"dev": "turbo dev",
|
||||||
"build": "turbo build",
|
"build": "turbo build",
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["prettier-plugin-tailwindcss"],
|
|
||||||
"tailwindStylesheet": "./src/index.css"
|
|
||||||
}
|
|
||||||
@@ -17,8 +17,6 @@
|
|||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@vitejs/plugin-react": "^4.3.4",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
"postcss": "^8.5.3",
|
"postcss": "^8.5.3",
|
||||||
"prettier": "^3.5.3",
|
|
||||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
||||||
"tailwindcss": "^4.0.15",
|
"tailwindcss": "^4.0.15",
|
||||||
"vite": "^6.2.2"
|
"vite": "^6.2.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ declare module "@tanstack/react-router" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootElement = document.getElementById("app")!;
|
const rootElement = document.getElementById("app");
|
||||||
|
if (!rootElement) throw new Error("Root element not found");
|
||||||
|
|
||||||
if (!rootElement.innerHTML) {
|
if (!rootElement.innerHTML) {
|
||||||
const root = ReactDOM.createRoot(rootElement);
|
const root = ReactDOM.createRoot(rootElement);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function HomeComponent() {
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div
|
<div
|
||||||
className={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
className={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
||||||
></div>
|
/>
|
||||||
<span className="text-sm text-muted-foreground">
|
<span className="text-sm text-muted-foreground">
|
||||||
{healthCheck.isLoading
|
{healthCheck.isLoading
|
||||||
? "Checking..."
|
? "Checking..."
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import tailwindcss from "@tailwindcss/vite";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import path from "path";
|
import path from "node:path";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ app.use(logger());
|
|||||||
app.use(
|
app.use(
|
||||||
"/*",
|
"/*",
|
||||||
cors({
|
cors({
|
||||||
origin: process.env.CORS_ORIGIN!,
|
origin: process.env.CORS_ORIGIN || "",
|
||||||
allowMethods: ["GET", "POST", "OPTIONS"],
|
allowMethods: ["GET", "POST", "OPTIONS"],
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"lint": {
|
"lint": {
|
||||||
"dependsOn": ["^lint"]
|
"dependsOn": ["^lint"]
|
||||||
},
|
},
|
||||||
"check-types": {
|
"check": {
|
||||||
"dependsOn": ["^check-types"]
|
"dependsOn": ["^check-types"]
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
|
|||||||
@@ -67,9 +67,8 @@ export default function SignInForm({
|
|||||||
className="space-y-4"
|
className="space-y-4"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<form.Field
|
<form.Field name="email">
|
||||||
name="email"
|
{(field) => (
|
||||||
children={(field) => (
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor={field.name}>Email</Label>
|
<Label htmlFor={field.name}>Email</Label>
|
||||||
<Input
|
<Input
|
||||||
@@ -87,13 +86,12 @@ export default function SignInForm({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
/>
|
</form.Field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<form.Field
|
<form.Field name="password">
|
||||||
name="password"
|
{(field) => (
|
||||||
children={(field) => (
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor={field.name}>Password</Label>
|
<Label htmlFor={field.name}>Password</Label>
|
||||||
<Input
|
<Input
|
||||||
@@ -111,7 +109,7 @@ export default function SignInForm({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
/>
|
</form.Field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form.Subscribe>
|
<form.Subscribe>
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ declare module "@tanstack/react-router" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootElement = document.getElementById("app")!;
|
const rootElement = document.getElementById("app");
|
||||||
|
if (!rootElement) throw new Error("Root element not found");
|
||||||
|
|
||||||
if (!rootElement.innerHTML) {
|
if (!rootElement.innerHTML) {
|
||||||
const root = ReactDOM.createRoot(rootElement);
|
const root = ReactDOM.createRoot(rootElement);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { trpc } from "@/utils/trpc";
|
|
||||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
|
||||||
import { ArrowRight } from "lucide-react";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { trpc } from "@/utils/trpc";
|
||||||
|
import { Link, createFileRoute } from "@tanstack/react-router";
|
||||||
|
import { ArrowRight } from "lucide-react";
|
||||||
|
|
||||||
export const Route = createFileRoute("/")({
|
export const Route = createFileRoute("/")({
|
||||||
component: HomeComponent,
|
component: HomeComponent,
|
||||||
@@ -35,7 +35,7 @@ function HomeComponent() {
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div
|
<div
|
||||||
className={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
className={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
||||||
></div>
|
/>
|
||||||
<span className="text-sm text-muted-foreground">
|
<span className="text-sm text-muted-foreground">
|
||||||
{healthCheck.isLoading
|
{healthCheck.isLoading
|
||||||
? "Checking..."
|
? "Checking..."
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ app.use(logger());
|
|||||||
app.use(
|
app.use(
|
||||||
"/*",
|
"/*",
|
||||||
cors({
|
cors({
|
||||||
origin: process.env.CORS_ORIGIN!,
|
origin: process.env.CORS_ORIGIN || "",
|
||||||
allowMethods: ["GET", "POST", "OPTIONS"],
|
allowMethods: ["GET", "POST", "OPTIONS"],
|
||||||
allowHeaders: ["Content-Type", "Authorization"],
|
allowHeaders: ["Content-Type", "Authorization"],
|
||||||
credentials: true,
|
credentials: true,
|
||||||
|
|||||||
42
apps/cli/template/with-biome/biome.json
Normal file
42
apps/cli/template/with-biome/biome.json
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||||
|
"vcs": {
|
||||||
|
"enabled": false,
|
||||||
|
"clientKind": "git",
|
||||||
|
"useIgnoreFile": false
|
||||||
|
},
|
||||||
|
"files": {
|
||||||
|
"ignoreUnknown": false,
|
||||||
|
"ignore": [
|
||||||
|
".next",
|
||||||
|
"dist",
|
||||||
|
".turbo",
|
||||||
|
"dev-dist",
|
||||||
|
".zed",
|
||||||
|
".vscode",
|
||||||
|
"routeTree.gen.ts",
|
||||||
|
"src-tauri"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"formatter": {
|
||||||
|
"enabled": true,
|
||||||
|
"indentStyle": "tab"
|
||||||
|
},
|
||||||
|
"organizeImports": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"linter": {
|
||||||
|
"enabled": true,
|
||||||
|
"rules": {
|
||||||
|
"recommended": true,
|
||||||
|
"correctness": {
|
||||||
|
"useExhaustiveDependencies": "info"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"javascript": {
|
||||||
|
"formatter": {
|
||||||
|
"quoteStyle": "double"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,6 @@ export default defineConfig({
|
|||||||
out: "./migrations",
|
out: "./migrations",
|
||||||
dialect: "postgresql",
|
dialect: "postgresql",
|
||||||
dbCredentials: {
|
dbCredentials: {
|
||||||
url: process.env.POSTGRES_URL!,
|
url: process.env.POSTGRES_URL || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export const auth = betterAuth({
|
|||||||
provider: "pg",
|
provider: "pg",
|
||||||
schema: schema,
|
schema: schema,
|
||||||
}),
|
}),
|
||||||
trustedOrigins: [process.env.CORS_ORIGIN!],
|
trustedOrigins: [process.env.CORS_ORIGIN || ""],
|
||||||
emailAndPassword: {
|
emailAndPassword: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export default defineConfig({
|
|||||||
out: "./migrations",
|
out: "./migrations",
|
||||||
dialect: "turso",
|
dialect: "turso",
|
||||||
dbCredentials: {
|
dbCredentials: {
|
||||||
url: process.env.TURSO_CONNECTION_URL!,
|
url: process.env.TURSO_CONNECTION_URL || "",
|
||||||
authToken: process.env.TURSO_AUTH_TOKEN,
|
authToken: process.env.TURSO_AUTH_TOKEN,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { drizzle } from "drizzle-orm/libsql";
|
|||||||
|
|
||||||
export const db = drizzle({
|
export const db = drizzle({
|
||||||
connection: {
|
connection: {
|
||||||
url: process.env.TURSO_CONNECTION_URL!,
|
url: process.env.TURSO_CONNECTION_URL || "",
|
||||||
authToken: process.env.TURSO_AUTH_TOKEN,
|
authToken: process.env.TURSO_AUTH_TOKEN,
|
||||||
},
|
},
|
||||||
// logger: true,
|
// logger: true,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export const auth = betterAuth({
|
|||||||
provider: "sqlite",
|
provider: "sqlite",
|
||||||
schema: schema,
|
schema: schema,
|
||||||
}),
|
}),
|
||||||
trustedOrigins: [process.env.CORS_ORIGIN!],
|
trustedOrigins: [process.env.CORS_ORIGIN || ""],
|
||||||
emailAndPassword: {
|
emailAndPassword: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
|||||||
1
apps/cli/template/with-husky/.husky/pre-commit
Normal file
1
apps/cli/template/with-husky/.husky/pre-commit
Normal file
@@ -0,0 +1 @@
|
|||||||
|
lint-staged
|
||||||
@@ -6,7 +6,7 @@ export const auth = betterAuth({
|
|||||||
database: prismaAdapter(prisma, {
|
database: prismaAdapter(prisma, {
|
||||||
provider: "pg",
|
provider: "pg",
|
||||||
}),
|
}),
|
||||||
trustedOrigins: [process.env.CORS_ORIGIN!],
|
trustedOrigins: [process.env.CORS_ORIGIN || ""],
|
||||||
emailAndPassword: { enabled: true },
|
emailAndPassword: { enabled: true },
|
||||||
advanced: {
|
advanced: {
|
||||||
defaultCookieAttributes: {
|
defaultCookieAttributes: {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const auth = betterAuth({
|
|||||||
database: prismaAdapter(prisma, {
|
database: prismaAdapter(prisma, {
|
||||||
provider: "sqlite",
|
provider: "sqlite",
|
||||||
}),
|
}),
|
||||||
trustedOrigins: [process.env.CORS_ORIGIN!],
|
trustedOrigins: [process.env.CORS_ORIGIN || ""],
|
||||||
emailAndPassword: { enabled: true },
|
emailAndPassword: { enabled: true },
|
||||||
advanced: {
|
advanced: {
|
||||||
defaultCookieAttributes: {
|
defaultCookieAttributes: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import tailwindcss from "@tailwindcss/vite";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import path from "path";
|
import path from "node:path";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import { VitePWA } from "vite-plugin-pwa";
|
import { VitePWA } from "vite-plugin-pwa";
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignoreUnknown": false,
|
"ignoreUnknown": false,
|
||||||
"ignore": [".next", "dist", ".source", "out", "template"]
|
"ignore": [".next", "dist", ".source", "out", "template", ".turbo"]
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|||||||
2
bun.lock
2
bun.lock
@@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"apps/cli": {
|
"apps/cli": {
|
||||||
"name": "create-better-t-stack",
|
"name": "create-better-t-stack",
|
||||||
"version": "0.11.1",
|
"version": "0.16.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"create-better-t-stack": "dist/index.js",
|
"create-better-t-stack": "dist/index.js",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,8 +11,7 @@
|
|||||||
"build:web:cloudflare": "bun install && bun run build:web",
|
"build:web:cloudflare": "bun install && bun run build:web",
|
||||||
"build:cli": "turbo run build --filter=create-better-t-stack",
|
"build:cli": "turbo run build --filter=create-better-t-stack",
|
||||||
"check": "turbo check",
|
"check": "turbo check",
|
||||||
"prepare": "husky",
|
"publish-packages": "turbo run build --filter=create-better-t-stack && changeset publish"
|
||||||
"publish-packages": "turbo run build && changeset publish"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "1.9.4",
|
||||||
@@ -28,6 +27,6 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
},
|
},
|
||||||
"packageManager": "bun@1.2.2",
|
"packageManager": "bun@1.2.5",
|
||||||
"workspaces": ["apps/*"]
|
"workspaces": ["apps/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
"lint": {
|
"lint": {
|
||||||
"dependsOn": ["^lint"]
|
"dependsOn": ["^lint"]
|
||||||
},
|
},
|
||||||
"check-types": {
|
"check": {
|
||||||
"dependsOn": ["^check-types"]
|
"dependsOn": ["^check"]
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"cache": false,
|
"cache": false,
|
||||||
|
|||||||
Reference in New Issue
Block a user