diff --git a/dev/python/plugins.ts b/dev/python/plugins.ts deleted file mode 100644 index d9caecd3e..000000000 --- a/dev/python/plugins.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { UserConfig } from '@hey-api/openapi-python'; - -export type PluginConfig = NonNullable[number]>; - -export function sdk( - options?: Omit, 'name'>, -): Extract { - return { - name: '@hey-api/python-sdk', - ...options, - }; -} - -export function pydantic( - options?: Omit, 'name'>, -): Extract { - return { - name: 'pydantic', - ...options, - }; -} diff --git a/dev/python/presets.ts b/dev/python/presets.ts index 1ccdc10c8..1a7500a4f 100644 --- a/dev/python/presets.ts +++ b/dev/python/presets.ts @@ -1,23 +1,26 @@ -import type { PluginConfig } from './plugins'; -import { pydantic, sdk } from './plugins'; +import type { UserConfig } from '@hey-api/openapi-python'; + +export type PluginConfig = NonNullable[number]>; export const presets = { sdk: () => [ /** SDK */ - sdk({ + { + name: '@hey-api/python-sdk', operations: { containerName: 'OpenCode', strategy: 'single', }, paramsStructure: 'flat', - }), + }, ], validated: () => [ /** SDK + Pydantic validation */ - sdk({ + { + name: '@hey-api/python-sdk', paramsStructure: 'flat', - }), - pydantic(), + }, + 'pydantic', ], } as const satisfies Record ReadonlyArray>; diff --git a/dev/typescript/plugins.ts b/dev/typescript/plugins.ts deleted file mode 100644 index 9554fea6b..000000000 --- a/dev/typescript/plugins.ts +++ /dev/null @@ -1,57 +0,0 @@ -import type { UserConfig } from '@hey-api/openapi-ts'; - -export type PluginConfig = NonNullable[number]>; - -export function typescript( - options?: Omit, 'name'>, -): Extract { - return { - name: '@hey-api/typescript', - ...options, - }; -} - -export function sdk( - options?: Omit, 'name'>, -): Extract { - return { - name: '@hey-api/sdk', - ...options, - }; -} - -export function zod( - options?: Omit, 'name'>, -): Extract { - return { - name: 'zod', - ...options, - }; -} - -export function valibot( - options?: Omit, 'name'>, -): Extract { - return { - name: 'valibot', - ...options, - }; -} - -export function tanstackReactQuery( - options?: Omit, 'name'>, -): Extract { - return { - name: '@tanstack/react-query', - ...options, - }; -} - -export function transformers( - options?: Omit, 'name'>, -): Extract { - return { - name: '@hey-api/transformers', - ...options, - }; -} diff --git a/dev/typescript/presets.ts b/dev/typescript/presets.ts index 6ca9bda5e..1381fc53d 100644 --- a/dev/typescript/presets.ts +++ b/dev/typescript/presets.ts @@ -1,42 +1,75 @@ -import type { PluginConfig } from './plugins'; -import { sdk, tanstackReactQuery, transformers, typescript, valibot, zod } from './plugins'; +import type { UserConfig } from '@hey-api/openapi-ts'; + +export type PluginConfig = NonNullable[number]>; export const presets = { + angular: () => [ + { + httpRequests: 'flat', + name: '@angular/common', + }, + ], full: () => [ /** Full kitchen sink for comprehensive testing */ - typescript(), - sdk({ paramsStructure: 'flat' }), - transformers(), - zod({ metadata: true }), - tanstackReactQuery({ queryKeys: { tags: true } }), + '@hey-api/typescript', + { + name: '@hey-api/sdk', + paramsStructure: 'flat', + }, + '@hey-api/transformers', + { + metadata: true, + name: 'zod', + }, + { + name: '@tanstack/react-query', + queryKeys: { + tags: true, + }, + }, ], sdk: () => [ /** SDK with types */ - typescript(), - sdk({ + '@hey-api/typescript', + { + name: '@hey-api/sdk', operations: { containerName: 'OpenCode', strategy: 'single', }, paramsStructure: 'flat', - }), + }, ], tanstack: () => [ /** SDK + TanStack Query */ - typescript(), - sdk(), - tanstackReactQuery({ queryKeys: { tags: true } }), + '@hey-api/typescript', + '@hey-api/sdk', + { + name: '@tanstack/react-query', + queryKeys: { + tags: true, + }, + }, ], types: () => [ /** Just types, nothing else */ - typescript(), + '@hey-api/typescript', ], validated: () => [ /** SDK + Zod validation */ - typescript(), - sdk({ validator: 'zod' }), - valibot({ metadata: true }), - zod({ metadata: true }), + '@hey-api/typescript', + { + name: '@hey-api/sdk', + validator: 'zod', + }, + { + metadata: true, + name: 'valibot', + }, + { + metadata: true, + name: 'zod', + }, ], } as const satisfies Record ReadonlyArray>;