Skip to content

Commit 4333d15

Browse files
committed
feat!: Update auto-form to zod 4, update packages
1 parent 5e58bf7 commit 4333d15

File tree

47 files changed

+1731
-1655
lines changed

Some content is hidden

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

47 files changed

+1731
-1655
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

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/package.json

Lines changed: 7 additions & 7 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.10",
19-
"@hono/zod-validator": "^0.7.1",
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",
2323
"drizzle-orm": "^0.44.3",
2424
"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.16.0",
32-
"@types/node": "^24.0.13",
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",
3737
"eslint": "^9.31.0",
38-
"react-email": "^4.1.3",
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
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const formSchema = z.object({
3434
id: 'type',
3535
component: props => (
3636
<AutoFormCombobox
37+
{...props}
3738
description="Select an option from the list"
3839
label="Type"
3940
labels={[
@@ -46,7 +47,6 @@ const formSchema = z.object({
4647
label: 'Option Two',
4748
},
4849
]}
49-
{...props}
5050
/>
5151
),
5252
},

apps/docs/content/docs/ui/input.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { AutoFormInput } from '@vitnode/core/components/form/fields/input';
2222
```ts
2323
const formSchema = z.object({
2424
username: z.string().min(3, 'Username must be at least 3 characters'),
25-
email: z.string().email('Please enter a valid email address'),
25+
email: z.email('Please enter a valid email address'),
2626
});
2727
```
2828

@@ -34,20 +34,19 @@ const formSchema = z.object({
3434
id: 'username',
3535
component: props => (
3636
<AutoFormInput
37+
{...props}
3738
description="This is the username for your application. It should be unique and not shared with anyone."
3839
label="Username"
39-
{...props}
4040
/>
4141
),
4242
},
4343
{
4444
id: 'email',
4545
component: props => (
4646
<AutoFormInput
47-
type="email"
47+
{...props}
4848
description="We'll use this email to contact you."
4949
label="Email Address"
50-
{...props}
5150
/>
5251
),
5352
},

apps/docs/content/docs/ui/radio-group.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const formSchema = z.object({
3333
id: 'options',
3434
component: props => (
3535
<AutoFormRadioGroup
36+
{...props}
3637
description="By checking this box, you agree to the terms and conditions."
3738
label="I agree to the terms and conditions"
3839
labels={[
@@ -49,7 +50,6 @@ const formSchema = z.object({
4950
label: 'Option 3',
5051
},
5152
]}
52-
{...props}
5353
/>
5454
),
5555
},

0 commit comments

Comments
 (0)