Skip to content

Commit 0980efa

Browse files
committed
feat: remove script to publish dist dir
When publishing, all required files were copied into the `dist` dir, and it was published as the "root". Because of ESM exports, it's now possible to cleanly expose the `test-utils` with exposing "dist" in the imports.
1 parent 7feb5b6 commit 0980efa

4 files changed

Lines changed: 11 additions & 88 deletions

File tree

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,26 @@
1919
"default": "./dist/index.mjs"
2020
}
2121
},
22+
"files": ["dist"],
2223
"author": "Daniel Schmidt",
2324
"license": "MIT",
2425
"sideEffects": false,
2526
"repository": {
2627
"type": "git",
2728
"url": "https://github.com/thebuilder/react-intersection-observer.git"
2829
},
29-
"engines": {
30-
"pnpm": ">=9"
31-
},
3230
"packageManager": "pnpm@9.5.0+sha256.dbdf5961c32909fb030595a9daa1dae720162e658609a8f92f2fa99835510ca5",
3331
"scripts": {
3432
"prebuild": "rm -rf dist lib",
3533
"build": "run-s build:*",
3634
"build:bundle": "tsup src/index.tsx",
3735
"build:legacy": "tsup src/index.tsx --format esm --legacy-output --no-clean --no-dts",
3836
"build:utils": "tsup src/test-utils.ts --no-clean --no-sourcemap",
39-
"build:copy": "node scripts/build-copy.cjs",
4037
"postbuild": "size-limit",
4138
"dev": "run-p dev:*",
4239
"dev:package": "tsup src/index.tsx --watch",
4340
"dev:storybook": "pnpm --filter storybook dev",
4441
"lint": "biome check .",
45-
"release": "np --contents dist",
4642
"version": "pnpm build",
4743
"storybook:build": "pnpm build:bundle && pnpm --filter storybook build",
4844
"test": "vitest"

pnpm-lock.yaml

Lines changed: 9 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build-copy.cjs

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

src/test-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ afterEach(() => {
5858
* Create a custom IntersectionObserver mock, allowing us to intercept the `observe` and `unobserve` calls.
5959
* We keep track of the elements being observed, so when `mockAllIsIntersecting` is triggered it will
6060
* know which elements to trigger the event on.
61-
* @param mockFn The mock function to use. Defaults to `jest.fn`.
61+
* @param mockFn The mock function to use. Defaults to `vi.fn`.
6262
*/
6363
export function setupIntersectionMocking(mockFn: typeof jest.fn) {
6464
global.IntersectionObserver = mockFn((cb, options = {}) => {

0 commit comments

Comments
 (0)