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

Replace tsup with ts-bridge #4648

Merged
merged 7 commits into from
Sep 16, 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
13 changes: 0 additions & 13 deletions .yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch

This file was deleted.

2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ If you have a project that depends on a package in this monorepo, you may want t

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

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.
1. First, you must build the monorepo, by running `yarn build`.
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.

1. Open `package.json` in the project and locate the dependency entry for the package.
Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
"packages/*"
],
"scripts": {
"build": "yarn run build:source && yarn run build:types",
"build": "yarn ts-bridge --project tsconfig.build.json --verbose",
"build:clean": "rimraf dist '**/*.tsbuildinfo' && yarn build",
"build:docs": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run build:docs",
"build:source": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run build",
"build:types": "tsc --build tsconfig.build.json --verbose",
"build:watch": "yarn run build --watch",
"changelog:update": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:update",
"changelog:validate": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:validate",
"create-package": "ts-node scripts/create-package",
Expand Down Expand Up @@ -45,7 +43,6 @@
"resolutions": {
"[email protected]": "^6.5.7",
"fast-xml-parser@^4.3.4": "^4.4.1",
"tsup@^8.0.2": "patch:tsup@npm%3A8.0.2#./.yarn/patches/tsup-npm-8.0.2-86e40f68a7.patch",
"[email protected]": "^7.5.10"
},
"devDependencies": {
Expand All @@ -62,6 +59,7 @@
"@metamask/eth-json-rpc-provider": "^4.1.3",
"@metamask/json-rpc-engine": "^9.0.2",
"@metamask/utils": "^9.1.0",
"@ts-bridge/cli": "^0.5.1",
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.191",
"@types/node": "^16.18.54",
Expand Down Expand Up @@ -93,7 +91,6 @@
"semver": "^7.6.3",
"simple-git-hooks": "^2.8.0",
"ts-node": "^10.9.1",
"tsup": "^8.0.2",
"typescript": "~5.2.2",
"yargs": "^17.7.2"
},
Expand All @@ -106,8 +103,7 @@
"@lavamoat/preinstall-always-fail": false,
"@keystonehq/bc-ur-registry-eth>hdkey>secp256k1": true,
"babel-runtime>core-js": false,
"simple-git-hooks": false,
"tsup>esbuild": true
"simple-git-hooks": false
}
}
}
17 changes: 11 additions & 6 deletions packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts-bridge builds with project references if they are set in tsconfig.json by default. To build an individual package, we have to use --no-references here. I may reconsider this to make project references opt-in rather than opt-out, as that's what tsc does.

"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/accounts-controller",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/accounts-controller",
Expand Down
2 changes: 1 addition & 1 deletion packages/accounts-controller/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.packages.build.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/types",
"outDir": "./dist",
"rootDir": "./src",
"skipLibCheck": true
},
Expand Down
17 changes: 11 additions & 6 deletions packages/address-book-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/address-book-controller",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/address-book-controller",
Expand Down
2 changes: 1 addition & 1 deletion packages/address-book-controller/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.packages.build.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/types",
"outDir": "./dist",
"rootDir": "./src"
},
"references": [
Expand Down
17 changes: 11 additions & 6 deletions packages/announcement-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/announcement-controller",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/announcement-controller",
Expand Down
2 changes: 1 addition & 1 deletion packages/announcement-controller/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.packages.build.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/types",
"outDir": "./dist",
"rootDir": "./src"
},
"references": [{ "path": "../base-controller/tsconfig.build.json" }],
Expand Down
17 changes: 11 additions & 6 deletions packages/approval-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/approval-controller",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/approval-controller",
Expand Down
2 changes: 1 addition & 1 deletion packages/approval-controller/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.packages.build.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/types",
"outDir": "./dist",
"rootDir": "./src"
},
"references": [
Expand Down
17 changes: 11 additions & 6 deletions packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/assets-controllers",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/assets-controllers",
Expand Down
2 changes: 1 addition & 1 deletion packages/assets-controllers/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.packages.build.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/types",
"outDir": "./dist",
"rootDir": "./src"
},
"references": [
Expand Down
17 changes: 11 additions & 6 deletions packages/base-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@
"license": "MIT",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/base-controller",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/base-controller",
Expand Down
2 changes: 1 addition & 1 deletion packages/base-controller/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.packages.build.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/types",
"outDir": "./dist",
"rootDir": "./src"
},
"references": [
Expand Down
17 changes: 11 additions & 6 deletions packages/build-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/build-utils",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/build-utils",
Expand Down
2 changes: 1 addition & 1 deletion packages/build-utils/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.packages.build.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/types",
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["../../types", "./src"]
Expand Down
17 changes: 11 additions & 6 deletions packages/chain-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,24 @@
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:docs": "typedoc",
"changelog:update": "../../scripts/update-changelog.sh @metamask/chain-controller",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/chain-controller",
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-controller/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.packages.build.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/types",
"outDir": "./dist",
"rootDir": "./src",
"skipLibCheck": true
},
Expand Down
Loading
Loading