feat: initialize monorepo structure with Bun and Turborepo
- Add package.json for the root with workspace configuration and scripts - Create @gruperly/config package with TypeScript configuration - Establish shared package @gruperly/shared with Zod schemas for validation - Implement group, student, and payment schemas using Zod - Set up TypeScript configuration for shared package - Document stack architecture and technical specifications in stack.md - Configure Turborepo with build, dev, lint, and typecheck tasks
This commit is contained in:
6
packages/config/package.json
Normal file
6
packages/config/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "@gruperly/config",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module"
|
||||
}
|
||||
17
packages/config/tsconfig.base.json
Normal file
17
packages/config/tsconfig.base.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"lib": ["ES2022"],
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"declaration": true
|
||||
}
|
||||
}
|
||||
22
packages/shared/package.json
Normal file
22
packages/shared/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@gruperly/shared",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./schemas/*": "./src/schemas/*"
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"zod": "^3.24.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@prisma/client": "^6.0.0",
|
||||
"typescript": "^5.7.0"
|
||||
}
|
||||
}
|
||||
3
packages/shared/src/index.ts
Normal file
3
packages/shared/src/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './schemas/group.schema'
|
||||
export * from './schemas/student.schema'
|
||||
export * from './schemas/payment.schema'
|
||||
15
packages/shared/src/schemas/group.schema.ts
Normal file
15
packages/shared/src/schemas/group.schema.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const createGroupSchema = z.object({
|
||||
name: z.string().min(1, 'El nombre es obligatorio'),
|
||||
description: z.string().optional(),
|
||||
})
|
||||
|
||||
export const updateGroupSchema = createGroupSchema.partial()
|
||||
|
||||
export const groupIdParamsSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
})
|
||||
|
||||
export type CreateGroupInput = z.infer<typeof createGroupSchema>
|
||||
export type UpdateGroupInput = z.infer<typeof updateGroupSchema>
|
||||
17
packages/shared/src/schemas/payment.schema.ts
Normal file
17
packages/shared/src/schemas/payment.schema.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const paymentStatusSchema = z.enum(['PENDING', 'PAID', 'OVERDUE', 'CANCELLED'])
|
||||
|
||||
export const createPaymentSchema = z.object({
|
||||
groupId: z.string().min(1),
|
||||
studentId: z.string().min(1),
|
||||
amount: z.coerce.number().positive(),
|
||||
currency: z.string().default('MXN'),
|
||||
dueDate: z.coerce.date(),
|
||||
status: paymentStatusSchema.optional(),
|
||||
})
|
||||
|
||||
export const updatePaymentSchema = createPaymentSchema.partial()
|
||||
|
||||
export type CreatePaymentInput = z.infer<typeof createPaymentSchema>
|
||||
export type UpdatePaymentInput = z.infer<typeof updatePaymentSchema>
|
||||
16
packages/shared/src/schemas/student.schema.ts
Normal file
16
packages/shared/src/schemas/student.schema.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const createStudentSchema = z.object({
|
||||
groupId: z.string().min(1),
|
||||
fullName: z.string().min(1, 'El nombre completo es obligatorio'),
|
||||
email: z.string().email().optional().or(z.literal('')),
|
||||
phone: z.string().optional().or(z.literal('')),
|
||||
guardianName: z.string().optional().or(z.literal('')),
|
||||
guardianPhone: z.string().optional().or(z.literal('')),
|
||||
notes: z.string().optional().or(z.literal('')),
|
||||
})
|
||||
|
||||
export const updateStudentSchema = createStudentSchema.omit({ groupId: true }).partial()
|
||||
|
||||
export type CreateStudentInput = z.infer<typeof createStudentSchema>
|
||||
export type UpdateStudentInput = z.infer<typeof updateStudentSchema>
|
||||
10
packages/shared/tsconfig.json
Normal file
10
packages/shared/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "@gruperly/config/tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "bundler",
|
||||
"paths": {
|
||||
"@gruperly/shared": ["./src/index.ts"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user