mirror of
https://github.com/nestriness/nestri.git
synced 2026-08-02 01:35:18 +03:00
feat: Add sdk openapi generators
This commit is contained in:
40
packages/sdk/script/build.ts
Executable file
40
packages/sdk/script/build.ts
Executable file
@@ -0,0 +1,40 @@
|
||||
#! /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`;
|
||||
Reference in New Issue
Block a user