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" + } +}