Skip to content

Commit

Permalink
feat: fix package exports and simplify build (#695)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
RobinTail and thebuilder authored Jul 11, 2024
1 parent 054adf4 commit c9cef8f
Show file tree
Hide file tree
Showing 4 changed files with 280 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ reports
example
lib/
dist/
test-utils/
coverage/
nuget
npm-debug.log*
Expand Down
35 changes: 22 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,27 @@
"types": "dist/index.d.ts",
"exports": {
"./test-utils": {
"types": "./dist/test-utils.d.mts",
"require": "./dist/test-utils.js",
"default": "./dist/test-utils.mjs"
"import": {
"types": "./test-utils/index.d.mts",
"default": "./test-utils/index.mjs"
},
"require": {
"types": "./test-utils/index.d.ts",
"default": "./test-utils/index.js"
}
},
".": {
"types": "./dist/index.d.mts",
"require": "./dist/index.js",
"default": "./dist/index.mjs"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"files": ["dist"],
"files": ["dist", "test-utils"],
"author": "Daniel Schmidt",
"license": "MIT",
"sideEffects": false,
Expand All @@ -30,17 +40,14 @@
"packageManager": "pnpm@9.5.0+sha256.dbdf5961c32909fb030595a9daa1dae720162e658609a8f92f2fa99835510ca5",
"scripts": {
"prebuild": "rm -rf dist lib",
"build": "run-s build:*",
"build:bundle": "tsup src/index.tsx",
"build:legacy": "tsup src/index.tsx --format esm --legacy-output --no-clean --no-dts",
"build:utils": "tsup src/test-utils.ts --no-clean --no-sourcemap",
"postbuild": "size-limit",
"build": "tsup && mkdir dist/esm && cp dist/index.mjs dist/esm/index.js",
"postbuild": "attw --pack && publint && size-limit",
"dev": "run-p dev:*",
"dev:package": "tsup src/index.tsx --watch",
"dev:storybook": "pnpm --filter storybook dev",
"lint": "biome check .",
"version": "pnpm build",
"storybook:build": "pnpm build:bundle && pnpm --filter storybook build",
"storybook:build": "pnpm build && pnpm --filter storybook build",
"test": "vitest",
"test:browser": "vitest --workspace=vitest.workspace.ts"
},
Expand Down Expand Up @@ -104,6 +111,7 @@
"react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
"@biomejs/biome": "^1.8.3",
"@size-limit/preset-small-lib": "^11.1.4",
"@testing-library/jest-dom": "^6.4.6",
Expand All @@ -118,6 +126,7 @@
"microbundle": "^0.15.1",
"npm-run-all": "^4.1.5",
"playwright": "^1.45.1",
"publint": "^0.2.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"simple-git-hooks": "^2.11.1",
Expand Down
Loading

0 comments on commit c9cef8f

Please sign in to comment.