Skip to content

Commit

Permalink
feat(uniswapx): add esm build
Browse files Browse the repository at this point in the history
  • Loading branch information
just-toby committed Dec 16, 2024
1 parent ff2be9a commit 7cea2d9
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 26 deletions.
4 changes: 2 additions & 2 deletions sdks/uniswapx-sdk/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
"project": "./tsconfig.base.json"
},
"env": {
"es6": true
Expand Down Expand Up @@ -60,4 +60,4 @@
"always-multiline"
]
}
}
}
3 changes: 1 addition & 2 deletions sdks/uniswapx-sdk/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion sdks/uniswapx-sdk/integration/test/PriorityOrder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
RelayOrderBuilder,
RelayOrderValidator,
RelayOrder,
} from "../../dist/src";
} from "../../src";
import { deployAndReturnPermit2 } from "./utils/permit2";
import { deployMulticall3 } from "./utils/multicall";

Expand Down
4 changes: 2 additions & 2 deletions sdks/uniswapx-sdk/integration/test/V3DutchOrder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -830,4 +830,4 @@ const getCosignerData = async (
outputOverrides: [BigNumber.from(0)],
};
return Object.assign(defaultData, overrides);
};
};
7 changes: 6 additions & 1 deletion sdks/uniswapx-sdk/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
globals: {
'ts-jest': {
tsconfig: 'tsconfig.base.json'
}
}
};
22 changes: 17 additions & 5 deletions sdks/uniswapx-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@
"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"
],
"engines": {
"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",
Expand Down Expand Up @@ -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
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"include": [
"src"
],
"include": ["src", "abis"],
"compilerOptions": {
"outDir": "dist",
"rootDir": ".",
"baseUrl": ".",
"target": "es6",
"module": "commonjs",
"importHelpers": true,
"declaration": true,
"sourceMap": true,
Expand All @@ -23,6 +21,7 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true
},
}
"skipLibCheck": true,
"isolatedModules": true
}
}
7 changes: 7 additions & 0 deletions sdks/uniswapx-sdk/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "dist/cjs"
}
}
7 changes: 7 additions & 0 deletions sdks/uniswapx-sdk/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "esnext",
"outDir": "dist/esm"
}
}
8 changes: 8 additions & 0 deletions sdks/uniswapx-sdk/tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist/types"
}
}
7 changes: 5 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"sdks/*/src/**.ts",
"sdks/*/src/**.tsx"
],
"outputs": []
"outputs": [
"dist/**",
"sdks/*/dist/**"
]
},
"test": {
"dependsOn": [
Expand All @@ -27,4 +30,4 @@
"dependsOn": []
}
}
}
}
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7cea2d9

Please sign in to comment.