Skip to content

Commit

Permalink
adjust build to commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrrt committed Jan 6, 2025
1 parent be4a9ec commit 7a6d526
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
Binary file modified node/bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions node/package.json
Original file line number Diff line number Diff line change
@@ -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",
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 src/build.ts"
"compile": "bun clean && bun tsup src/index.ts"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^22.10.5",
"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"
}
Expand Down
13 changes: 0 additions & 13 deletions node/src/build.ts

This file was deleted.

2 changes: 1 addition & 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) {
constructor(props: { apiKey?: string; teamApiKey?: string }) {
if (!props.apiKey && !props.teamApiKey) {
throw new Error("apiKey or teamApiKey must be passed");
}
Expand Down
19 changes: 12 additions & 7 deletions node/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"]
}
11 changes: 11 additions & 0 deletions node/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -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
});

0 comments on commit 7a6d526

Please sign in to comment.