Skip to content

Commit

Permalink
clean up and fix sdk bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidarain1 committed Dec 5, 2024
1 parent 5d73bda commit 37a6202
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 42 deletions.
2 changes: 1 addition & 1 deletion packages/blockchain-data/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/checkout/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ./tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"build:dev": "CHECKOUT_DEV_MODE=true pnpm build",
"docs": "typedoc --plugin typedoc-plugin-markdown --skipErrorChecking --disableSources --out docs src/index.ts",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
Expand Down
2 changes: 1 addition & 1 deletion packages/checkout/widgets-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ./tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"build:local": "pnpm build && mkdir -p ../widgets-sample-app/public/lib/js && cp dist/*.js ../widgets-sample-app/public/lib/js/",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"lint:fix": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0 --fix",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/bridge/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts --max-warnings=0",
"lint:fix": "cd ../../../../ && pnpm wsrun -p @imtbl/bridge-sdk -c lint --fix",
"test": "jest test -- --silent=false",
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/cryptofiat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0 --fix",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/dex/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"generate-types": "typechain --target ethers-v5 --out-dir ./src/contracts/types ./src/contracts/ABIs/*.json",
"lint": "eslint ./src --ext .ts --max-warnings=0",
"lint:fix": "cd ../../../.. && pnpm wsrun -p @imtbl/dex-sdk -c lint --fix",
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/generated-clients/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"test": "jest",
"test:watch": "jest --watch",
"typecheck": "tsc --customConditions default --noEmit --jsx preserve",
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/minting-backend/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ./tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"test": "jest --passWithNoTests",
"test:watch": "jest --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/orderbook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"generate-types": "typechain --target=ethers-v5 --out-dir=src/typechain/types 'abi/*.json'",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"lint:fix": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0 --fix",
Expand Down
2 changes: 1 addition & 1 deletion packages/passport/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/webhook/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ./tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"test": "jest --passWithNoTests",
"test:watch": "jest --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/x-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/x-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup src/index.ts --config ../../tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
3 changes: 2 additions & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@
"license": "Apache-2.0",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"browser": "./dist/index.browser.js",
"repository": "immutable/ts-immutable-sdk.git",
"scripts": {
"build": "pnpm transpile && pnpm typegen",
"transpile": "tsup --config ./tsup.config.js",
"typegen": "tsc --customConditions default --emitDeclarationOnly",
"typegen": "tsc --customConditions default --emitDeclarationOnly",
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
"typecheck": "tsc --customConditions default --noEmit --jsx preserve"
},
Expand Down
36 changes: 10 additions & 26 deletions sdk/tsup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,27 @@ export default defineConfig((options) => {
}

return [
// Node Bundle for CommonJS and ESM
// Node & Browser Bundle for ESM
{
entry: ['src', '!src/index.browser.ts'],
entry: ['src'],
outDir: 'dist',
platform: 'node',
format: ['esm', 'cjs'],
format: 'esm',
target: 'es2022',
bundle: false,
treeshake: true,
minify: false,
esbuildPlugins: [
replace({
'__SDK_VERSION__': pkg.version,
})
]
},

// Browser Bundle for ESM
// Node Bundle for CJS
{
entry: ['src/index.browser.ts'],
entry: ['src', '!src/index.browser.ts'],
outDir: 'dist',
platform: 'browser',
format: 'esm',
platform: 'node',
format: 'cjs',
target: 'es2022',
bundle: false,
bundle: true,
treeshake: true,
minify: false,
esbuildPlugins: [
nodeModulesPolyfillPlugin({
globals: {
Buffer: true,
process: true,
},
modules: ['crypto', 'buffer', 'process', 'http']
}),
replace({
'__SDK_VERSION__': pkg.version,
})
]
},

// Browser Bundle for CDN
Expand Down

0 comments on commit 37a6202

Please sign in to comment.