From 74f7cc766415d7ec9e3c949cc91cca0d50d9c3ea Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 5 Aug 2025 17:48:33 +0300 Subject: [PATCH] feat: add hey-api configuration and update OpenAPI TypeScript plugin settings --- .prettierrc.mjs | 35 ----------------------------------- openapi-ts.config.ts | 20 ++++++++++++++++++-- src/hey-api-config.ts | 6 ++++++ 3 files changed, 24 insertions(+), 37 deletions(-) delete mode 100644 .prettierrc.mjs create mode 100644 src/hey-api-config.ts diff --git a/.prettierrc.mjs b/.prettierrc.mjs deleted file mode 100644 index 31e43b8..0000000 --- a/.prettierrc.mjs +++ /dev/null @@ -1,35 +0,0 @@ -/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */ -const config = { - printWidth: 100, - singleQuote: true, - trailingComma: 'es5', - plugins: ['@ianvs/prettier-plugin-sort-imports'], - importOrder: [ - '.*styles.css$', - '', - 'dayjs', - '^react$', - '^next$', - '^next/.*$', - '', - '', - '^@mantine/(.*)$', - '^@mantinex/(.*)$', - '^@mantine-tests/(.*)$', - '^@docs/(.*)$', - '^@/.*$', - '^../(?!.*.css$).*$', - '^./(?!.*.css$).*$', - '\\.css$', - ], - overrides: [ - { - files: '*.mdx', - options: { - printWidth: 70, - }, - }, - ], -}; - -export default config; \ No newline at end of file diff --git a/openapi-ts.config.ts b/openapi-ts.config.ts index 31d3124..2def71a 100644 --- a/openapi-ts.config.ts +++ b/openapi-ts.config.ts @@ -3,10 +3,26 @@ import { defineConfig } from "@hey-api/openapi-ts"; export default defineConfig({ input: "http://localhost:8000/openapi.json", output: "src/client", + plugins: [ "@hey-api/client-axios", - "@hey-api/client-next", "@tanstack/react-query", - "zod" + "@hey-api/typescript", + { + name: "zod", + requests: true, + responses: true, + definitions: true, + metadata: true, + }, + { + name: "@hey-api/sdk", + asClass: false, + validator: "zod", + }, + { + name: "@hey-api/client-next", + runtimeConfigPath: "./src/hey-api-config.ts", + }, ], }); diff --git a/src/hey-api-config.ts b/src/hey-api-config.ts new file mode 100644 index 0000000..39a01e6 --- /dev/null +++ b/src/hey-api-config.ts @@ -0,0 +1,6 @@ +import type { CreateClientConfig } from './client/client.gen'; + +export const createClientConfig: CreateClientConfig = (config) => ({ + ...config, + baseUrl: 'http://crm.logidex.ru/api', +}); \ No newline at end of file