diff --git a/node/bun.lockb b/node/bun.lockb index 2773914..7ca0e7f 100755 Binary files a/node/bun.lockb and b/node/bun.lockb differ diff --git a/node/package.json b/node/package.json index bbead6c..e133cfa 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "@kadoa/node", - "version": "0.0.3", + "version": "0.0.4", "source": "src/index.ts", "main": "dist/index.js", "module": "dist/index.js", @@ -13,7 +13,7 @@ "format": "prettier --config .prettierrc.json --write \"**/*.{ts,md}\"", "type-check": "tsc", "clean": "rm -rf dist", - "compile": "bun clean && bun src/build.ts" + "compile": "bun clean && bun tsup src/index.ts" }, "dependencies": {}, "devDependencies": { @@ -21,6 +21,7 @@ "bun-plugin-dts": "^0.3.0", "dotenv": "^16.4.7", "prettier": "^3.4.2", + "tsup": "^8.3.5", "typescript": "^5.7.2", "vitest": "^2.1.8" } diff --git a/node/src/build.ts b/node/src/build.ts deleted file mode 100644 index 6ff3177..0000000 --- a/node/src/build.ts +++ /dev/null @@ -1,13 +0,0 @@ -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 d72f06c..58ae676 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) { + constructor(props: { apiKey?: string; teamApiKey?: string }) { if (!props.apiKey && !props.teamApiKey) { throw new Error("apiKey or teamApiKey must be passed"); } diff --git a/node/tsconfig.json b/node/tsconfig.json index 7727cd9..6db5188 100644 --- a/node/tsconfig.json +++ b/node/tsconfig.json @@ -1,9 +1,14 @@ { "compilerOptions": { - "baseUrl": ".", - "declaration": true, - "paths": { - "*": ["src/*", "test/*"] - } - } -} + "target": "ES2020", + "module": "ESNext", + "declaration": true, + "declarationDir": "dist/types", + "emitDeclarationOnly": true, + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "dist"] + } \ No newline at end of file diff --git a/node/tsup.config.ts b/node/tsup.config.ts new file mode 100644 index 0000000..195e103 --- /dev/null +++ b/node/tsup.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/index.ts'], + format: ['esm', 'cjs'], // Output both ESM and CommonJS + dts: true, // Generate .d.ts files + splitting: false, + sourcemap: true, + clean: true, + target: 'node16' // Ensure Node.js compatibility +}); \ No newline at end of file