chore: update pnpm workspace with TypeScript and Zod versions; enhance turbo.json task formatting
This commit is contained in:
parent
fad2331aae
commit
5ab5cfda9c
@ -1,6 +1,9 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
transpilePackages: ["@workspace/ui"],
|
transpilePackages: [
|
||||||
|
"@workspace/ui",
|
||||||
|
"@workspace/db"
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
export default nextConfig
|
export default nextConfig
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@workspace/ui": "workspace:*",
|
"@workspace/ui": "workspace:*",
|
||||||
|
"@workspace/db": "workspace:*",
|
||||||
"lucide-react": "^0.475.0",
|
"lucide-react": "^0.475.0",
|
||||||
"next": "^15.2.3",
|
"next": "^15.2.3",
|
||||||
"next-themes": "^0.4.4",
|
"next-themes": "^0.4.4",
|
||||||
@ -25,6 +26,6 @@
|
|||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
"@workspace/eslint-config": "workspace:^",
|
"@workspace/eslint-config": "workspace:^",
|
||||||
"@workspace/typescript-config": "workspace:*",
|
"@workspace/typescript-config": "workspace:*",
|
||||||
"typescript": "^5.7.3"
|
"typescript": "catalog:"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,7 +6,9 @@
|
|||||||
"build": "turbo build",
|
"build": "turbo build",
|
||||||
"dev": "turbo dev",
|
"dev": "turbo dev",
|
||||||
"lint": "turbo lint",
|
"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": {
|
"devDependencies": {
|
||||||
"@workspace/eslint-config": "workspace:*",
|
"@workspace/eslint-config": "workspace:*",
|
||||||
|
1
packages/db/.env.default
Normal file
1
packages/db/.env.default
Normal file
@ -0,0 +1 @@
|
|||||||
|
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/repo_development"
|
1
packages/db/README.md
Normal file
1
packages/db/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# `db`
|
11
packages/db/drizzle.config.ts
Normal file
11
packages/db/drizzle.config.ts
Normal 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
36
packages/db/package.json
Normal 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:"
|
||||||
|
}
|
||||||
|
}
|
12
packages/db/src/database.ts
Normal file
12
packages/db/src/database.ts
Normal 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
2
packages/db/src/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from "./schema";
|
||||||
|
export * from "./database";
|
33
packages/db/src/schema.ts
Normal file
33
packages/db/src/schema.ts
Normal 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
11
packages/db/tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": "@workspace/typescript-config/nextjs.json",
|
||||||
|
"include": ["**/*.ts", "**/*.tsx"],
|
||||||
|
"exclude": ["dist", "build", "node_modules"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,7 @@
|
|||||||
"eslint-plugin-react-hooks": "^5.1.0",
|
"eslint-plugin-react-hooks": "^5.1.0",
|
||||||
"eslint-plugin-turbo": "^2.4.2",
|
"eslint-plugin-turbo": "^2.4.2",
|
||||||
"globals": "^15.15.0",
|
"globals": "^15.15.0",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "catalog:",
|
||||||
"typescript-eslint": "^8.24.1"
|
"typescript-eslint": "^8.24.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@
|
|||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"tailwind-merge": "^3.0.1",
|
"tailwind-merge": "^3.0.1",
|
||||||
"tw-animate-css": "^1.2.4",
|
"tw-animate-css": "^1.2.4",
|
||||||
"zod": "^3.24.2"
|
"zod": "catalog:"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4.0.8",
|
"@tailwindcss/postcss": "^4.0.8",
|
||||||
@ -27,7 +27,7 @@
|
|||||||
"@workspace/eslint-config": "workspace:*",
|
"@workspace/eslint-config": "workspace:*",
|
||||||
"@workspace/typescript-config": "workspace:*",
|
"@workspace/typescript-config": "workspace:*",
|
||||||
"tailwindcss": "^4.0.8",
|
"tailwindcss": "^4.0.8",
|
||||||
"typescript": "^5.7.3"
|
"typescript": "catalog:"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
"./globals.css": "./src/styles/globals.css",
|
"./globals.css": "./src/styles/globals.css",
|
||||||
|
1580
pnpm-lock.yaml
1580
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,6 @@
|
|||||||
packages:
|
packages:
|
||||||
- "apps/*"
|
- "apps/*"
|
||||||
- "packages/*"
|
- "packages/*"
|
||||||
|
catalog:
|
||||||
|
typescript: ^5.7.3
|
||||||
|
zod: ^3.25.1
|
||||||
|
26
turbo.json
26
turbo.json
@ -3,19 +3,35 @@
|
|||||||
"ui": "tui",
|
"ui": "tui",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"build": {
|
"build": {
|
||||||
"dependsOn": ["^build"],
|
"dependsOn": [
|
||||||
"inputs": ["$TURBO_DEFAULT$", ".env*"],
|
"^build"
|
||||||
"outputs": [".next/**", "!.next/cache/**"]
|
],
|
||||||
|
"inputs": [
|
||||||
|
"$TURBO_DEFAULT$",
|
||||||
|
".env*"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
".next/**",
|
||||||
|
"!.next/cache/**"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"dependsOn": ["^lint"]
|
"dependsOn": [
|
||||||
|
"^lint"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"check-types": {
|
"check-types": {
|
||||||
"dependsOn": ["^check-types"]
|
"dependsOn": [
|
||||||
|
"^check-types"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"cache": false,
|
"cache": false,
|
||||||
"persistent": true
|
"persistent": true
|
||||||
|
},
|
||||||
|
"studio": {
|
||||||
|
"cache": false,
|
||||||
|
"persistent": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user