diff --git a/sdks/v4-sdk/.eslintrc.json b/sdks/v4-sdk/.eslintrc.json new file mode 100644 index 000000000..bbdfe264e --- /dev/null +++ b/sdks/v4-sdk/.eslintrc.json @@ -0,0 +1,12 @@ +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "extends": [ + "prettier", + "prettier/@typescript-eslint" + ], + "ignorePatterns": ["dist/**"] +} diff --git a/sdks/v4-sdk/jest.config.js b/sdks/v4-sdk/jest.config.js new file mode 100644 index 000000000..d584c8991 --- /dev/null +++ b/sdks/v4-sdk/jest.config.js @@ -0,0 +1,11 @@ +/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + rootDir: 'src', + globals: { + 'ts-jest': { + tsconfig: 'tsconfig.base.json', + }, + }, +} diff --git a/sdks/v4-sdk/package.json b/sdks/v4-sdk/package.json index 6fb1f1b07..4f9c19827 100644 --- a/sdks/v4-sdk/package.json +++ b/sdks/v4-sdk/package.json @@ -7,9 +7,9 @@ "ethereum" ], "license": "MIT", - "main": "dist/index.js", - "typings": "dist/index.d.ts", - "module": "dist/v4-sdk.esm.js", + "main": "./dist/cjs/src/index.js", + "module": "./dist/esm/src/index.js", + "types": "./dist/types/src/index.d.ts", "files": [ "dist" ], @@ -17,12 +17,22 @@ "node": ">=14" }, "scripts": { - "build": "tsdx build", - "lint": "tsdx lint src", - "release": "semantic-release", - "start": "tsdx watch", - "test": "tsdx test" + "clean": "rm -rf dist", + "build": "yarn clean && 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", + "test": "jest" }, + "exports": { + ".": { + "types": "./dist/types/src/index.d.ts", + "import": "./dist/esm/src/index.js", + "require": "./dist/cjs/src/index.js" + } + }, + "sideEffects": false, "dependencies": { "@ethersproject/solidity": "^5.0.9", "@uniswap/sdk-core": "^6.0.0", @@ -37,10 +47,14 @@ "@types/node-fetch": "^2.6.2", "chai": "^4.3.6", "dotenv": "^16.0.3", - "eslint-plugin-prettier": "^3.4.1", + "eslint": "^7.8.0", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-functional": "^3.0.2", + "eslint-plugin-import": "^2.22.0", + "jest": "25.5.0", "prettier": "^2.4.1", "ts-node": "^10.9.1", - "tsdx": "^0.14.1", "tslib": "^2.3.0", "typedoc": "^0.21.2", "typescript": "^4.3.3" diff --git a/sdks/v4-sdk/tsconfig.base.json b/sdks/v4-sdk/tsconfig.base.json new file mode 100644 index 000000000..6e7226d36 --- /dev/null +++ b/sdks/v4-sdk/tsconfig.base.json @@ -0,0 +1,18 @@ +{ + "include": ["src"], + "compilerOptions": { + "rootDir": ".", + "baseUrl": ".", + "target": "es2020", + "module": "esnext", + "importHelpers": true, + "declaration": true, + "sourceMap": true, + "strict": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "skipLibCheck": true, + "isolatedModules": true + } +} diff --git a/sdks/v4-sdk/tsconfig.cjs.json b/sdks/v4-sdk/tsconfig.cjs.json new file mode 100644 index 000000000..b868bc58d --- /dev/null +++ b/sdks/v4-sdk/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "dist/cjs" + } +} diff --git a/sdks/v4-sdk/tsconfig.esm.json b/sdks/v4-sdk/tsconfig.esm.json new file mode 100644 index 000000000..eb2b70b1a --- /dev/null +++ b/sdks/v4-sdk/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + } +} diff --git a/sdks/v4-sdk/tsconfig.json b/sdks/v4-sdk/tsconfig.json deleted file mode 100644 index 78ecb1b72..000000000 --- a/sdks/v4-sdk/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "target": "es2020", - "module": "esnext", - "importHelpers": true, - "declaration": true, - "sourceMap": true, - "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "strictPropertyInitialization": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "moduleResolution": "node", - "esModuleInterop": true, - "resolveJsonModule": true - } -} diff --git a/sdks/v4-sdk/tsconfig.types.json b/sdks/v4-sdk/tsconfig.types.json new file mode 100644 index 000000000..5a850dbc4 --- /dev/null +++ b/sdks/v4-sdk/tsconfig.types.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "dist/types" + } +} diff --git a/yarn.lock b/yarn.lock index 0172a439a..4a8f7d9e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4824,12 +4824,16 @@ __metadata: "@uniswap/v3-sdk": 3.19.0 chai: ^4.3.6 dotenv: ^16.0.3 - eslint-plugin-prettier: ^3.4.1 + eslint: ^7.8.0 + eslint-config-prettier: ^6.11.0 + eslint-plugin-eslint-comments: ^3.2.0 + eslint-plugin-functional: ^3.0.2 + eslint-plugin-import: ^2.22.0 + jest: 25.5.0 prettier: ^2.4.1 tiny-invariant: ^1.1.0 tiny-warning: ^1.0.3 ts-node: ^10.9.1 - tsdx: ^0.14.1 tslib: ^2.3.0 typedoc: ^0.21.2 typescript: ^4.3.3