This commit is contained in:
2025-05-21 08:47:21 +03:00
parent 079ce23363
commit 3cd4b8861e
8 changed files with 123 additions and 124 deletions

View File

@@ -1,8 +1,7 @@
import { z } from "zod"; import { z } from "zod";
export type TypeToZod<T> = { export type TypeToZod<T> = {
[K in keyof T]: // 1. Handle Arrays (including arrays of objects, optional or required) [K in keyof T]: T[K] extends ReadonlyArray<infer E> | undefined // 1. Handle Arrays (including arrays of objects, optional or required)
T[K] extends ReadonlyArray<infer E> | undefined
? undefined extends T[K] ? undefined extends T[K]
? E extends object ? E extends object
? z.ZodOptional<z.ZodArray<z.ZodObject<TypeToZod<E>>>> ? z.ZodOptional<z.ZodArray<z.ZodObject<TypeToZod<E>>>>

View File

@@ -1,21 +1,21 @@
{ {
"$schema": "https://ui.shadcn.com/schema.json", "$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york", "style": "new-york",
"rsc": false, "rsc": false,
"tsx": true, "tsx": true,
"tailwind": { "tailwind": {
"config": "", "config": "",
"css": "app/app.css", "css": "app/app.css",
"baseColor": "neutral", "baseColor": "neutral",
"cssVariables": true, "cssVariables": true,
"prefix": "" "prefix": ""
}, },
"aliases": { "aliases": {
"components": "~/components", "components": "~/components",
"utils": "~/lib/utils", "utils": "~/lib/utils",
"ui": "~/components/ui", "ui": "~/components/ui",
"lib": "~/lib", "lib": "~/lib",
"hooks": "~/hooks" "hooks": "~/hooks"
}, },
"iconLibrary": "lucide" "iconLibrary": "lucide"
} }

View File

@@ -7,17 +7,17 @@ import globals from "globals";
import tseslint from "typescript-eslint"; import tseslint from "typescript-eslint";
export default defineConfig([ export default defineConfig([
{ {
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
plugins: { js }, plugins: { js },
extends: ["js/recommended"], extends: ["js/recommended"],
}, },
{ {
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
languageOptions: { globals: globals.browser }, languageOptions: { globals: globals.browser },
}, },
tseslint.configs.recommended, tseslint.configs.recommended,
pluginReact.configs.recommended, pluginReact.configs.recommended,
reactHooks.configs.recommended, reactHooks.configs.recommended,
eslintConfigPrettier, eslintConfigPrettier,
]); ]);

View File

@@ -1,63 +1,63 @@
{ {
"name": "diplom", "name": "diplom",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "react-router build", "build": "react-router build",
"dev": "react-router dev", "dev": "react-router dev",
"start": "react-router-serve ./build/server/index.js", "start": "react-router-serve ./build/server/index.js",
"typecheck": "react-router typegen && tsc" "typecheck": "react-router typegen && tsc"
}, },
"dependencies": { "dependencies": {
"@hookform/resolvers": "^5.0.1", "@hookform/resolvers": "^5.0.1",
"@radix-ui/react-aspect-ratio": "^1.1.6", "@radix-ui/react-aspect-ratio": "^1.1.6",
"@radix-ui/react-avatar": "^1.1.9", "@radix-ui/react-avatar": "^1.1.9",
"@radix-ui/react-context-menu": "^2.2.14", "@radix-ui/react-context-menu": "^2.2.14",
"@radix-ui/react-dialog": "^1.1.13", "@radix-ui/react-dialog": "^1.1.13",
"@radix-ui/react-dropdown-menu": "^2.1.14", "@radix-ui/react-dropdown-menu": "^2.1.14",
"@radix-ui/react-label": "^2.1.6", "@radix-ui/react-label": "^2.1.6",
"@radix-ui/react-scroll-area": "^1.2.8", "@radix-ui/react-scroll-area": "^1.2.8",
"@radix-ui/react-select": "^2.2.4", "@radix-ui/react-select": "^2.2.4",
"@radix-ui/react-separator": "^1.1.6", "@radix-ui/react-separator": "^1.1.6",
"@radix-ui/react-slot": "^1.2.2", "@radix-ui/react-slot": "^1.2.2",
"@radix-ui/react-tabs": "^1.1.11", "@radix-ui/react-tabs": "^1.1.11",
"@radix-ui/react-tooltip": "^1.2.6", "@radix-ui/react-tooltip": "^1.2.6",
"@react-router/node": "^7.6.0", "@react-router/node": "^7.6.0",
"@react-router/serve": "^7.6.0", "@react-router/serve": "^7.6.0",
"@tanstack/react-query": "^5.76.1", "@tanstack/react-query": "^5.76.1",
"@yornaath/batshit": "^0.10.1", "@yornaath/batshit": "^0.10.1",
"axios": "^1.9.0", "axios": "^1.9.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"immer": "^10.1.1", "immer": "^10.1.1",
"isbot": "^5.1.28", "isbot": "^5.1.28",
"lucide-react": "^0.510.0", "lucide-react": "^0.510.0",
"react": "^19.1.0", "react": "^19.1.0",
"react-dom": "^19.1.0", "react-dom": "^19.1.0",
"react-hook-form": "^7.56.3", "react-hook-form": "^7.56.3",
"react-router": "^7.6.0", "react-router": "^7.6.0",
"tailwind-merge": "^3.3.0", "tailwind-merge": "^3.3.0",
"zod": "^3.24.4", "zod": "^3.24.4",
"zustand": "^5.0.4" "zustand": "^5.0.4"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.27.0", "@eslint/js": "^9.27.0",
"@react-router/dev": "^7.6.0", "@react-router/dev": "^7.6.0",
"@tailwindcss/vite": "^4.1.6", "@tailwindcss/vite": "^4.1.6",
"@types/node": "^22.15.18", "@types/node": "^22.15.18",
"@types/react": "^19.1.4", "@types/react": "^19.1.4",
"@types/react-dom": "^19.1.5", "@types/react-dom": "^19.1.5",
"eslint": "^9.27.0", "eslint": "^9.27.0",
"eslint-plugin-prettier": "5.4.0", "eslint-plugin-prettier": "5.4.0",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-hooks": "^5.2.0",
"globals": "^16.1.0", "globals": "^16.1.0",
"prettier": "3.5.3", "prettier": "3.5.3",
"tailwindcss": "^4.1.6", "tailwindcss": "^4.1.6",
"tw-animate-css": "^1.2.9", "tw-animate-css": "^1.2.9",
"typescript": "^5.8.3", "typescript": "^5.8.3",
"typescript-eslint": "^8.32.1", "typescript-eslint": "^8.32.1",
"vite": "^6.3.5", "vite": "^6.3.5",
"vite-tsconfig-paths": "^5.1.4" "vite-tsconfig-paths": "^5.1.4"
} }
} }

View File

@@ -1,7 +1,7 @@
import type { Config } from "@react-router/dev/config"; import type { Config } from "@react-router/dev/config";
export default { export default {
// Config options... // Config options...
// Server-side render by default, to enable SPA mode set this to `false` // Server-side render by default, to enable SPA mode set this to `false`
ssr: false, ssr: false,
} satisfies Config; } satisfies Config;

View File

@@ -1,27 +1,27 @@
{ {
"include": [ "include": [
"**/*", "**/*",
"**/.server/**/*", "**/.server/**/*",
"**/.client/**/*", "**/.client/**/*",
".react-router/types/**/*" ".react-router/types/**/*"
], ],
"compilerOptions": { "compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"], "lib": ["DOM", "DOM.Iterable", "ES2022"],
"types": ["node", "vite/client"], "types": ["node", "vite/client"],
"target": "ES2022", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
"moduleResolution": "bundler", "moduleResolution": "bundler",
"jsx": "react-jsx", "jsx": "react-jsx",
"rootDirs": [".", "./.react-router/types"], "rootDirs": [".", "./.react-router/types"],
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"~/*": ["./app/*"] "~/*": ["./app/*"]
}, },
"esModuleInterop": true, "esModuleInterop": true,
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,
"noEmit": true, "noEmit": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true, "skipLibCheck": true,
"strict": true "strict": true
} }
} }

View File

@@ -4,5 +4,5 @@ import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths"; import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({ export default defineConfig({
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()], plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
}); });