Skip to content

Commit c9cef8f

Browse files
feat: fix package exports and simplify build (#695)
* Add attw tool. * Fix build and exports. * Restoring module entry for webpack case. * Disabling sourcemaps for test utils (like it was before). * ci: fix build and add publint (#1) --------- Co-authored-by: Daniel Schmidt <3764345+thebuilder@users.noreply.github.com>
1 parent 054adf4 commit c9cef8f

File tree

4 files changed

+280
-18
lines changed

4 files changed

+280
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ reports
55
example
66
lib/
77
dist/
8+
test-utils/
89
coverage/
910
nuget
1011
npm-debug.log*

package.json

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,27 @@
99
"types": "dist/index.d.ts",
1010
"exports": {
1111
"./test-utils": {
12-
"types": "./dist/test-utils.d.mts",
13-
"require": "./dist/test-utils.js",
14-
"default": "./dist/test-utils.mjs"
12+
"import": {
13+
"types": "./test-utils/index.d.mts",
14+
"default": "./test-utils/index.mjs"
15+
},
16+
"require": {
17+
"types": "./test-utils/index.d.ts",
18+
"default": "./test-utils/index.js"
19+
}
1520
},
1621
".": {
17-
"types": "./dist/index.d.mts",
18-
"require": "./dist/index.js",
19-
"default": "./dist/index.mjs"
22+
"import": {
23+
"types": "./dist/index.d.mts",
24+
"default": "./dist/index.mjs"
25+
},
26+
"require": {
27+
"types": "./dist/index.d.ts",
28+
"default": "./dist/index.js"
29+
}
2030
}
2131
},
22-
"files": ["dist"],
32+
"files": ["dist", "test-utils"],
2333
"author": "Daniel Schmidt",
2434
"license": "MIT",
2535
"sideEffects": false,
@@ -30,17 +40,14 @@
3040
"packageManager": "pnpm@9.5.0+sha256.dbdf5961c32909fb030595a9daa1dae720162e658609a8f92f2fa99835510ca5",
3141
"scripts": {
3242
"prebuild": "rm -rf dist lib",
33-
"build": "run-s build:*",
34-
"build:bundle": "tsup src/index.tsx",
35-
"build:legacy": "tsup src/index.tsx --format esm --legacy-output --no-clean --no-dts",
36-
"build:utils": "tsup src/test-utils.ts --no-clean --no-sourcemap",
37-
"postbuild": "size-limit",
43+
"build": "tsup && mkdir dist/esm && cp dist/index.mjs dist/esm/index.js",
44+
"postbuild": "attw --pack && publint && size-limit",
3845
"dev": "run-p dev:*",
3946
"dev:package": "tsup src/index.tsx --watch",
4047
"dev:storybook": "pnpm --filter storybook dev",
4148
"lint": "biome check .",
4249
"version": "pnpm build",
43-
"storybook:build": "pnpm build:bundle && pnpm --filter storybook build",
50+
"storybook:build": "pnpm build && pnpm --filter storybook build",
4451
"test": "vitest",
4552
"test:browser": "vitest --workspace=vitest.workspace.ts"
4653
},
@@ -104,6 +111,7 @@
104111
"react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
105112
},
106113
"devDependencies": {
114+
"@arethetypeswrong/cli": "^0.15.3",
107115
"@biomejs/biome": "^1.8.3",
108116
"@size-limit/preset-small-lib": "^11.1.4",
109117
"@testing-library/jest-dom": "^6.4.6",
@@ -118,6 +126,7 @@
118126
"microbundle": "^0.15.1",
119127
"npm-run-all": "^4.1.5",
120128
"playwright": "^1.45.1",
129+
"publint": "^0.2.8",
121130
"react": "^18.3.1",
122131
"react-dom": "^18.3.1",
123132
"simple-git-hooks": "^2.11.1",

0 commit comments

Comments
 (0)