Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(breaking): esm/cjs builds for uniswapx-sdk #218

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
}
}
};
25 changes: 18 additions & 7 deletions sdks/uniswapx-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@
"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",
"build": "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",
"release": "semantic-release",
"test": "run-s build test:unit test:integration",
"test": "run-s test:unit test:integration",
"test:unit": "jest --testPathPattern src --detectOpenHandles --forceExit --testPathIgnorePatterns dist",
"test:integration": "yarn build && cd integration && yarn && yarn test",
"test:integration": "cd integration && yarn && yarn test",
"typechain": "typechain --target=ethers-v5 --out-dir src/contracts --glob ./abis/**/*.json"
},
"dependencies": {
Expand Down Expand Up @@ -96,5 +99,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"
}
}
9 changes: 7 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@
"sdks/*/src/**.ts",
"sdks/*/src/**.tsx"
],
"outputs": []
"outputs": [
"sdks/*/dist/**"
]
},
"test": {
"dependsOn": [
"build"
],
"inputs": [
"sdks/*/dist/**"
]
},
"release": {
Expand All @@ -27,4 +32,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
Loading