From aac80855dd6ef52dfe95fc154d3dbe6822dd3799 Mon Sep 17 00:00:00 2001 From: eddie <66155195+just-toby@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:20:24 -0500 Subject: [PATCH] feat(permit2-sdk): separate cjs and esm builds, remove tsdx --- sdks/permit2-sdk/package.json | 26 +++++++++++++++++--------- sdks/permit2-sdk/tsconfig.base.json | 18 ++++++++++++++++++ sdks/permit2-sdk/tsconfig.cjs.json | 9 +++++++++ sdks/permit2-sdk/tsconfig.esm.json | 9 +++++++++ sdks/permit2-sdk/tsconfig.json | 24 ------------------------ sdks/permit2-sdk/tsconfig.types.json | 9 +++++++++ yarn.lock | 2 +- 7 files changed, 63 insertions(+), 34 deletions(-) create mode 100644 sdks/permit2-sdk/tsconfig.base.json create mode 100644 sdks/permit2-sdk/tsconfig.cjs.json create mode 100644 sdks/permit2-sdk/tsconfig.esm.json delete mode 100644 sdks/permit2-sdk/tsconfig.json create mode 100644 sdks/permit2-sdk/tsconfig.types.json diff --git a/sdks/permit2-sdk/package.json b/sdks/permit2-sdk/package.json index 892fb17cd..1eb182503 100644 --- a/sdks/permit2-sdk/package.json +++ b/sdks/permit2-sdk/package.json @@ -7,18 +7,26 @@ "ethereum" ], "license": "MIT", - "main": "dist/index.js", - "typings": "dist/index.d.ts", + "main": "./dist/cjs/src/index.js", + "module": "./dist/esm/src/index.js", + "types": "./dist/types/src/index.d.ts", + "exports": { + ".": { + "types": "./dist/types/src/index.d.ts", + "import": "./dist/esm/src/index.js", + "require": "./dist/cjs/src/index.js" + } + }, + "sideEffects": false, "files": [ "dist" ], "scripts": { - "build": "tsdx build", - "interop": "yarn node writeInterop.js", - "lint": "prettier --check src/", - "release": "semantic-release", - "start": "tsdx watch", - "test": "tsdx test --testPathIgnorePatterns=/permit2/" + "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", + "clean": "rm -rf ./dist" }, "dependencies": { "ethers": "^5.7.0", @@ -27,7 +35,7 @@ "devDependencies": { "@types/jest": "^24.0.25", "prettier": "^2.4.1", - "tsdx": "^0.14.1" + "typescript": "^4.3.3" }, "prettier": { "printWidth": 120, diff --git a/sdks/permit2-sdk/tsconfig.base.json b/sdks/permit2-sdk/tsconfig.base.json new file mode 100644 index 000000000..1eb163fb2 --- /dev/null +++ b/sdks/permit2-sdk/tsconfig.base.json @@ -0,0 +1,18 @@ +{ + "include": ["src", "abis"], + "compilerOptions": { + "rootDir": ".", + "baseUrl": ".", + "target": "es6", + "module": "esnext", + "importHelpers": true, + "declaration": true, + "sourceMap": true, + "strict": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "skipLibCheck": true, + "isolatedModules": true + } +} diff --git a/sdks/permit2-sdk/tsconfig.cjs.json b/sdks/permit2-sdk/tsconfig.cjs.json new file mode 100644 index 000000000..4c14b8856 --- /dev/null +++ b/sdks/permit2-sdk/tsconfig.cjs.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "dist/cjs", + "target": "es2015" + }, + "include": ["src/**/*", "abis/**/*"] +} diff --git a/sdks/permit2-sdk/tsconfig.esm.json b/sdks/permit2-sdk/tsconfig.esm.json new file mode 100644 index 000000000..ac77d81a7 --- /dev/null +++ b/sdks/permit2-sdk/tsconfig.esm.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm", + "target": "es2015" + }, + "include": ["src/**/*", "abis/**/*"] +} diff --git a/sdks/permit2-sdk/tsconfig.json b/sdks/permit2-sdk/tsconfig.json deleted file mode 100644 index 008638425..000000000 --- a/sdks/permit2-sdk/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "include": ["src"], - "compilerOptions": { - "target": "es2018", - "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/permit2-sdk/tsconfig.types.json b/sdks/permit2-sdk/tsconfig.types.json new file mode 100644 index 000000000..46c1da7b0 --- /dev/null +++ b/sdks/permit2-sdk/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "dist/types" + }, + "include": ["src", "abis"] +} diff --git a/yarn.lock b/yarn.lock index 22646fac5..79df8ce97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4505,7 +4505,7 @@ __metadata: ethers: ^5.7.0 prettier: ^2.4.1 tiny-invariant: ^1.1.0 - tsdx: ^0.14.1 + typescript: ^4.3.3 languageName: unknown linkType: soft