Skip to content

Commit cccc86c

Browse files
authored
Merge pull request #174 from fireflyprotocol/lucas/build-esm-cjs
Build both ESM and CJS files
2 parents afca967 + 831d756 commit cccc86c

File tree

7 files changed

+138
-877
lines changed

7 files changed

+138
-877
lines changed

ts/sdk/package.json

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bluefin-exchange/pro-sdk",
3-
"version": "0.1.62",
3+
"version": "0.2.0",
44
"description": "OpenAPI client for @bluefin-exchange/pro-sdk",
55
"author": "Bluefin",
66
"repository": {
@@ -11,29 +11,43 @@
1111
"@fireflyprotocol/pro-sdk"
1212
],
1313
"license": "Unlicense",
14-
"main": "./dist/index.js",
15-
"typings": "./dist/index.d.ts",
14+
"main": "./dist/cjs/index.js",
15+
"module": "./dist/esm/index.js",
16+
"types": "./dist/types/index.d.ts",
1617
"scripts": {
17-
"build": "tsc",
18+
"build:types": "tsc -p tsconfig.types.json",
19+
"build:esm": "tsc -p tsconfig.esm.json",
20+
"build:cjs": "tsc -p tsconfig.cjs.json",
21+
"build": "npm run build:types && npm run build:esm && npm run build:cjs",
22+
"clean": "rm -rf dist",
1823
"prepare": "npm run build"
1924
},
2025
"dependencies": {
21-
"@firefly-exchange/library-sui": "^2.6.10",
26+
"@firefly-exchange/library-sui": "^2.8.13",
2227
"@mysten/bcs": "^1.2.1",
23-
"@mysten/sui": "^1.28.2",
2428
"@noble/hashes": "^1.7.0",
2529
"@types/ws": "^8.5.13",
2630
"axios": "^1.6.1",
2731
"isomorphic-ws": "^5.0.0",
2832
"ws": "^8.18.0"
2933
},
34+
"peerDependencies": {
35+
"@mysten/sui": "^1.28.2"
36+
},
3037
"devDependencies": {
3138
"@types/node": "^22.10.7",
3239
"typescript": "^4.0 || ^5.0"
3340
},
3441
"exports": {
35-
".": "./src/index.ts"
42+
".": {
43+
"types": "./dist/types/index.d.ts",
44+
"import": "./dist/esm/index.js",
45+
"require": "./dist/cjs/index.js"
46+
}
3647
},
48+
"files": [
49+
"dist/"
50+
],
3751
"publishConfig": {
3852
"access": "public"
3953
},

ts/sdk/src/sdk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
import { Configuration } from './configuration';
3030
import { IBluefinSigner } from './request-signer';
3131
import { WebSocket } from 'ws';
32-
import { IAsset, TxBuilder } from '@firefly-exchange/library-sui/dist/src/v3';
32+
import { IAsset, TxBuilder } from '@firefly-exchange/library-sui/v3';
3333
import {
3434
CoinUtils,
3535
SuiClient,

ts/sdk/tsconfig.json renamed to ts/sdk/tsconfig.base.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
22
"compilerOptions": {
3-
"declaration": true,
43
"target": "ES6",
5-
"module": "commonjs",
64
"noImplicitAny": true,
7-
"outDir": "dist",
85
"rootDir": ".",
96
"skipLibCheck": true,
107
"lib": [
@@ -15,6 +12,9 @@
1512
"node_modules/@types"
1613
],
1714
"strict": true,
15+
"sourceMap": true,
16+
"esModuleInterop": true,
17+
"allowSyntheticDefaultImports": true
1818
},
1919
"exclude": [
2020
"dist",

ts/sdk/tsconfig.cjs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"module": "CommonJS",
5+
"moduleResolution": "Node",
6+
"outDir": "dist/cjs",
7+
"paths": {
8+
"@firefly-exchange/library-sui/v3": [
9+
"./node_modules/@firefly-exchange/library-sui/dist/src/v3"
10+
]
11+
},
12+
}
13+
}

ts/sdk/tsconfig.esm.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"module": "NodeNext",
5+
"moduleResolution": "NodeNext",
6+
"outDir": "dist/esm"
7+
}
8+
}

ts/sdk/tsconfig.types.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"emitDeclarationOnly": true,
6+
"declarationMap": true,
7+
"outDir": "dist/types",
8+
"module": "commonjs",
9+
"paths": {
10+
"@firefly-exchange/library-sui/v3": [
11+
"./node_modules/@firefly-exchange/library-sui/dist/src/v3"
12+
]
13+
},
14+
}
15+
}

0 commit comments

Comments
 (0)