mirror of
https://github.com/nestriness/nestri.git
synced 2026-08-02 01:35:18 +03:00
41 lines
860 B
TypeScript
Executable File
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`;
|