diff --git a/sdks/uniswapx-sdk/.eslintrc.json b/sdks/uniswapx-sdk/.eslintrc.json index e269c36f9..ff53fcae3 100644 --- a/sdks/uniswapx-sdk/.eslintrc.json +++ b/sdks/uniswapx-sdk/.eslintrc.json @@ -1,7 +1,7 @@ { "parser": "@typescript-eslint/parser", "parserOptions": { - "project": "./tsconfig.json" + "project": "./tsconfig.base.json" }, "env": { "es6": true @@ -60,4 +60,4 @@ "always-multiline" ] } -} \ No newline at end of file +} diff --git a/sdks/uniswapx-sdk/integration/package.json b/sdks/uniswapx-sdk/integration/package.json index 976c495f1..4205b6572 100644 --- a/sdks/uniswapx-sdk/integration/package.json +++ b/sdks/uniswapx-sdk/integration/package.json @@ -24,8 +24,7 @@ "chai": "^4.3.6", "hardhat": "^2.22.15", "husky": "^8.0.3", - "ts-node": "^10.9.1", - "tsdx": "^0.14.1" + "ts-node": "^10.9.1" }, "dependencies": { "@ethersproject/bytes": "^5.7.0", diff --git a/sdks/uniswapx-sdk/integration/test/PriorityOrder.spec.ts b/sdks/uniswapx-sdk/integration/test/PriorityOrder.spec.ts index 065c0009f..5c3f6eeea 100644 --- a/sdks/uniswapx-sdk/integration/test/PriorityOrder.spec.ts +++ b/sdks/uniswapx-sdk/integration/test/PriorityOrder.spec.ts @@ -10,7 +10,7 @@ import Permit2Abi from "../../abis/Permit2.json"; import MockERC20Abi from "../../abis/MockERC20.json"; import { Permit2, PriorityOrderReactor, MockERC20 } from "../../src/contracts"; -import { PriorityOrderBuilder, PriorityCosignerData } from "../../dist/src"; +import { PriorityOrderBuilder, PriorityCosignerData } from "../../src"; describe("PriorityOrder", () => { const FEE_RECIPIENT = "0x1111111111111111111111111111111111111111"; diff --git a/sdks/uniswapx-sdk/integration/test/PriorityOrderValidator.spec.ts b/sdks/uniswapx-sdk/integration/test/PriorityOrderValidator.spec.ts index 5a5f80c47..d8978a2ef 100644 --- a/sdks/uniswapx-sdk/integration/test/PriorityOrderValidator.spec.ts +++ b/sdks/uniswapx-sdk/integration/test/PriorityOrderValidator.spec.ts @@ -19,7 +19,7 @@ import { OrderValidation, PriorityCosignerData, CosignedPriorityOrder, -} from "../../dist/src"; +} from "../../src"; import { StaticJsonRpcProvider } from "@ethersproject/providers"; import { REACTOR_ADDRESS_MAPPING, UNISWAPX_ORDER_QUOTER_MAPPING } from "../../src/constants"; import { parseEther } from "ethers/lib/utils"; diff --git a/sdks/uniswapx-sdk/integration/test/RelayOrderValidator.spec.ts b/sdks/uniswapx-sdk/integration/test/RelayOrderValidator.spec.ts index 759618811..deea55fe5 100644 --- a/sdks/uniswapx-sdk/integration/test/RelayOrderValidator.spec.ts +++ b/sdks/uniswapx-sdk/integration/test/RelayOrderValidator.spec.ts @@ -17,7 +17,7 @@ import { RelayOrderBuilder, RelayOrderValidator, RelayOrder, -} from "../../dist/src"; +} from "../../src"; import { deployAndReturnPermit2 } from "./utils/permit2"; import { deployMulticall3 } from "./utils/multicall"; diff --git a/sdks/uniswapx-sdk/integration/test/V3DutchOrder.spec.ts b/sdks/uniswapx-sdk/integration/test/V3DutchOrder.spec.ts index 580c83d8d..5139409fb 100644 --- a/sdks/uniswapx-sdk/integration/test/V3DutchOrder.spec.ts +++ b/sdks/uniswapx-sdk/integration/test/V3DutchOrder.spec.ts @@ -4,7 +4,7 @@ import Permit2Abi from "../../abis/Permit2.json" import V3DutchOrderReactorAbi from "../../abis/V3DutchOrderReactor.json" import MockERC20Abi from "../../abis/MockERC20.json" import { Permit2, V3DutchOrderReactor } from "../../src/contracts" -import { MockERC20 } from "../../dist/src/contracts"; +import { MockERC20 } from "../../src/contracts"; import { BlockchainTime } from "./utils/time"; import { V3DutchOrderBuilder } from "../../src/builder/V3DutchOrderBuilder" import { expect } from "chai"; @@ -830,4 +830,4 @@ const getCosignerData = async ( outputOverrides: [BigNumber.from(0)], }; return Object.assign(defaultData, overrides); -}; \ No newline at end of file +}; diff --git a/sdks/uniswapx-sdk/jest.config.js b/sdks/uniswapx-sdk/jest.config.js index 8cbf8940c..fb4a9bd76 100644 --- a/sdks/uniswapx-sdk/jest.config.js +++ b/sdks/uniswapx-sdk/jest.config.js @@ -2,4 +2,9 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'node', -}; \ No newline at end of file + globals: { + 'ts-jest': { + tsconfig: 'tsconfig.base.json' + } + } +}; diff --git a/sdks/uniswapx-sdk/package.json b/sdks/uniswapx-sdk/package.json index 65970c7ea..d38279f09 100644 --- a/sdks/uniswapx-sdk/package.json +++ b/sdks/uniswapx-sdk/package.json @@ -7,9 +7,9 @@ "ethereum" ], "license": "MIT", - "main": "dist/src/index.js", - "typings": "dist/src/index.d.ts", - "module": "dist/uniswapx-sdk.esm.js", + "main": "./dist/cjs/src/index.js", + "typings": "./dist/types/src/index.d.ts", + "module": "./dist/esm/src/index.js", "files": [ "dist" ], @@ -17,7 +17,11 @@ "node": ">=10" }, "scripts": { - "build": "yarn run typechain && tsc -p tsconfig.json", + "clean": "rm -rf dist", + "build": "yarn clean && yarn run typechain && yarn build:cjs && yarn build:esm && yarn build:types", + "build:cjs": "tsc -p tsconfig.cjs.json", + "build:esm": "tsc -p tsconfig.esm.json", + "build:types": "tsc -p tsconfig.types.json", "lint": "eslint src --ext .ts", "lint:fix": "eslint src --ext .ts --fix", "prettier": "prettier \"src/**/*.ts\" --list-different", @@ -96,5 +100,13 @@ } ] ] - } + }, + "exports": { + ".": { + "types": "./dist/types/src/index.d.ts", + "import": "./dist/esm/src/index.js", + "require": "./dist/cjs/src/index.js" + } + }, + "sideEffects": false } diff --git a/sdks/uniswapx-sdk/tsconfig.json b/sdks/uniswapx-sdk/tsconfig.base.json similarity index 80% rename from sdks/uniswapx-sdk/tsconfig.json rename to sdks/uniswapx-sdk/tsconfig.base.json index 24b80a37d..0971586f0 100644 --- a/sdks/uniswapx-sdk/tsconfig.json +++ b/sdks/uniswapx-sdk/tsconfig.base.json @@ -1,11 +1,9 @@ { - "include": [ - "src" - ], + "include": ["src", "abis"], "compilerOptions": { - "outDir": "dist", + "rootDir": ".", + "baseUrl": ".", "target": "es6", - "module": "commonjs", "importHelpers": true, "declaration": true, "sourceMap": true, @@ -23,6 +21,7 @@ "moduleResolution": "node", "resolveJsonModule": true, "esModuleInterop": true, - "skipLibCheck": true - }, -} \ No newline at end of file + "skipLibCheck": true, + "isolatedModules": true + } +} diff --git a/sdks/uniswapx-sdk/tsconfig.cjs.json b/sdks/uniswapx-sdk/tsconfig.cjs.json new file mode 100644 index 000000000..b868bc58d --- /dev/null +++ b/sdks/uniswapx-sdk/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "dist/cjs" + } +} diff --git a/sdks/uniswapx-sdk/tsconfig.esm.json b/sdks/uniswapx-sdk/tsconfig.esm.json new file mode 100644 index 000000000..eb2b70b1a --- /dev/null +++ b/sdks/uniswapx-sdk/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + } +} diff --git a/sdks/uniswapx-sdk/tsconfig.types.json b/sdks/uniswapx-sdk/tsconfig.types.json new file mode 100644 index 000000000..5a850dbc4 --- /dev/null +++ b/sdks/uniswapx-sdk/tsconfig.types.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "dist/types" + } +} diff --git a/turbo.json b/turbo.json index 2463bb133..9357a1714 100644 --- a/turbo.json +++ b/turbo.json @@ -13,7 +13,10 @@ "sdks/*/src/**.ts", "sdks/*/src/**.tsx" ], - "outputs": [] + "outputs": [ + "dist/**", + "sdks/*/dist/**" + ] }, "test": { "dependsOn": [ @@ -27,4 +30,4 @@ "dependsOn": [] } } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 8a7d6211e..22646fac5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17616,7 +17616,6 @@ __metadata: hardhat: ^2.22.15 husky: ^8.0.3 ts-node: ^10.9.1 - tsdx: ^0.14.1 typechain: ^8.1.0 languageName: unknown linkType: soft