Skip to content

Commit 1d12f7e

Browse files
authored
Replace tsup with ts-bridge (#4648)
## Explanation `ts-bridge` finally supports project references. In this PR, I've swapped out `tsup` for `ts-bridge` everywhere. ## References Related to MetaMask/metamask-module-template#247, MetaMask/utils#182. Closes #4333. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
1 parent 57a722e commit 1d12f7e

File tree

78 files changed

+487
-1047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+487
-1047
lines changed

.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ If you have a project that depends on a package in this monorepo, you may want t
6060

6161
If you're developing your project locally and want to test changes to a package, you can follow these steps:
6262

63-
1. First, you must build the monorepo. It's recommend to run `yarn build:watch` so that changes to the package you want to change are reflected in your project automatically.
63+
1. First, you must build the monorepo, by running `yarn build`.
6464
2. Next, you need to connect the package to your project by overriding the resolution logic in your package manager to replace the published version of the package with the local version.
6565

6666
1. Open `package.json` in the project and locate the dependency entry for the package.

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
"packages/*"
1313
],
1414
"scripts": {
15-
"build": "yarn run build:source && yarn run build:types",
15+
"build": "yarn ts-bridge --project tsconfig.build.json --verbose",
1616
"build:clean": "rimraf dist '**/*.tsbuildinfo' && yarn build",
1717
"build:docs": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run build:docs",
18-
"build:source": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run build",
1918
"build:types": "tsc --build tsconfig.build.json --verbose",
20-
"build:watch": "yarn run build --watch",
2119
"changelog:update": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:update",
2220
"changelog:validate": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:validate",
2321
"create-package": "ts-node scripts/create-package",
@@ -45,7 +43,6 @@
4543
"resolutions": {
4644
"[email protected]": "^6.5.7",
4745
"fast-xml-parser@^4.3.4": "^4.4.1",
48-
"tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch",
4946
"[email protected]": "^7.5.10"
5047
},
5148
"devDependencies": {
@@ -62,6 +59,7 @@
6259
"@metamask/eth-json-rpc-provider": "^4.1.3",
6360
"@metamask/json-rpc-engine": "^9.0.2",
6461
"@metamask/utils": "^9.1.0",
62+
"@ts-bridge/cli": "^0.5.1",
6563
"@types/jest": "^27.4.1",
6664
"@types/lodash": "^4.14.191",
6765
"@types/node": "^16.18.54",
@@ -93,7 +91,6 @@
9391
"semver": "^7.6.3",
9492
"simple-git-hooks": "^2.8.0",
9593
"ts-node": "^10.9.1",
96-
"tsup": "^8.0.2",
9794
"typescript": "~5.2.2",
9895
"yargs": "^17.7.2"
9996
},
@@ -106,8 +103,7 @@
106103
"@lavamoat/preinstall-always-fail": false,
107104
"@keystonehq/bc-ur-registry-eth>hdkey>secp256k1": true,
108105
"babel-runtime>core-js": false,
109-
"simple-git-hooks": false,
110-
"tsup>esbuild": true
106+
"simple-git-hooks": false
111107
}
112108
}
113109
}

packages/accounts-controller/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@
1818
"sideEffects": false,
1919
"exports": {
2020
".": {
21-
"import": "./dist/index.mjs",
22-
"require": "./dist/index.js",
23-
"types": "./dist/types/index.d.ts"
21+
"import": {
22+
"types": "./dist/index.d.mts",
23+
"default": "./dist/index.mjs"
24+
},
25+
"require": {
26+
"types": "./dist/index.d.cts",
27+
"default": "./dist/index.cjs"
28+
}
2429
},
2530
"./package.json": "./package.json"
2631
},
27-
"main": "./dist/index.js",
28-
"types": "./dist/types/index.d.ts",
32+
"main": "./dist/index.cjs",
33+
"types": "./dist/index.d.cts",
2934
"files": [
3035
"dist/"
3136
],
3237
"scripts": {
33-
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
38+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
3439
"build:docs": "typedoc",
3540
"changelog:update": "../../scripts/update-changelog.sh @metamask/accounts-controller",
3641
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/accounts-controller",

packages/accounts-controller/tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.packages.build.json",
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/types",
5+
"outDir": "./dist",
66
"rootDir": "./src",
77
"skipLibCheck": true
88
},

packages/address-book-controller/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@
1818
"sideEffects": false,
1919
"exports": {
2020
".": {
21-
"import": "./dist/index.mjs",
22-
"require": "./dist/index.js",
23-
"types": "./dist/types/index.d.ts"
21+
"import": {
22+
"types": "./dist/index.d.mts",
23+
"default": "./dist/index.mjs"
24+
},
25+
"require": {
26+
"types": "./dist/index.d.cts",
27+
"default": "./dist/index.cjs"
28+
}
2429
},
2530
"./package.json": "./package.json"
2631
},
27-
"main": "./dist/index.js",
28-
"types": "./dist/types/index.d.ts",
32+
"main": "./dist/index.cjs",
33+
"types": "./dist/index.d.cts",
2934
"files": [
3035
"dist/"
3136
],
3237
"scripts": {
33-
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
38+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
3439
"build:docs": "typedoc",
3540
"changelog:update": "../../scripts/update-changelog.sh @metamask/address-book-controller",
3641
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/address-book-controller",

packages/address-book-controller/tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.packages.build.json",
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/types",
5+
"outDir": "./dist",
66
"rootDir": "./src"
77
},
88
"references": [

packages/announcement-controller/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@
1818
"sideEffects": false,
1919
"exports": {
2020
".": {
21-
"import": "./dist/index.mjs",
22-
"require": "./dist/index.js",
23-
"types": "./dist/types/index.d.ts"
21+
"import": {
22+
"types": "./dist/index.d.mts",
23+
"default": "./dist/index.mjs"
24+
},
25+
"require": {
26+
"types": "./dist/index.d.cts",
27+
"default": "./dist/index.cjs"
28+
}
2429
},
2530
"./package.json": "./package.json"
2631
},
27-
"main": "./dist/index.js",
28-
"types": "./dist/types/index.d.ts",
32+
"main": "./dist/index.cjs",
33+
"types": "./dist/index.d.cts",
2934
"files": [
3035
"dist/"
3136
],
3237
"scripts": {
33-
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
38+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
3439
"build:docs": "typedoc",
3540
"changelog:update": "../../scripts/update-changelog.sh @metamask/announcement-controller",
3641
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/announcement-controller",

packages/announcement-controller/tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.packages.build.json",
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/types",
5+
"outDir": "./dist",
66
"rootDir": "./src"
77
},
88
"references": [{ "path": "../base-controller/tsconfig.build.json" }],

packages/approval-controller/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@
1818
"sideEffects": false,
1919
"exports": {
2020
".": {
21-
"import": "./dist/index.mjs",
22-
"require": "./dist/index.js",
23-
"types": "./dist/types/index.d.ts"
21+
"import": {
22+
"types": "./dist/index.d.mts",
23+
"default": "./dist/index.mjs"
24+
},
25+
"require": {
26+
"types": "./dist/index.d.cts",
27+
"default": "./dist/index.cjs"
28+
}
2429
},
2530
"./package.json": "./package.json"
2631
},
27-
"main": "./dist/index.js",
28-
"types": "./dist/types/index.d.ts",
32+
"main": "./dist/index.cjs",
33+
"types": "./dist/index.d.cts",
2934
"files": [
3035
"dist/"
3136
],
3237
"scripts": {
33-
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
38+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
3439
"build:docs": "typedoc",
3540
"changelog:update": "../../scripts/update-changelog.sh @metamask/approval-controller",
3641
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/approval-controller",

packages/approval-controller/tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.packages.build.json",
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/types",
5+
"outDir": "./dist",
66
"rootDir": "./src"
77
},
88
"references": [

packages/assets-controllers/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@
1818
"sideEffects": false,
1919
"exports": {
2020
".": {
21-
"import": "./dist/index.mjs",
22-
"require": "./dist/index.js",
23-
"types": "./dist/types/index.d.ts"
21+
"import": {
22+
"types": "./dist/index.d.mts",
23+
"default": "./dist/index.mjs"
24+
},
25+
"require": {
26+
"types": "./dist/index.d.cts",
27+
"default": "./dist/index.cjs"
28+
}
2429
},
2530
"./package.json": "./package.json"
2631
},
27-
"main": "./dist/index.js",
28-
"types": "./dist/types/index.d.ts",
32+
"main": "./dist/index.cjs",
33+
"types": "./dist/index.d.cts",
2934
"files": [
3035
"dist/"
3136
],
3237
"scripts": {
33-
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
38+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
3439
"build:docs": "typedoc",
3540
"changelog:update": "../../scripts/update-changelog.sh @metamask/assets-controllers",
3641
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/assets-controllers",

packages/assets-controllers/tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.packages.build.json",
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/types",
5+
"outDir": "./dist",
66
"rootDir": "./src"
77
},
88
"references": [

packages/base-controller/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,24 @@
1717
"license": "MIT",
1818
"exports": {
1919
".": {
20-
"import": "./dist/index.mjs",
21-
"require": "./dist/index.js",
22-
"types": "./dist/types/index.d.ts"
20+
"import": {
21+
"types": "./dist/index.d.mts",
22+
"default": "./dist/index.mjs"
23+
},
24+
"require": {
25+
"types": "./dist/index.d.cts",
26+
"default": "./dist/index.cjs"
27+
}
2328
},
2429
"./package.json": "./package.json"
2530
},
26-
"main": "./dist/index.js",
27-
"types": "./dist/types/index.d.ts",
31+
"main": "./dist/index.cjs",
32+
"types": "./dist/index.d.cts",
2833
"files": [
2934
"dist/"
3035
],
3136
"scripts": {
32-
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
37+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
3338
"build:docs": "typedoc",
3439
"changelog:update": "../../scripts/update-changelog.sh @metamask/base-controller",
3540
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/base-controller",

packages/base-controller/tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.packages.build.json",
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/types",
5+
"outDir": "./dist",
66
"rootDir": "./src"
77
},
88
"references": [

packages/build-utils/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@
1818
"sideEffects": false,
1919
"exports": {
2020
".": {
21-
"import": "./dist/index.mjs",
22-
"require": "./dist/index.js",
23-
"types": "./dist/types/index.d.ts"
21+
"import": {
22+
"types": "./dist/index.d.mts",
23+
"default": "./dist/index.mjs"
24+
},
25+
"require": {
26+
"types": "./dist/index.d.cts",
27+
"default": "./dist/index.cjs"
28+
}
2429
},
2530
"./package.json": "./package.json"
2631
},
27-
"main": "./dist/index.js",
28-
"types": "./dist/types/index.d.ts",
32+
"main": "./dist/index.cjs",
33+
"types": "./dist/index.d.cts",
2934
"files": [
3035
"dist/"
3136
],
3237
"scripts": {
33-
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
38+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
3439
"build:docs": "typedoc",
3540
"changelog:update": "../../scripts/update-changelog.sh @metamask/build-utils",
3641
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/build-utils",

packages/build-utils/tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.packages.build.json",
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/types",
5+
"outDir": "./dist",
66
"rootDir": "./src"
77
},
88
"include": ["../../types", "./src"]

packages/chain-controller/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@
1818
"sideEffects": false,
1919
"exports": {
2020
".": {
21-
"import": "./dist/index.mjs",
22-
"require": "./dist/index.js",
23-
"types": "./dist/types/index.d.ts"
21+
"import": {
22+
"types": "./dist/index.d.mts",
23+
"default": "./dist/index.mjs"
24+
},
25+
"require": {
26+
"types": "./dist/index.d.cts",
27+
"default": "./dist/index.cjs"
28+
}
2429
},
2530
"./package.json": "./package.json"
2631
},
27-
"main": "./dist/index.js",
28-
"types": "./dist/types/index.d.ts",
32+
"main": "./dist/index.cjs",
33+
"types": "./dist/index.d.cts",
2934
"files": [
3035
"dist/"
3136
],
3237
"scripts": {
33-
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
38+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
3439
"build:docs": "typedoc",
3540
"changelog:update": "../../scripts/update-changelog.sh @metamask/chain-controller",
3641
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/chain-controller",

packages/chain-controller/tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.packages.build.json",
33
"compilerOptions": {
44
"baseUrl": "./",
5-
"outDir": "./dist/types",
5+
"outDir": "./dist",
66
"rootDir": "./src",
77
"skipLibCheck": true
88
},

0 commit comments

Comments
 (0)