Files
netris-nestri/packages/sdk/script/build.ts
2025-11-05 13:23:59 +03:00

41 lines
860 B
TypeScript
Executable File

#! /usr/bin/env bun
const dir = new URL("..", import.meta.url).pathname;
process.chdir(dir);
import path from "path";
import { $ } from "bun";
import { Api } from "@nestri/function/api/index";
import { createClient } from "@hey-api/openapi-ts";
await $`rm -rf src/gen`;
const schema = await Api.generate();
await createClient({
input: schema,
output: {
path: "./src/gen",
tsConfigPath: path.join(dir, "tsconfig.json"),
},
plugins: [
{
name: "@hey-api/typescript",
exportFromIndex: false,
},
{
name: "@hey-api/sdk",
instance: "NestriApi",
// exportFromIndex: false,
auth: true,
},
{
name: "@hey-api/client-fetch",
exportFromIndex: false,
baseUrl: "http://localhost:4096",
},
],
});
await $`bun prettier --write src/gen`;
await $`rm -rf dist`;
await $`bun tsc`;