Skip to content

Commit 8796e88

Browse files
authored
Use ts-bridge for building (#175)
* Build package with ts-bridge * Remove `dom` from `lib`
1 parent 5ccc565 commit 8796e88

File tree

5 files changed

+62
-550
lines changed

5 files changed

+62
-550
lines changed

constraints.pro

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,18 @@ gen_enforced_field(WorkspaceCwd, 'repository.url', 'https://github.com/MetaMask/
6565
% The license for the package must be specified.
6666
gen_enforced_field(WorkspaceCwd, 'license').
6767

68-
% The type definitions entrypoint the package must be `./dist/types/index.d.ts`.
69-
gen_enforced_field(WorkspaceCwd, 'types', './dist/types/index.d.ts').
70-
gen_enforced_field(WorkspaceCwd, 'exports["."].types', './dist/types/index.d.ts').
68+
% The type definitions entrypoint the package must be `./dist/index.d.cts`.
69+
gen_enforced_field(WorkspaceCwd, 'types', './dist/index.d.cts').
7170

72-
% The entrypoint for the package must be `./dist/index.js`.
73-
gen_enforced_field(WorkspaceCwd, 'main', './dist/index.js').
74-
gen_enforced_field(WorkspaceCwd, 'exports["."].require', './dist/index.js').
71+
% The entrypoint for the package must be `./dist/index.cjs`.
72+
gen_enforced_field(WorkspaceCwd, 'main', './dist/index.cjs').
73+
gen_enforced_field(WorkspaceCwd, 'exports["."].require.types', './dist/index.d.cts').
74+
gen_enforced_field(WorkspaceCwd, 'exports["."].require.default', './dist/index.cjs').
7575

7676
% The module entrypoint for the package must be `./dist/index.mjs`.
7777
gen_enforced_field(WorkspaceCwd, 'module', './dist/index.mjs').
78-
gen_enforced_field(WorkspaceCwd, 'exports["."].import', './dist/index.mjs').
78+
gen_enforced_field(WorkspaceCwd, 'exports["."].import.types', './dist/index.d.mts').
79+
gen_enforced_field(WorkspaceCwd, 'exports["."].import.default', './dist/index.mjs').
7980

8081
gen_enforced_field(WorkspaceCwd, 'exports["./package.json"]', './package.json').
8182

package.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,26 @@
1414
"author": "kumavis",
1515
"exports": {
1616
".": {
17-
"import": "./dist/index.mjs",
18-
"require": "./dist/index.js",
19-
"types": "./dist/types/index.d.ts"
17+
"import": {
18+
"types": "./dist/index.d.mts",
19+
"default": "./dist/index.mjs"
20+
},
21+
"require": {
22+
"types": "./dist/index.d.cts",
23+
"default": "./dist/index.cjs"
24+
}
2025
},
2126
"./package.json": "./package.json"
2227
},
23-
"main": "./dist/index.js",
28+
"main": "./dist/index.cjs",
2429
"module": "./dist/index.mjs",
25-
"types": "./dist/types/index.d.ts",
30+
"types": "./dist/index.d.cts",
2631
"files": [
2732
"dist"
2833
],
2934
"scripts": {
30-
"build": "tsup && yarn build:types",
35+
"build": "ts-bridge --project tsconfig.build.json --clean",
3136
"build:docs": "typedoc",
32-
"build:types": "tsc --project tsconfig.build.json",
3337
"generate-vectors": "ts-node scripts/generate-vectors.ts > ./test/vectors/derivation.json",
3438
"lint": "yarn lint:eslint && yarn lint:constraints && yarn lint:misc --check && yarn lint:dependencies --check && yarn lint:changelog",
3539
"lint:changelog": "auto-changelog validate",
@@ -57,6 +61,7 @@
5761
"@metamask/eslint-config-jest": "^12.0.0",
5862
"@metamask/eslint-config-nodejs": "^12.0.0",
5963
"@metamask/eslint-config-typescript": "^12.0.0",
64+
"@ts-bridge/cli": "^0.1.4",
6065
"@types/jest": "^28.1.6",
6166
"@types/node": "^16.18.38",
6267
"@typescript-eslint/eslint-plugin": "^5.43.0",
@@ -76,7 +81,6 @@
7681
"prettier-plugin-packagejson": "^2.3.0",
7782
"ts-jest": "^28.0.7",
7883
"ts-node": "^10.9.1",
79-
"tsup": "^7.2.0",
8084
"typedoc": "^0.23.19",
8185
"typescript": "~4.8.4"
8286
},
@@ -90,8 +94,7 @@
9094
},
9195
"lavamoat": {
9296
"allowScripts": {
93-
"@lavamoat/preinstall-always-fail": false,
94-
"tsup>esbuild": true
97+
"@lavamoat/preinstall-always-fail": false
9598
}
9699
}
97100
}

tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"emitDeclarationOnly": true,
77
"inlineSources": true,
88
"noEmit": false,
9-
"outDir": "dist/types",
9+
"outDir": "dist",
1010
"rootDir": "src",
1111
"sourceMap": true
1212
},

tsup.config.ts

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

0 commit comments

Comments
 (0)