mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
upgrade to biome v2
This commit is contained in:
@@ -49,7 +49,7 @@ export const dependencyVersionMap = {
|
||||
|
||||
"@tauri-apps/cli": "^2.4.0",
|
||||
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@biomejs/biome": "^2.0.0",
|
||||
|
||||
husky: "^9.1.7",
|
||||
"lint-staged": "^15.5.0",
|
||||
|
||||
@@ -7,8 +7,8 @@ import pc from "picocolors";
|
||||
import type { ProjectConfig } from "../../types";
|
||||
import { commandExists } from "../../utils/command-exists";
|
||||
import {
|
||||
type EnvVariable,
|
||||
addEnvVariablesToFile,
|
||||
type EnvVariable,
|
||||
} from "../project-generation/env-setup";
|
||||
|
||||
type MongoDBConfig = {
|
||||
|
||||
@@ -7,8 +7,8 @@ import pc from "picocolors";
|
||||
import type { PackageManager, ProjectConfig } from "../../types";
|
||||
import { getPackageExecutionCommand } from "../../utils/get-package-execution-command";
|
||||
import {
|
||||
type EnvVariable,
|
||||
addEnvVariablesToFile,
|
||||
type EnvVariable,
|
||||
} from "../project-generation/env-setup";
|
||||
|
||||
type NeonConfig = {
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { PackageManager } from "../../types";
|
||||
import { addPackageDependency } from "../../utils/add-package-deps";
|
||||
import { getPackageExecutionCommand } from "../../utils/get-package-execution-command";
|
||||
import {
|
||||
type EnvVariable,
|
||||
addEnvVariablesToFile,
|
||||
type EnvVariable,
|
||||
} from "../project-generation/env-setup";
|
||||
|
||||
type PrismaConfig = {
|
||||
|
||||
@@ -7,8 +7,8 @@ import pc from "picocolors";
|
||||
import type { PackageManager, ProjectConfig } from "../../types";
|
||||
import { getPackageExecutionCommand } from "../../utils/get-package-execution-command";
|
||||
import {
|
||||
type EnvVariable,
|
||||
addEnvVariablesToFile,
|
||||
type EnvVariable,
|
||||
} from "../project-generation/env-setup";
|
||||
|
||||
async function writeSupabaseEnvFile(
|
||||
|
||||
@@ -15,8 +15,8 @@ import pc from "picocolors";
|
||||
import type { ProjectConfig } from "../../types";
|
||||
import { commandExists } from "../../utils/command-exists";
|
||||
import {
|
||||
type EnvVariable,
|
||||
addEnvVariablesToFile,
|
||||
type EnvVariable,
|
||||
} from "../project-generation/env-setup";
|
||||
|
||||
type TursoConfig = {
|
||||
|
||||
@@ -2,8 +2,8 @@ import path from "node:path";
|
||||
import consola from "consola";
|
||||
import fs from "fs-extra";
|
||||
import type {
|
||||
API,
|
||||
Addons,
|
||||
API,
|
||||
Database,
|
||||
Frontend,
|
||||
ORM,
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { consola } from "consola";
|
||||
import pc from "picocolors";
|
||||
import type { Database, ORM, Runtime } from "../../types";
|
||||
import type { Database, ORM, ProjectConfig, Runtime } from "../../types";
|
||||
import { getPackageExecutionCommand } from "../../utils/get-package-execution-command";
|
||||
|
||||
import type { ProjectConfig } from "../../types";
|
||||
|
||||
export function displayPostInstallInstructions(
|
||||
config: ProjectConfig & { depsInstalled: boolean },
|
||||
) {
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import path from "node:path";
|
||||
import fs from "fs-extra";
|
||||
import type { Frontend } from "../../types";
|
||||
import type { Frontend, ProjectConfig } from "../../types";
|
||||
import { addPackageDependency } from "../../utils/add-package-deps";
|
||||
import { setupStarlight } from "./starlight-setup";
|
||||
import { setupTauri } from "./tauri-setup";
|
||||
|
||||
import type { ProjectConfig } from "../../types";
|
||||
|
||||
export async function setupAddons(config: ProjectConfig) {
|
||||
const { addons, frontend, projectDir } = config;
|
||||
const hasReactWebFrontend =
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import path from "node:path";
|
||||
import type { AvailableDependencies } from "../../constants";
|
||||
import { addPackageDependency } from "../../utils/add-package-deps";
|
||||
|
||||
import type { ProjectConfig } from "../../types";
|
||||
import { addPackageDependency } from "../../utils/add-package-deps";
|
||||
|
||||
export async function setupBackendDependencies(
|
||||
config: ProjectConfig,
|
||||
|
||||
@@ -3,16 +3,14 @@ import { spinner } from "@clack/prompts";
|
||||
import consola from "consola";
|
||||
import fs from "fs-extra";
|
||||
import pc from "picocolors";
|
||||
import type { ProjectConfig } from "../../types";
|
||||
import { addPackageDependency } from "../../utils/add-package-deps";
|
||||
import { setupMongoDBAtlas } from "../database-providers/mongodb-atlas-setup";
|
||||
import { setupNeonPostgres } from "../database-providers/neon-setup";
|
||||
import { setupPrismaPostgres } from "../database-providers/prisma-postgres-setup";
|
||||
import { setupSupabase } from "../database-providers/supabase-setup";
|
||||
import { setupTurso } from "../database-providers/turso-setup";
|
||||
|
||||
import { setupNeonPostgres } from "../database-providers/neon-setup";
|
||||
|
||||
import type { ProjectConfig } from "../../types";
|
||||
|
||||
export async function setupDatabase(config: ProjectConfig): Promise<void> {
|
||||
const { database, orm, dbSetup, backend, projectDir } = config;
|
||||
|
||||
|
||||
@@ -4,11 +4,10 @@ import { consola } from "consola";
|
||||
import { execa } from "execa";
|
||||
import fs from "fs-extra";
|
||||
import pc from "picocolors";
|
||||
import type { ProjectConfig } from "../../types";
|
||||
import { addPackageDependency } from "../../utils/add-package-deps";
|
||||
import { getPackageExecutionCommand } from "../../utils/get-package-execution-command";
|
||||
|
||||
import type { ProjectConfig } from "../../types";
|
||||
|
||||
export async function setupTauri(config: ProjectConfig): Promise<void> {
|
||||
const { packageManager, frontend, projectDir } = config;
|
||||
const s = spinner();
|
||||
|
||||
@@ -18,8 +18,8 @@ import { gatherConfig } from "./prompts/config-prompts";
|
||||
import { getProjectName } from "./prompts/project-name";
|
||||
import type { CreateInput, ProjectConfig } from "./types";
|
||||
import {
|
||||
APISchema,
|
||||
AddonsSchema,
|
||||
APISchema,
|
||||
BackendSchema,
|
||||
DatabaseSchema,
|
||||
DatabaseSetupSchema,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { cancel, group } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import type {
|
||||
API,
|
||||
Addons,
|
||||
API,
|
||||
Backend,
|
||||
Database,
|
||||
DatabaseSetup,
|
||||
|
||||
@@ -20,6 +20,7 @@ export async function trackProjectCreation(
|
||||
try {
|
||||
const sessionId = `cli_${crypto.randomUUID().replace(/-/g, "")}`;
|
||||
|
||||
// biome-ignore lint/correctness/noUnusedVariables: `projectName`, `projectDir`, and `relativePath` are not used in the event properties
|
||||
const { projectName, projectDir, relativePath, ...safeConfig } = config;
|
||||
|
||||
posthog.capture({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import path from "node:path";
|
||||
import { consola } from "consola";
|
||||
import {
|
||||
type API,
|
||||
type Addons,
|
||||
type API,
|
||||
type Backend,
|
||||
type CLIInput,
|
||||
type Database,
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"$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",
|
||||
".nuxt"
|
||||
]
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "tab"
|
||||
},
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"correctness": {
|
||||
"useExhaustiveDependencies": "info"
|
||||
},
|
||||
"nursery": {
|
||||
"useSortedClasses": {
|
||||
"level": "warn",
|
||||
"fix": "safe",
|
||||
"options": {
|
||||
"functions": ["clsx", "cva", "cn"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "double"
|
||||
}
|
||||
}
|
||||
}
|
||||
83
apps/cli/templates/addons/biome/biome.json.hbs
Normal file
83
apps/cli/templates/addons/biome/biome.json.hbs
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
|
||||
"vcs": {
|
||||
"enabled": false,
|
||||
"clientKind": "git",
|
||||
"useIgnoreFile": false
|
||||
},
|
||||
"files": {
|
||||
"ignoreUnknown": false,
|
||||
"includes": [
|
||||
"**",
|
||||
"!**/.next",
|
||||
"!**/dist",
|
||||
"!**/.turbo",
|
||||
"!**/dev-dist",
|
||||
"!**/.zed",
|
||||
"!**/.vscode",
|
||||
"!**/routeTree.gen.ts",
|
||||
"!**/src-tauri",
|
||||
"!**/.nuxt"
|
||||
]
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "tab"
|
||||
},
|
||||
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"correctness": {
|
||||
"useExhaustiveDependencies": "info"
|
||||
},
|
||||
"nursery": {
|
||||
"useSortedClasses": {
|
||||
"level": "warn",
|
||||
"fix": "safe",
|
||||
"options": {
|
||||
"functions": ["clsx", "cva", "cn"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"noParameterAssign": "error",
|
||||
"useAsConstAssertion": "error",
|
||||
"useDefaultParameterLast": "error",
|
||||
"useEnumInitializers": "error",
|
||||
"useSelfClosingElements": "error",
|
||||
"useSingleVarDeclarator": "error",
|
||||
"noUnusedTemplateLiteral": "error",
|
||||
"useNumberNamespace": "error",
|
||||
"noInferrableTypes": "error",
|
||||
"noUselessElse": "error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "double"
|
||||
}
|
||||
}
|
||||
{{#if (or (eq frontend "svelte") (eq frontend "nuxt"))}}
|
||||
,
|
||||
"overrides": [
|
||||
{
|
||||
"includes": ["**/*.svelte", "**/*.vue"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": {
|
||||
"useConst": "off",
|
||||
"useImportType": "off"
|
||||
},
|
||||
"correctness": {
|
||||
"noUnusedVariables": "off",
|
||||
"noUnusedImports": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
{{/if}}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ export default function UserMenu() {
|
||||
<div class="absolute right-0 mt-2 w-56 rounded p-1 shadow-sm">
|
||||
<div class="px-4 text-sm">{session().data?.user.email}</div>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-1 w-full border rounded px-4 text-center text-sm"
|
||||
onClick={() => {
|
||||
setIsMenuOpen(false);
|
||||
Reference in New Issue
Block a user