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

Use ts-bridge for building #182

Merged
merged 2 commits into from
Apr 23, 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
18 changes: 0 additions & 18 deletions .swcrc.build.json

This file was deleted.

17 changes: 9 additions & 8 deletions constraints.pro
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ gen_enforced_field(WorkspaceCwd, 'repository.url', 'https://github.com/MetaMask/
% The license for the package must be specified.
gen_enforced_field(WorkspaceCwd, 'license').

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

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

% The module entrypoint for the package must be `./dist/esm/index.js`.
% The module entrypoint for the package must be `./dist/index.mjs`.
gen_enforced_field(WorkspaceCwd, 'module', './dist/index.mjs').
gen_enforced_field(WorkspaceCwd, 'exports["."].import', './dist/index.mjs').
gen_enforced_field(WorkspaceCwd, 'exports["."].import.types', './dist/index.d.mts').
gen_enforced_field(WorkspaceCwd, 'exports["."].import.default', './dist/index.mjs').

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

Expand Down
37 changes: 23 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,36 @@
"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"
}
},
"./node": {
"import": "./dist/node.mjs",
"require": "./dist/node.js",
"types": "./dist/types/node.d.ts"
"import": {
"types": "./dist/node.d.mts",
"default": "./dist/node.mjs"
},
"require": {
"types": "./dist/node.d.cts",
"default": "./dist/node.cjs"
}
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/types/index.d.ts",
"types": "./dist/index.d.cts",
"files": [
"dist"
],
"scripts": {
"build": "tsup && yarn build:types",
"build": "ts-bridge --project tsconfig.build.json --clean",
"build:docs": "typedoc",
"build:types": "tsc --project tsconfig.build.json",
"lint": "yarn lint:eslint && yarn lint:constraints && yarn lint:misc --check && yarn lint:dependencies --check && yarn lint:changelog",
"lint:changelog": "auto-changelog validate",
"lint:constraints": "yarn constraints",
Expand Down Expand Up @@ -70,9 +79,11 @@
"@metamask/eslint-config-jest": "^12.0.0",
"@metamask/eslint-config-nodejs": "^12.0.0",
"@metamask/eslint-config-typescript": "^12.0.0",
"@ts-bridge/cli": "^0.1.2",
"@ts-bridge/shims": "^0.1.1",
"@types/jest": "^28.1.7",
"@types/jest-when": "^3.5.3",
"@types/node": "^17.0.23",
"@types/node": "^20.12.7",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
Expand All @@ -94,7 +105,6 @@
"ts-jest": "^29.0.3",
"ts-node": "^10.7.0",
"tsd": "^0.29.0",
"tsup": "^7.2.0",
"typedoc": "^0.23.15",
"typescript": "~4.8.4"
},
Expand All @@ -108,8 +118,7 @@
},
"lavamoat": {
"allowScripts": {
"@lavamoat/preinstall-always-fail": false,
"tsup>esbuild": true
"@lavamoat/preinstall-always-fail": false
}
},
"tsd": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ if [[ -n $SKIP_PREPACK ]]; then
exit 0
fi

yarn build:clean
yarn build
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"emitDeclarationOnly": true,
"inlineSources": true,
"noEmit": false,
"outDir": "dist/types",
"outDir": "dist",
"rootDir": "src",
"sourceMap": true
},
Expand Down
40 changes: 0 additions & 40 deletions tsup.config.ts

This file was deleted.

Loading
Loading