Initial commit
This commit is contained in:
22
packages/content/package.json
Normal file
22
packages/content/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@cms/content",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"lint": "biome check src",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"zod": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cms/config": "workspace:*",
|
||||
"@biomejs/biome": "latest",
|
||||
"typescript": "latest"
|
||||
}
|
||||
}
|
||||
23
packages/content/src/index.ts
Normal file
23
packages/content/src/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { z } from "zod"
|
||||
|
||||
export const postStatusSchema = z.enum(["draft", "published"])
|
||||
|
||||
export const postSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
title: z.string().min(3).max(180),
|
||||
slug: z.string().min(3).max(180),
|
||||
excerpt: z.string().max(320).optional(),
|
||||
body: z.string().min(1),
|
||||
status: postStatusSchema,
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
})
|
||||
|
||||
export const upsertPostSchema = postSchema.omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
})
|
||||
|
||||
export type Post = z.infer<typeof postSchema>
|
||||
export type UpsertPostInput = z.infer<typeof upsertPostSchema>
|
||||
8
packages/content/tsconfig.json
Normal file
8
packages/content/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@cms/config/tsconfig/base",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user