Skip to content

Commit 05236e7

Browse files
committed
feat: export .mts for test-utils
Compile `test-utils` with tsup instead of plain `tsc`, and add the `test-utils.d.mts` file to the types in package.json. This should ensure it can be consumed correctly in a modern setup. Keeps the old adjacent `test-utils.d.ts` for legacy. The `tsconfig.test.json` is no longer needed
1 parent c72a939 commit 05236e7

4 files changed

Lines changed: 735 additions & 689 deletions

File tree

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
"types": "./dist/index.d.ts",
99
"exports": {
1010
"./test-utils": {
11-
"types": "./dist/test-utils.d.ts",
12-
"default": "./dist/test-utils.js"
11+
"types": "./dist/test-utils.d.mts",
12+
"require": "./dist/test-utils.js",
13+
"default": "./dist/test-utils.mjs"
1314
},
1415
".": {
1516
"types": "./dist/index.d.mts",
@@ -29,7 +30,7 @@
2930
"build": "run-s build:*",
3031
"build:bundle": "tsup src/index.tsx",
3132
"build:legacy": "tsup src/index.tsx --format esm --legacy-output --no-clean --no-dts",
32-
"build:utils": "tsc -p tsconfig.test.json",
33+
"build:utils": "tsup src/test-utils.ts --no-clean --no-sourcemap",
3334
"build:copy": "node scripts/build-copy.cjs",
3435
"postbuild": "size-limit",
3536
"dev": "run-p dev:*",
@@ -74,7 +75,7 @@
7475
]
7576
},
7677
"simple-git-hooks": {
77-
"pre-commit": "npx lint-staged && vitest run"
78+
"pre-commit": "npx lint-staged"
7879
},
7980
"lint-staged": {
8081
"*.{js,json,css,md,ts,tsx}": [
@@ -108,13 +109,13 @@
108109
"devDependencies": {
109110
"@biomejs/biome": "^1.5.3",
110111
"@size-limit/preset-small-lib": "^11.0.2",
111-
"@testing-library/jest-dom": "^6.4.1",
112+
"@testing-library/jest-dom": "^6.4.2",
112113
"@testing-library/react": "^14.2.1",
113114
"@types/jest": "^29.5.12",
114-
"@types/react": "^18.2.51",
115-
"@types/react-dom": "^18.2.18",
115+
"@types/react": "^18.2.55",
116+
"@types/react-dom": "^18.2.19",
116117
"jsdom": "^24.0.0",
117-
"lint-staged": "^15.2.1",
118+
"lint-staged": "^15.2.2",
118119
"microbundle": "^0.15.1",
119120
"npm-run-all": "^4.1.5",
120121
"react": "^18.2.0",

0 commit comments

Comments
 (0)