diff --git a/node/README.md b/node/README.md index 2bd4db1..4ba4590 100644 --- a/node/README.md +++ b/node/README.md @@ -1,4 +1,4 @@ -# NodeJS SDK +# Kadoa node SDK ## Get Started @@ -11,7 +11,8 @@ It is recommended to store Kadoa credentials in an `.env` file and use a library ```typescript import dotenv from 'dotenv'; dotenv.config(); -import { Kadoa, IKadoaProps } from '@kadoa/node'; +import { Kadoa } from '@kadoa/node'; +import type {IKadoaProps} from '@kadoa/node'; const kadoaProps: IKadoaProps = { teamApiKey: process.env.KADOA_TEAM_API_KEY, diff --git a/node/bun.lockb b/node/bun.lockb index d6e5567..2773914 100755 Binary files a/node/bun.lockb and b/node/bun.lockb differ diff --git a/node/package.json b/node/package.json index 41a115e..bbead6c 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "@kadoa/node", - "version": "0.0.1", + "version": "0.0.3", "source": "src/index.ts", "main": "dist/index.js", "module": "dist/index.js", @@ -13,14 +13,15 @@ "format": "prettier --config .prettierrc.json --write \"**/*.{ts,md}\"", "type-check": "tsc", "clean": "rm -rf dist", - "compile": "bun clean && bun build src/index.ts --outdir dist --minify" + "compile": "bun clean && bun src/build.ts" }, "dependencies": {}, "devDependencies": { - "@types/bun": "^1.1.14", "@types/node": "^22.10.5", + "bun-plugin-dts": "^0.3.0", "dotenv": "^16.4.7", "prettier": "^3.4.2", + "typescript": "^5.7.2", "vitest": "^2.1.8" } } \ No newline at end of file diff --git a/node/src/build.ts b/node/src/build.ts new file mode 100644 index 0000000..6ff3177 --- /dev/null +++ b/node/src/build.ts @@ -0,0 +1,13 @@ +import dts from 'bun-plugin-dts'; + +const compile = async () => { + // @ts-ignore + await Bun.build({ + entrypoints: ['./src/index.ts'], + outdir: './dist', + plugins: [ + dts() + ], + }) +} +compile(); \ No newline at end of file diff --git a/node/src/index.ts b/node/src/index.ts index 491c6d5..d72f06c 100644 --- a/node/src/index.ts +++ b/node/src/index.ts @@ -3,7 +3,7 @@ export class Kadoa { private teamApiKey?: string; private _realtime?: Realtime; - constructor(props: IKadoaProps) { + constructor(props) { if (!props.apiKey && !props.teamApiKey) { throw new Error("apiKey or teamApiKey must be passed"); } @@ -17,3 +17,5 @@ export class Kadoa { return this._realtime; } } + +export * from "./types"; \ No newline at end of file diff --git a/node/src/types.ts b/node/src/types.ts index 201e119..5a7f89c 100644 --- a/node/src/types.ts +++ b/node/src/types.ts @@ -1,4 +1,4 @@ -interface IKadoaProps { +export interface IKadoaProps { apiKey?: string; teamApiKey?: string; } diff --git a/node/tsconfig.json b/node/tsconfig.json index 3eaf40b..7727cd9 100644 --- a/node/tsconfig.json +++ b/node/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "baseUrl": ".", + "declaration": true, "paths": { "*": ["src/*", "test/*"] }