import { resolve } from 'node:path'
import * as process from 'node:process'
import glob from 'tiny-glob'
import type { SafeRpcConfiguration } from './opss-type'
const dirname = process.cwd()
// noinspection JSUnusedGlobalSymbols
export async function config(): Promise<SafeRpcConfiguration> {
const nestControllers = await glob('examples/nest/**/*controller.ts', {
absolute: true,
})
return {
openapiPath: resolve(dirname, 'openapi'),
serviceGroups: [
{
serviceName: 'opss-hono',
entryFiles: [
{
filePath: resolve(dirname, 'examples/hono/hono.ts'),
routePrefix: '/api',
},
],
sharePaths: {
'hono-shard.ts': resolve(dirname, 'examples/hono/hono.pub.ts'),
},
framework: 'hono' as 'nest',
},
{
serviceName: 'opss-itty',
entryFiles: [
resolve(dirname, 'examples/itty/itty.ts'),
],
sharePaths: {
'itty-shard.ts': resolve(dirname, 'examples/itty/itty.pub.ts'),
},
framework: 'itty' as 'nest',
},
{
serviceName: 'opss-nest',
entryFiles: nestControllers,
framework: 'nest',
},
],
}
}