Skip to content

Commit

Permalink
feat(klesia): add build and start
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Sep 2, 2024
1 parent e25fd52 commit 8d932ac
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 22 deletions.
5 changes: 4 additions & 1 deletion apps/klesia/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "@mina-js/klesia",
"type": "module",
"scripts": {
"dev": "bun run --hot src/index.ts"
"build": "tsc --noEmit && bun build src/index.ts --outdir dist",
"dev": "bun run --hot src/index.ts",
"start": "bun dist/index.js"
},
"dependencies": {
"@hono/zod-openapi": "^0.16.0",
Expand Down
3 changes: 3 additions & 0 deletions apps/klesia/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
import { apiReference } from "@scalar/hono-api-reference";
import { logger } from "hono/logger";
import { match } from "ts-pattern";
import { mina } from "./methods/mina";
import { RpcMethodSchema, RpcResponseSchema } from "./schema";
import { buildResponse } from "./utils/build-response";

const api = new OpenAPIHono();

api.use(logger());

api.doc("/api/openapi", {
openapi: "3.0.0",
info: {
Expand Down
13 changes: 9 additions & 4 deletions apps/klesia/src/utils/node.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { Client, cacheExchange, fetchExchange } from "@urql/core";
import { match } from "ts-pattern";
import { z } from "zod";

const MINA_NETWORK = process.env.MINA_NETWORK;
const NetworkMatcher = z.enum(["devnet", "mainnet"]);

const MINA_NETWORK = NetworkMatcher.parse(process.env.MINA_NETWORK);
const NODE_API_DEVNET = z.string().parse(process.env.NODE_API_DEVNET);
const NODE_API_MAINNET = z.string().parse(process.env.NODE_API_MAINNET);

export const getNodeApiUrl = () => {
return match(MINA_NETWORK)
.with("devnet", () => process.env.NODE_API_DEVNET)
.with("mainnet", () => process.env.NODE_API_MAINNET)
.run();
.with("devnet", () => NODE_API_DEVNET)
.with("mainnet", () => NODE_API_MAINNET)
.exhaustive();
};

export const getNodeClient = () => {
Expand Down
4 changes: 3 additions & 1 deletion apps/klesia/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "@tsconfig/bun/tsconfig.json",
"compilerOptions": {
"strict": true,
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx"
"jsxImportSource": "hono/jsx",
"noPropertyAccessFromIndexSignature": false
}
}
6 changes: 3 additions & 3 deletions packages/accounts/.turbo/turbo-build.log
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
CJS Build start
CJS dist/index.js 2.25 KB
CJS dist/index.js.map 1.44 KB
CJS ⚡️ Build success in 8ms
CJS ⚡️ Build success in 6ms
ESM dist/index.mjs 575.00 B
ESM dist/index.mjs.map 1.35 KB
ESM ⚡️ Build success in 8ms
ESM ⚡️ Build success in 7ms
DTS Build start
DTS ⚡️ Build success in 499ms
DTS ⚡️ Build success in 516ms
DTS dist/index.d.mts 631.00 B
DTS dist/index.d.ts 631.00 B
6 changes: 3 additions & 3 deletions packages/connect/.turbo/turbo-build.log
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
CJS Build start
CJS dist/index.js 3.07 KB
CJS dist/index.js.map 6.11 KB
CJS ⚡️ Build success in 7ms
CJS ⚡️ Build success in 5ms
ESM dist/index.mjs 1.99 KB
ESM dist/index.mjs.map 5.61 KB
ESM ⚡️ Build success in 7ms
ESM ⚡️ Build success in 6ms
DTS Build start
DTS ⚡️ Build success in 574ms
DTS ⚡️ Build success in 594ms
DTS dist/index.d.mts 2.51 KB
DTS dist/index.d.ts 2.51 KB
10 changes: 5 additions & 5 deletions packages/providers/.turbo/turbo-build.log
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
CJS Build start
ESM dist/index.js 1.52 KB
ESM dist/index.js.map 3.07 KB
ESM ⚡️ Build success in 7ms
ESM ⚡️ Build success in 6ms
CJS dist/index.cjs 3.40 KB
CJS dist/index.cjs.map 3.24 KB
CJS ⚡️ Build success in 7ms
CJS ⚡️ Build success in 6ms
DTS Build start
DTS ⚡️ Build success in 670ms
DTS dist/index.d.ts 12.32 KB
DTS dist/index.d.cts 12.32 KB
DTS ⚡️ Build success in 643ms
DTS dist/index.d.ts 12.33 KB
DTS dist/index.d.cts 12.33 KB
10 changes: 5 additions & 5 deletions packages/shared/.turbo/turbo-build.log
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
CLI Cleaning output folder
ESM Build start
CJS Build start
ESM dist/index.js 2.33 KB
ESM dist/index.js.map 4.16 KB
ESM ⚡️ Build success in 7ms
CJS dist/index.cjs 4.62 KB
CJS dist/index.cjs.map 4.36 KB
CJS ⚡️ Build success in 7ms
CJS ⚡️ Build success in 6ms
ESM dist/index.js 2.33 KB
ESM dist/index.js.map 4.16 KB
ESM ⚡️ Build success in 6ms
DTS Build start
DTS ⚡️ Build success in 728ms
DTS ⚡️ Build success in 719ms
DTS dist/index.d.ts 11.44 KB
DTS dist/index.d.cts 11.44 KB

0 comments on commit 8d932ac

Please sign in to comment.