Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit afb7c94

Browse files
committedDec 16, 2024·
feat(router-sdk): separate esm/cjs builds
1 parent 88fd603 commit afb7c94

9 files changed

+100
-38
lines changed
 

‎sdks/router-sdk/.eslintrc.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"ecmaVersion": 2018,
5+
"sourceType": "module"
6+
},
7+
"extends": [
8+
"prettier",
9+
"prettier/@typescript-eslint"
10+
],
11+
"ignorePatterns": ["dist/**"]
12+
}

‎sdks/router-sdk/jest.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
rootDir: 'src',
6+
globals: {
7+
'ts-jest': {
8+
tsconfig: 'tsconfig.base.json'
9+
}
10+
}
11+
};
12+

‎sdks/router-sdk/package.json

+27-13
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@
77
"ethereum"
88
],
99
"license": "MIT",
10-
"main": "dist/index.js",
11-
"typings": "dist/index.d.ts",
10+
"main": "./dist/cjs/src/index.js",
11+
"module": "./dist/esm/src/index.js",
12+
"types": "./dist/types/src/index.d.ts",
1213
"files": [
1314
"dist"
1415
],
1516
"scripts": {
16-
"build": "tsdx build",
17-
"lint": "tsdx lint src",
18-
"release": "semantic-release",
19-
"start": "tsdx watch",
20-
"test": "tsdx test"
17+
"clean": "rm -rf dist",
18+
"build": "yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
19+
"build:cjs": "tsc -p tsconfig.cjs.json",
20+
"build:esm": "tsc -p tsconfig.esm.json",
21+
"build:types": "tsc -p tsconfig.types.json",
22+
"lint": "eslint src --ext .ts",
23+
"lint:fix": "eslint src --ext .ts --fix",
24+
"test": "jest"
2125
},
2226
"dependencies": {
2327
"@ethersproject/abi": "^5.5.0",
@@ -29,18 +33,28 @@
2933
},
3034
"devDependencies": {
3135
"@types/jest": "^24.0.25",
36+
"@typescript-eslint/eslint-plugin": "^5.62",
37+
"@typescript-eslint/parser": "^5.62",
38+
"eslint": "^7.8.0",
39+
"eslint-config-prettier": "^6.11.0",
40+
"eslint-plugin-eslint-comments": "^3.2.0",
41+
"eslint-plugin-functional": "^3.0.2",
42+
"eslint-plugin-import": "^2.22.0",
43+
"jest": "25.5.0",
3244
"prettier": "^2.4.1",
33-
"tsdx": "^0.14.1"
34-
},
35-
"prettier": {
36-
"printWidth": 120,
37-
"semi": false,
38-
"singleQuote": true
45+
"typescript": "^4.3.3"
3946
},
4047
"publishConfig": {
4148
"access": "public",
4249
"provenance": true
4350
},
51+
"exports": {
52+
".": {
53+
"types": "./dist/types/src/index.d.ts",
54+
"import": "./dist/esm/src/index.js",
55+
"require": "./dist/cjs/src/index.js"
56+
}
57+
},
4458
"release": {
4559
"extends": "semantic-release-monorepo",
4660
"branches": [

‎sdks/router-sdk/tsconfig.base.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"include": ["src"],
3+
"compilerOptions": {
4+
"rootDir": ".",
5+
"baseUrl": ".",
6+
"target": "es6",
7+
"module": "esnext",
8+
"importHelpers": true,
9+
"declaration": true,
10+
"sourceMap": true,
11+
"strict": true,
12+
"moduleResolution": "node",
13+
"resolveJsonModule": true,
14+
"esModuleInterop": true,
15+
"skipLibCheck": true,
16+
"isolatedModules": true
17+
}
18+
}

‎sdks/router-sdk/tsconfig.cjs.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"module": "commonjs",
5+
"outDir": "dist/cjs"
6+
}
7+
}

‎sdks/router-sdk/tsconfig.esm.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"outDir": "dist/esm"
6+
}
7+
}

‎sdks/router-sdk/tsconfig.json

-24
This file was deleted.

‎sdks/router-sdk/tsconfig.types.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"emitDeclarationOnly": true,
6+
"outDir": "dist/types"
7+
}
8+
}

‎yarn.lock

+9-1
Original file line numberDiff line numberDiff line change
@@ -4529,13 +4529,21 @@ __metadata:
45294529
dependencies:
45304530
"@ethersproject/abi": ^5.5.0
45314531
"@types/jest": ^24.0.25
4532+
"@typescript-eslint/eslint-plugin": ^5.62
4533+
"@typescript-eslint/parser": ^5.62
45324534
"@uniswap/sdk-core": ^6.0.0
45334535
"@uniswap/swap-router-contracts": ^1.3.0
45344536
"@uniswap/v2-sdk": ^4.7.0
45354537
"@uniswap/v3-sdk": ^3.19.0
45364538
"@uniswap/v4-sdk": ^1.12.0
4539+
eslint: ^7.8.0
4540+
eslint-config-prettier: ^6.11.0
4541+
eslint-plugin-eslint-comments: ^3.2.0
4542+
eslint-plugin-functional: ^3.0.2
4543+
eslint-plugin-import: ^2.22.0
4544+
jest: 25.5.0
45374545
prettier: ^2.4.1
4538-
tsdx: ^0.14.1
4546+
typescript: ^4.3.3
45394547
languageName: unknown
45404548
linkType: soft
45414549

0 commit comments

Comments
 (0)
Please sign in to comment.