Skip to content

Commit 2dc5501

Browse files
Merge pull request #670 from aXenDeveloper/zod_4
perf!: Update zod 4
2 parents 9b76e42 + 4333d15 commit 2dc5501

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2491
-1982
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- i18n: Use `next-intl`, `t('key')` for translations, `getTranslation` (server), `useTranslation` (client)
1515
- Accessibility: WCAG 2.1 AA, semantic HTML, ARIA, keyboard/screen reader support
1616
- **Backend:**
17-
- Hono.js 4, OpenAPI via `@hono/zod-openapi`, Zod 3 for validation
17+
- Hono.js 4, OpenAPI via `@hono/zod-openapi`, Zod 4 for validation
1818
- Database: PostgreSQL via Drizzle ORM, access via `c.get('database')`
1919
- API: RESTful, versioned, rate-limited, secure session management
2020
- Error handling: Use Hono's error middleware, log via `c.get('log')`

.github/docs/prd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ VitNode is designed for individual developers and small teams who need a structu
150150
- React 19 with Server Components
151151
- TypeScript 5 with strict configuration
152152
- Tailwind CSS 4 with Shadcn UI components
153-
- Zod 3 for runtime validation
153+
- Zod 4 for runtime validation
154154
- React Hook Form 7 for form management
155155
- Next-intl for internationalization
156156

.github/workflows/build-lint-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: pnpm/action-setup@v4
2323
name: Install pnpm
2424
with:
25-
version: 10.12.4
25+
version: 10.13.1
2626

2727
- name: Install Node.js
2828
uses: actions/setup-node@v4

.github/workflows/bump_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- uses: pnpm/action-setup@v4
5353
name: Install pnpm
5454
with:
55-
version: 10.12.4
55+
version: 10.13.1
5656

5757
- name: Install Node.js
5858
uses: actions/setup-node@v4

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
- **Enhanced Plugin System**: Improved CLI tools for plugins
7575
- **Better Documentation**: Completely rewritten docs and website
7676
- **Streamlined Configuration**: Single config file for all settings
77+
- **Zod 4**: Upgraded to the latest version for schema validation
7778

7879
## 🔍 Project Scope
7980

apps/api/eslint.config.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
import eslintVitNode from '@vitnode/eslint-config/eslint';
2+
import { fileURLToPath } from 'node:url';
3+
import { dirname } from 'node:path';
4+
5+
const __dirname = dirname(fileURLToPath(import.meta.url));
26

37
export default [
48
...eslintVitNode,
59
{
610
ignores: ['drizzle.config.ts'],
711
},
12+
{
13+
languageOptions: {
14+
parserOptions: {
15+
project: './tsconfig.json',
16+
tsconfigRootDir: __dirname,
17+
},
18+
},
19+
},
820
];

apps/api/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@
1515
"drizzle-kit": "drizzle-kit"
1616
},
1717
"dependencies": {
18-
"@hono/zod-openapi": "^0.19.9",
19-
"@hono/zod-validator": "^0.7.0",
20-
"@react-email/components": "^0.2.0",
18+
"@hono/zod-openapi": "^1.0.2",
19+
"@hono/zod-validator": "^0.7.2",
20+
"@react-email/components": "^0.3.2",
2121
"@vitnode/core": "workspace:*",
2222
"drizzle-kit": "^0.31.4",
23-
"drizzle-orm": "^0.44.2",
24-
"hono": "^4.8.4",
23+
"drizzle-orm": "^0.44.3",
24+
"hono": "^4.8.5",
2525
"next-intl": "^4.3.4",
2626
"react": "^19.1.0",
2727
"react-dom": "^19.1.0",
28-
"zod": "^3.25.76"
28+
"zod": "^4.0.5"
2929
},
3030
"devDependencies": {
31-
"@hono/node-server": "^1.15.0",
32-
"@types/node": "^24.0.12",
31+
"@hono/node-server": "^1.17.1",
32+
"@types/node": "^24.1.0",
3333
"@types/react": "^19.1.8",
3434
"@types/react-dom": "^19.1.6",
3535
"@vitnode/eslint-config": "workspace:*",
3636
"dotenv": "^17.2.0",
37-
"eslint": "^9.30.1",
38-
"react-email": "^4.1.1",
37+
"eslint": "^9.31.0",
38+
"react-email": "^4.2.3",
3939
"tsc-alias": "^1.8.16",
4040
"tsx": "^4.20.3",
4141
"typescript": "^5.8.3"

apps/docs/content/docs/ui/auto-form.mdx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import { z } from 'zod';
2121
```ts
2222
const formSchema = z.object({
2323
username: z.string().min(3, 'Username must be at least 3 characters'),
24-
email: z.string().email('Please enter a valid email address'),
24+
email: z
25+
.email('Please enter a valid email address')
26+
.describe("We'll use this email to contact you. (from zod schema)"),
2527
user_type: z.enum(['admin', 'editor', 'viewer']),
2628
accept_terms: z.boolean().refine(val => val, {
2729
message: 'You must accept the terms and conditions',
@@ -37,55 +39,50 @@ const formSchema = z.object({
3739
id: 'username',
3840
component: props => (
3941
<AutoFormInput
42+
{...props}
4043
description="This is the username for your application. It should be unique and not shared with anyone."
4144
label="Username"
42-
{...props}
4345
/>
4446
),
4547
},
4648
{
4749
id: 'email',
4850
component: props => (
49-
<AutoFormInput
50-
description="We'll use this email to contact you."
51-
label="Email Address"
52-
type="email"
53-
{...props}
54-
/>
51+
<AutoFormInput {...props} label="Email Address" type="email" />
5552
),
5653
},
5754
{
5855
id: 'user_type',
5956
component: props => (
6057
<AutoFormSelect
58+
{...props}
6159
description="Select the type of user."
6260
label="User Type"
6361
labels={[
6462
{ value: 'admin', label: 'Admin' },
6563
{ value: 'editor', label: 'Editor' },
6664
{ value: 'viewer', label: 'Viewer' },
6765
]}
68-
{...props}
6966
/>
7067
),
7168
},
7269
{
7370
id: 'accept_terms',
7471
component: props => (
7572
<AutoFormCheckbox
76-
label="I accept the terms and conditions"
7773
{...props}
74+
label="I accept the terms and conditions"
7875
/>
7976
),
8077
},
8178
{
8279
id: 'description',
8380
component: props => (
8481
<AutoFormTextarea
82+
{...props}
8583
description="Write a short description of your application."
8684
label="Description"
8785
placeholder="My application is..."
88-
{...props}
8986
/>
9087
),
9188
},
@@ -127,7 +124,7 @@ Auto Form supports all Zod validators:
127124
```ts
128125
const formSchema = z.object({
129126
username: z.string().min(3).max(20),
130-
email: z.string().email(),
127+
email: z.email(),
131128
age: z.number().min(18).max(120),
132129
password: z
133130
.string()
@@ -138,6 +135,12 @@ const formSchema = z.object({
138135
});
139136
```
140137

138+
## Custom Fields
139+
140+
<Callout type="warn" title="This documentation is under construction! 🚧">
141+
We're working hard to bring you the best documentation experience.
142+
</Callout>
143+
141144
## Form Submission
142145

143146
To activate submit button and handle form submission with the `onSubmit` callback:
@@ -149,9 +152,9 @@ To activate submit button and handle form submission with the `onSubmit` callbac
149152
id: 'username',
150153
component: props => (
151154
<AutoFormInput
155+
{...props}
152156
description="This is the username for your application."
153157
label="Username"
154-
{...props}
155158
/>
156159
),
157160
},

apps/docs/content/docs/ui/checkbox.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ const formSchema = z.object({
3636
id: 'acceptTerms',
3737
component: props => (
3838
<AutoFormCheckbox
39-
label="I accept the terms and conditions"
4039
{...props}
40+
label="I accept the terms and conditions"
4141
/>
4242
),
4343
},

apps/docs/content/docs/ui/combobox-async.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const formSchema = z.object({
3232
id: 'categoryId',
3333
component: props => (
3434
<AutoFormComboboxAsync
35+
{...props}
3536
fetchData={async ({ search }) => {
3637
const res = await fetcherClient(categoriesModule, {
3738
path: '/',
@@ -52,7 +53,6 @@ const formSchema = z.object({
5253
}}
5354
id="categoryId"
5455
label="Category"
55-
{...props}
5656
/>
5757
),
5858
},

0 commit comments

Comments
 (0)