Skip to content

Commit

Permalink
add build tools node
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrrt committed Jan 6, 2025
1 parent 467c013 commit 5690f86
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 7 deletions.
5 changes: 3 additions & 2 deletions node/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NodeJS SDK
# Kadoa node SDK

## Get Started

Expand All @@ -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,
Expand Down
Binary file modified node/bun.lockb
Binary file not shown.
7 changes: 4 additions & 3 deletions node/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
}
}
13 changes: 13 additions & 0 deletions node/src/build.ts
Original file line number Diff line number Diff line change
@@ -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();
4 changes: 3 additions & 1 deletion node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -17,3 +17,5 @@ export class Kadoa {
return this._realtime;
}
}

export * from "./types";
2 changes: 1 addition & 1 deletion node/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface IKadoaProps {
export interface IKadoaProps {
apiKey?: string;
teamApiKey?: string;
}
1 change: 1 addition & 0 deletions node/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"paths": {
"*": ["src/*", "test/*"]
}
Expand Down

0 comments on commit 5690f86

Please sign in to comment.