fork of hey-api/openapi-ts because I need some additional things
1import path from 'node:path';
2import { fileURLToPath } from 'node:url';
3
4import { type UserConfig } from '@hey-api/openapi-python';
5
6const __filename = fileURLToPath(import.meta.url);
7const __dirname = path.dirname(__filename);
8
9export const createSdkConfig =
10 ({ outputDir }: { outputDir: string }) =>
11 (userConfig: UserConfig) =>
12 ({
13 ...userConfig,
14 logs: {
15 level: 'silent',
16 path: './logs',
17 },
18 output:
19 typeof userConfig.output === 'string'
20 ? path.join(outputDir, userConfig.output)
21 : {
22 ...userConfig.output,
23 path: path.join(
24 outputDir,
25 userConfig.output instanceof Array ? '' : userConfig.output.path,
26 ),
27 },
28 }) as const satisfies UserConfig;
29
30export const getSnapshotsPath = (): string => path.join(__dirname, '..', '__snapshots__');
31
32export const getTempSnapshotsPath = (): string => path.join(__dirname, '..', '.gen', 'snapshots');