chore: update pnpm workspace with TypeScript and Zod versions; enhance turbo.json task formatting

This commit is contained in:
Wallace Osmar 2025-07-28 21:16:50 -03:00
parent fad2331aae
commit 5ab5cfda9c
16 changed files with 1720 additions and 24 deletions

View File

@ -1,6 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ["@workspace/ui"],
transpilePackages: [
"@workspace/ui",
"@workspace/db"
],
}
export default nextConfig

View File

@ -13,6 +13,7 @@
},
"dependencies": {
"@workspace/ui": "workspace:*",
"@workspace/db": "workspace:*",
"lucide-react": "^0.475.0",
"next": "^15.2.3",
"next-themes": "^0.4.4",
@ -25,6 +26,6 @@
"@types/react-dom": "^19",
"@workspace/eslint-config": "workspace:^",
"@workspace/typescript-config": "workspace:*",
"typescript": "^5.7.3"
"typescript": "catalog:"
}
}
}

View File

@ -6,7 +6,9 @@
"build": "turbo build",
"dev": "turbo dev",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"db:push": "turbo -F @workspace/db push",
"db:studio": "turbo -F @workspace/db studio"
},
"devDependencies": {
"@workspace/eslint-config": "workspace:*",
@ -19,4 +21,4 @@
"engines": {
"node": ">=20"
}
}
}

1
packages/db/.env.default Normal file
View File

@ -0,0 +1 @@
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/repo_development"

1
packages/db/README.md Normal file
View File

@ -0,0 +1 @@
# `db`

View File

@ -0,0 +1,11 @@
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
out: './drizzle',
schema: './src/schema.ts',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
});

36
packages/db/package.json Normal file
View File

@ -0,0 +1,36 @@
{
"name": "@workspace/db",
"version": "0.0.0",
"private": true,
"type": "module",
"publishConfig": {
"access": "public"
},
"exports": {
".": "./src/index.ts"
},
"scripts": {
"migrate": "pnpm with-env drizzle-kit migrate",
"generate": "pnpm with-env drizzle-kit generate",
"push": "pnpm with-env drizzle-kit push",
"studio": "pnpm with-env drizzle-kit studio",
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"dotenv": "^17.2.1",
"drizzle-orm": "^0.44.3",
"pg": "^8.16.3",
"zod": "catalog:"
},
"devDependencies": {
"@types/pg": "^8.15.4",
"@workspace/eslint-config": "workspace:*",
"@workspace/typescript-config": "workspace:*",
"dotenv-cli": "^9.0.0",
"drizzle-kit": "^0.31.4",
"eslint": "^9.20.1",
"tsup": "^8.5.0",
"tsx": "^4.20.3",
"typescript": "catalog:"
}
}

View File

@ -0,0 +1,12 @@
import * as schema from "./schema";
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
export const client = new Pool({
connectionString: process.env.DATABASE_URL!,
});
export const db = drizzle({
client,
schema,
});

2
packages/db/src/index.ts Normal file
View File

@ -0,0 +1,2 @@
export * from "./schema";
export * from "./database";

33
packages/db/src/schema.ts Normal file
View File

@ -0,0 +1,33 @@
import { pgTable, serial, varchar, integer, pgEnum, primaryKey } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';
//#region Enums
export const BookTypeEnum = pgEnum("book_type", ["novel", "fanfic"]);
export const LeadingGenderEnum = pgEnum("leading_gender", ["male", "female"]);
//#endregion Enums
//#region Genre
export const Genre = pgTable("genres", {
id: serial("id").primaryKey(),
name: varchar("name").notNull(),
description: varchar("description").notNull(),
});
export const GenreTranslation = pgTable("genre_translations", {
id: integer("id"),
locale: varchar("locale").notNull(),
name: varchar("name").notNull(),
description: varchar("description"),
}, (t) => ([
primaryKey({ columns: [t.id, t.locale] }),
]));
// Relations
export const GenreRelations = relations(Genre, ({ many }) => ({
translations: many(GenreTranslation)
}));
export const GenreTranslationRelations = relations(GenreTranslation, ({ one }) => ({
genre: one(Genre, {
fields: [GenreTranslation.id],
references: [Genre.id],
}),
}));
//#endregion Genre

11
packages/db/tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"extends": "@workspace/typescript-config/nextjs.json",
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["dist", "build", "node_modules"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

View File

@ -19,7 +19,7 @@
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-turbo": "^2.4.2",
"globals": "^15.15.0",
"typescript": "^5.7.3",
"typescript": "catalog:",
"typescript-eslint": "^8.24.1"
}
}
}

View File

@ -16,7 +16,7 @@
"react-dom": "^19.0.0",
"tailwind-merge": "^3.0.1",
"tw-animate-css": "^1.2.4",
"zod": "^3.24.2"
"zod": "catalog:"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.0.8",
@ -27,7 +27,7 @@
"@workspace/eslint-config": "workspace:*",
"@workspace/typescript-config": "workspace:*",
"tailwindcss": "^4.0.8",
"typescript": "^5.7.3"
"typescript": "catalog:"
},
"exports": {
"./globals.css": "./src/styles/globals.css",
@ -36,4 +36,4 @@
"./components/*": "./src/components/*.tsx",
"./hooks/*": "./src/hooks/*.ts"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
packages:
- "apps/*"
- "packages/*"
catalog:
typescript: ^5.7.3
zod: ^3.25.1

View File

@ -3,19 +3,35 @@
"ui": "tui",
"tasks": {
"build": {
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": [".next/**", "!.next/cache/**"]
"dependsOn": [
"^build"
],
"inputs": [
"$TURBO_DEFAULT$",
".env*"
],
"outputs": [
".next/**",
"!.next/cache/**"
]
},
"lint": {
"dependsOn": ["^lint"]
"dependsOn": [
"^lint"
]
},
"check-types": {
"dependsOn": ["^check-types"]
"dependsOn": [
"^check-types"
]
},
"dev": {
"cache": false,
"persistent": true
},
"studio": {
"cache": false,
"persistent": true
}
}
}
}