fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #3551 from hey-api/refactor/dev-presets

refactor: remove plugins file

authored by

Lubos and committed by
GitHub
947860e4 13fcece7

+61 -103
-21
dev/python/plugins.ts
··· 1 - import type { UserConfig } from '@hey-api/openapi-python'; 2 - 3 - export type PluginConfig = NonNullable<NonNullable<UserConfig['plugins']>[number]>; 4 - 5 - export function sdk( 6 - options?: Omit<Extract<PluginConfig, { name: '@hey-api/python-sdk' }>, 'name'>, 7 - ): Extract<PluginConfig, { name: '@hey-api/python-sdk' }> { 8 - return { 9 - name: '@hey-api/python-sdk', 10 - ...options, 11 - }; 12 - } 13 - 14 - export function pydantic( 15 - options?: Omit<Extract<PluginConfig, { name: 'pydantic' }>, 'name'>, 16 - ): Extract<PluginConfig, { name: 'pydantic' }> { 17 - return { 18 - name: 'pydantic', 19 - ...options, 20 - }; 21 - }
+10 -7
dev/python/presets.ts
··· 1 - import type { PluginConfig } from './plugins'; 2 - import { pydantic, sdk } from './plugins'; 1 + import type { UserConfig } from '@hey-api/openapi-python'; 2 + 3 + export type PluginConfig = NonNullable<NonNullable<UserConfig['plugins']>[number]>; 3 4 4 5 export const presets = { 5 6 sdk: () => [ 6 7 /** SDK */ 7 - sdk({ 8 + { 9 + name: '@hey-api/python-sdk', 8 10 operations: { 9 11 containerName: 'OpenCode', 10 12 strategy: 'single', 11 13 }, 12 14 paramsStructure: 'flat', 13 - }), 15 + }, 14 16 ], 15 17 validated: () => [ 16 18 /** SDK + Pydantic validation */ 17 - sdk({ 19 + { 20 + name: '@hey-api/python-sdk', 18 21 paramsStructure: 'flat', 19 - }), 20 - pydantic(), 22 + }, 23 + 'pydantic', 21 24 ], 22 25 } as const satisfies Record<string, () => ReadonlyArray<PluginConfig>>; 23 26
-57
dev/typescript/plugins.ts
··· 1 - import type { UserConfig } from '@hey-api/openapi-ts'; 2 - 3 - export type PluginConfig = NonNullable<NonNullable<UserConfig['plugins']>[number]>; 4 - 5 - export function typescript( 6 - options?: Omit<Extract<PluginConfig, { name: '@hey-api/typescript' }>, 'name'>, 7 - ): Extract<PluginConfig, { name: '@hey-api/typescript' }> { 8 - return { 9 - name: '@hey-api/typescript', 10 - ...options, 11 - }; 12 - } 13 - 14 - export function sdk( 15 - options?: Omit<Extract<PluginConfig, { name: '@hey-api/sdk' }>, 'name'>, 16 - ): Extract<PluginConfig, { name: '@hey-api/sdk' }> { 17 - return { 18 - name: '@hey-api/sdk', 19 - ...options, 20 - }; 21 - } 22 - 23 - export function zod( 24 - options?: Omit<Extract<PluginConfig, { name: 'zod' }>, 'name'>, 25 - ): Extract<PluginConfig, { name: 'zod' }> { 26 - return { 27 - name: 'zod', 28 - ...options, 29 - }; 30 - } 31 - 32 - export function valibot( 33 - options?: Omit<Extract<PluginConfig, { name: 'valibot' }>, 'name'>, 34 - ): Extract<PluginConfig, { name: 'valibot' }> { 35 - return { 36 - name: 'valibot', 37 - ...options, 38 - }; 39 - } 40 - 41 - export function tanstackReactQuery( 42 - options?: Omit<Extract<PluginConfig, { name: '@tanstack/react-query' }>, 'name'>, 43 - ): Extract<PluginConfig, { name: '@tanstack/react-query' }> { 44 - return { 45 - name: '@tanstack/react-query', 46 - ...options, 47 - }; 48 - } 49 - 50 - export function transformers( 51 - options?: Omit<Extract<PluginConfig, { name: '@hey-api/transformers' }>, 'name'>, 52 - ): Extract<PluginConfig, { name: '@hey-api/transformers' }> { 53 - return { 54 - name: '@hey-api/transformers', 55 - ...options, 56 - }; 57 - }
+51 -18
dev/typescript/presets.ts
··· 1 - import type { PluginConfig } from './plugins'; 2 - import { sdk, tanstackReactQuery, transformers, typescript, valibot, zod } from './plugins'; 1 + import type { UserConfig } from '@hey-api/openapi-ts'; 2 + 3 + export type PluginConfig = NonNullable<NonNullable<UserConfig['plugins']>[number]>; 3 4 4 5 export const presets = { 6 + angular: () => [ 7 + { 8 + httpRequests: 'flat', 9 + name: '@angular/common', 10 + }, 11 + ], 5 12 full: () => [ 6 13 /** Full kitchen sink for comprehensive testing */ 7 - typescript(), 8 - sdk({ paramsStructure: 'flat' }), 9 - transformers(), 10 - zod({ metadata: true }), 11 - tanstackReactQuery({ queryKeys: { tags: true } }), 14 + '@hey-api/typescript', 15 + { 16 + name: '@hey-api/sdk', 17 + paramsStructure: 'flat', 18 + }, 19 + '@hey-api/transformers', 20 + { 21 + metadata: true, 22 + name: 'zod', 23 + }, 24 + { 25 + name: '@tanstack/react-query', 26 + queryKeys: { 27 + tags: true, 28 + }, 29 + }, 12 30 ], 13 31 sdk: () => [ 14 32 /** SDK with types */ 15 - typescript(), 16 - sdk({ 33 + '@hey-api/typescript', 34 + { 35 + name: '@hey-api/sdk', 17 36 operations: { 18 37 containerName: 'OpenCode', 19 38 strategy: 'single', 20 39 }, 21 40 paramsStructure: 'flat', 22 - }), 41 + }, 23 42 ], 24 43 tanstack: () => [ 25 44 /** SDK + TanStack Query */ 26 - typescript(), 27 - sdk(), 28 - tanstackReactQuery({ queryKeys: { tags: true } }), 45 + '@hey-api/typescript', 46 + '@hey-api/sdk', 47 + { 48 + name: '@tanstack/react-query', 49 + queryKeys: { 50 + tags: true, 51 + }, 52 + }, 29 53 ], 30 54 types: () => [ 31 55 /** Just types, nothing else */ 32 - typescript(), 56 + '@hey-api/typescript', 33 57 ], 34 58 validated: () => [ 35 59 /** SDK + Zod validation */ 36 - typescript(), 37 - sdk({ validator: 'zod' }), 38 - valibot({ metadata: true }), 39 - zod({ metadata: true }), 60 + '@hey-api/typescript', 61 + { 62 + name: '@hey-api/sdk', 63 + validator: 'zod', 64 + }, 65 + { 66 + metadata: true, 67 + name: 'valibot', 68 + }, 69 + { 70 + metadata: true, 71 + name: 'zod', 72 + }, 40 73 ], 41 74 } as const satisfies Record<string, () => ReadonlyArray<PluginConfig>>; 42 75