Skip to content

Commit 8dc842a

Browse files
committed
fix package types (#136)
* fix package types * update to 3.1.2
1 parent f0623cb commit 8dc842a

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

bun.lockb

309 Bytes
Binary file not shown.

package.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kilnfi/sdk",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"autor": "Kiln <[email protected]> (https://kiln.fi)",
55
"license": "BUSL-1.1",
66
"description": "JavaScript sdk for Kiln API",
@@ -9,19 +9,25 @@
99
"module": "./build/esm/index.js",
1010
"types": "./build/types/index.d.ts",
1111
"typings": "./build/types/index.d.ts",
12+
"sideEffects": false,
1213
"exports": {
1314
".": {
14-
"default": "./build/cjs/kiln.js",
1515
"types": "./build/types/kiln.d.ts",
16-
"import": "./build/esm/kiln.js"
16+
"import": "./build/esm/kiln.js",
17+
"default": "./build/cjs/kiln.js"
1718
}
1819
},
20+
"files": [
21+
"*",
22+
"!tsconfig.build.json"
23+
],
1924
"scripts": {
2025
"lint": "biome check ./src",
2126
"format": "biome check ./src --write --unsafe",
2227
"build": "bun run build:esm && bun run build:cjs && bun run build:types",
23-
"build:esm": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./build/esm",
24-
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./build/cjs --removeComments --verbatimModuleSyntax false",
28+
"prepublishOnly": "bun scripts/prepublishOnly.ts",
29+
"build:esm": "tsc --project ./tsconfig.build.json --module es2020 --outDir ./build/esm && printf '{\"type\":\"commonjs\"}' > ./build/esm/package.json",
30+
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./build/cjs --removeComments --verbatimModuleSyntax false && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./build/cjs/package.json",
2531
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./build/types --emitDeclarationOnly --declaration --declarationMap"
2632
},
2733
"keywords": [
@@ -39,9 +45,10 @@
3945
},
4046
"homepage": "https://github.com/kilnfi/sdk-js#readme",
4147
"dependencies": {
48+
"@types/bun": "^1.1.11",
4249
"fireblocks-sdk": "^4.2.0",
4350
"openapi-fetch": "^0.12.0",
44-
"viem": "^1.21.4"
51+
"viem": "^2.21.29"
4552
},
4653
"devDependencies": {
4754
"@biomejs/biome": "^1.9.1",

scripts/prepublishOnly.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { join } from 'node:path'
2+
3+
const packageJsonPath = join(import.meta.dir, '../package.json')
4+
const packageJson = await Bun.file(packageJsonPath).json()
5+
6+
// NOTE: We explicitly don't want to publish the type field.
7+
// We create a separate package.json for `build/cjs` and `build/esm` that has the type field.
8+
packageJson.type = undefined
9+
10+
Bun.write(packageJsonPath, JSON.stringify(packageJson, null, 2))

0 commit comments

Comments
 (0)