Skip to content

Commit 969d679

Browse files
authored
Merge pull request #6 from tclxshunquan-wang/feat/upgrade
Feat/upgrade chore: 🔧 upgrade Zod to v4 and update related dependencies
2 parents 432b994 + 4eb0077 commit 969d679

File tree

7 files changed

+450
-442
lines changed

7 files changed

+450
-442
lines changed

.changeset/spicy-meals-accept.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
"@hyperse/next-config": patch
3+
---
4+
5+
Upgrade Zod from v3 to v4 and update dependencies
6+
7+
- **Breaking Change**: Upgrade Zod from `^3.25.67` to `^4.0.17`
8+
- **Breaking Change**: Update import statements from `zod/v4` to `zod` in source files
9+
- Update various dev dependencies to their latest versions:
10+
- `@hyperse/eslint-config-hyperse`: `^1.4.5``^1.4.6`
11+
- `@types/node`: `^24.0.4``^24.2.1`
12+
- `eslint`: `^9.29.0``^9.33.0`
13+
- `lint-staged`: `^16.1.2``^16.1.5`
14+
- `next`: `^15.3.4``^15.4.6`
15+
- `react`: `^19.1.0``^19.1.1`
16+
- `react-dom`: `^19.1.0``^19.1.1`
17+
- `typescript`: `^5.8.3``^5.9.2`
18+
19+
20+

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Validates and type-checks environment variables using Zod schemas.
7373

7474
```typescript
7575
import { createNextConfigEnv } from '@hyperse/next-config';
76-
import { z } from 'zod/v4';
76+
import { z } from 'zod';
7777

7878
// Define your environment variable schema
7979
const envSchema = z.object({
@@ -97,7 +97,7 @@ Here's a complete example showing how to use both features together:
9797
```typescript
9898
// next.config.mjs
9999
import { createNextConfig, createNextConfigEnv } from '@hyperse/next-config';
100-
import { z } from 'zod/v4';
100+
import { z } from 'zod';
101101

102102
// Define and validate environment variables
103103
const envSchema = z.object({

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,27 @@
5252
},
5353
"dependencies": {
5454
"picocolors": "^1.1.1",
55-
"zod": "^3.25.67"
55+
"zod": "^4.0.17"
5656
},
5757
"devDependencies": {
5858
"@changesets/changelog-github": "^0.5.1",
5959
"@changesets/cli": "^2.29.5",
6060
"@commitlint/cli": "^19.8.1",
6161
"@commitlint/config-conventional": "^19.8.1",
62-
"@hyperse/eslint-config-hyperse": "^1.4.5",
63-
"@types/node": "^24.0.4",
62+
"@hyperse/eslint-config-hyperse": "^1.4.6",
63+
"@types/node": "^24.2.1",
6464
"commitizen": "^4.3.1",
6565
"cz-conventional-changelog": "^3.3.0",
66-
"eslint": "^9.29.0",
66+
"eslint": "^9.33.0",
6767
"execa": "^9.6.0",
6868
"husky": "^9.1.7",
69-
"lint-staged": "^16.1.2",
70-
"next": "^15.3.4",
69+
"lint-staged": "^16.1.5",
70+
"next": "^15.4.6",
7171
"npm-run-all": "^4.1.5",
72-
"react": "^19.1.0",
73-
"react-dom": "^19.1.0",
72+
"react": "^19.1.1",
73+
"react-dom": "^19.1.1",
7474
"tsup": "^8.5.0",
75-
"typescript": "^5.8.3",
75+
"typescript": "^5.9.2",
7676
"vitest": "^3.2.4"
7777
},
7878
"peerDependencies": {

src/createNextConfigEnv.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type z from 'zod/v4';
2-
import type { ZodObject } from 'zod/v4';
3-
import { treeifyError } from 'zod/v4';
1+
import type { z, ZodObject } from 'zod';
2+
import { treeifyError } from 'zod';
43
import { printEnv } from './printEnv.js';
54

65
/**

src/printEnv.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import picocolors from 'picocolors';
2-
import type { core, ZodType } from 'zod/v4';
3-
import { type ZodSafeParseSuccess } from 'zod/v4';
2+
import type { z, ZodSafeParseSuccess, ZodType } from 'zod';
43

54
/**
65
* Prints the validated environment variables to the console
@@ -9,7 +8,7 @@ import { type ZodSafeParseSuccess } from 'zod/v4';
98
*/
109
export const printEnv = <T extends ZodType>(
1110
section: string,
12-
zodSafeParseSuccess: ZodSafeParseSuccess<core.output<T>>
11+
zodSafeParseSuccess: ZodSafeParseSuccess<z.output<T>>
1312
) => {
1413
const prefix = picocolors.cyan('- info'.padEnd(7));
1514
console.info(prefix.concat(`${section} validation successful:`));

tests/createNextConfigEnv.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('createNextConfigEnv', () => {
3131
it('should successfully validate environment variables', () => {
3232
const schema = z.object({
3333
PORT: z.string(),
34-
DATABASE_URL: z.string().url(),
34+
DATABASE_URL: z.url(),
3535
});
3636

3737
process.env.PORT = '3000';
@@ -49,7 +49,7 @@ describe('createNextConfigEnv', () => {
4949
it('should throw error for invalid environment variables', () => {
5050
const schema = z.object({
5151
PORT: z.string(),
52-
DATABASE_URL: z.string().url(),
52+
DATABASE_URL: z.url(),
5353
});
5454

5555
process.env.PORT = '3000';
@@ -64,7 +64,7 @@ describe('createNextConfigEnv', () => {
6464
it('should work with optional environment variables', () => {
6565
const schema = z.object({
6666
PORT: z.string().optional(),
67-
DATABASE_URL: z.string().url(),
67+
DATABASE_URL: z.url(),
6868
});
6969

7070
process.env.DATABASE_URL = 'https://example.com/db';

0 commit comments

Comments
 (0)