Something went wrong. Try again.
fork of hey-api/openapi-ts because I need some additional things
Something went wrong. Try again.
1.2 kB · 42 lines
TypeScript
12345678910111213141516171819202122232425262728293031323334353637383940414243import fs from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';
import { defineConfig } from 'tsdown';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({ clean: true, dts: true, entry: ['./src/{index,run}.ts'], format: ['esm'], minify: false, onSuccess: async () => { // Copy client files to dist folder for runtime access const pluginNames = ['client-httpx'];
for (const pluginName of pluginNames) { const srcPath = path.resolve(__dirname, 'src', 'plugins', '@hey-api', pluginName, 'bundle'); const destPath = path.resolve( __dirname, 'dist', 'clients', pluginName.slice('client-'.length), );
if (fs.existsSync(srcPath)) { fs.mkdirSync(path.dirname(destPath), { recursive: true }); fs.cpSync(srcPath, destPath, { recursive: true });
// replace core imports in client bundle // const clientFiles = fs.readdirSync(destPath); // for (const file of clientFiles) { // replaceCoreImports(path.resolve(destPath, file)); // } } } }, sourcemap: true, treeshake: true,});