chore: upgrade Zod 4, Vitest 4, and TypeScript 7
Bump major tooling stacks and adapt Zod error APIs (issues/flattenError) plus tsconfig paths for TS 7 baseUrl removal. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
160c05a511
commit
830d252346
7 files changed
+613
-482
No files matched your search
+5
-4
@@ -65,7 +65,7 @@
|
|||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.6.0",
|
"tailwind-merge": "^3.6.0",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"zod": "^3.24.0"
|
"zod": "^4.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "2.5.4",
|
"@biomejs/biome": "2.5.4",
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/postcss": "^4.3.3",
|
"@tailwindcss/postcss": "^4.3.3",
|
||||||
"@tailwindcss/typography": "^0.5.20",
|
"@tailwindcss/typography": "^0.5.20",
|
||||||
"@types/node": "^22.10.0",
|
"@types/node": "^26.1.1",
|
||||||
"@types/nodemailer": "^7.0.12",
|
"@types/nodemailer": "^7.0.12",
|
||||||
"@types/react": "^19.2.17",
|
"@types/react": "^19.2.17",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
@@ -86,7 +86,8 @@
|
|||||||
"prisma": "^7.9.0",
|
"prisma": "^7.9.0",
|
||||||
"tailwindcss": "^4.3.3",
|
"tailwindcss": "^4.3.3",
|
||||||
"tsx": "^4.23.1",
|
"tsx": "^4.23.1",
|
||||||
"typescript": "^5.7.0",
|
"typescript": "^7.0.2",
|
||||||
"vitest": "^2.1.0"
|
"vite": "^8.1.5",
|
||||||
|
"vitest": "^4.1.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
+595
-470
File diff suppressed because it is too large.
Load diff
@@ -54,7 +54,7 @@ export async function register(
|
|||||||
|
|
||||||
const parsed = registerSchema.safeParse(raw);
|
const parsed = registerSchema.safeParse(raw);
|
||||||
if (!parsed.success) {
|
if (!parsed.success) {
|
||||||
return parsed.error.errors[0]?.message ?? "Invalid input";
|
return parsed.error.issues[0]?.message ?? "Invalid input";
|
||||||
}
|
}
|
||||||
|
|
||||||
const { username, mail, password, look } = parsed.data;
|
const { username, mail, password, look } = parsed.data;
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ const schema = z.object({
|
|||||||
if (data.NODE_ENV !== "production") return;
|
if (data.NODE_ENV !== "production") return;
|
||||||
if (!data.AUTH_SECRET || data.AUTH_SECRET.length < 32) {
|
if (!data.AUTH_SECRET || data.AUTH_SECRET.length < 32) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
code: z.ZodIssueCode.custom,
|
code: "custom",
|
||||||
message:
|
message:
|
||||||
"AUTH_SECRET (>=32 characters) is required when NODE_ENV=production",
|
"AUTH_SECRET (>=32 characters) is required when NODE_ENV=production",
|
||||||
path: ["AUTH_SECRET"],
|
path: ["AUTH_SECRET"],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { z } from "zod";
|
import { z } from "zod";
|
||||||
import { logAuthorizationEvent } from "@/lib/admin/authorization-events";
|
import { logAuthorizationEvent } from "@/lib/admin/authorization-events";
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
import { canAccess, getApiAdminContext } from "@/lib/permissions";
|
import { canAccess, getApiAdminContext } from "@/lib/permissions";
|
||||||
@@ -112,7 +112,10 @@ export function adminAction<TSchema extends z.ZodType | undefined = undefined>(
|
|||||||
if (!parsed.success) {
|
if (!parsed.success) {
|
||||||
return fail(
|
return fail(
|
||||||
"Validation failed",
|
"Validation failed",
|
||||||
parsed.error.flatten().fieldErrors as Record<string, string[]>,
|
z.flattenError(parsed.error).fieldErrors as Record<
|
||||||
|
string,
|
||||||
|
string[]
|
||||||
|
>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
data = parsed.data;
|
data = parsed.data;
|
||||||
@@ -188,7 +191,10 @@ export function authAction<TSchema extends z.ZodType | undefined = undefined>(
|
|||||||
if (!parsed.success) {
|
if (!parsed.success) {
|
||||||
return fail(
|
return fail(
|
||||||
"Validation failed",
|
"Validation failed",
|
||||||
parsed.error.flatten().fieldErrors as Record<string, string[]>,
|
z.flattenError(parsed.error).fieldErrors as Record<
|
||||||
|
string,
|
||||||
|
string[]
|
||||||
|
>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
data = parsed.data;
|
data = parsed.data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ZodError } from "zod";
|
import { ZodError, z } from "zod";
|
||||||
import { handleActionError as foundationHandle } from "@/lib/foundation/action";
|
import { handleActionError as foundationHandle } from "@/lib/foundation/action";
|
||||||
|
|
||||||
export type ActionResult<T = Record<string, unknown>> =
|
export type ActionResult<T = Record<string, unknown>> =
|
||||||
@@ -27,7 +27,7 @@ export function handleActionError(error: unknown): ActionResult<never> {
|
|||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
error: "Validation failed",
|
error: "Validation failed",
|
||||||
fieldErrors: error.flatten().fieldErrors as Record<string, string[]>,
|
fieldErrors: z.flattenError(error).fieldErrors as Record<string, string[]>,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (error instanceof Error && error.name === "ActionError") {
|
if (error instanceof Error && error.name === "ActionError") {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"name": "next"
|
"name": "next"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"baseUrl": ".",
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./src/*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user