Skip to content

Commit

Permalink
feat: remove script to publish dist dir
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thebuilder committed Jul 10, 2024
1 parent 7feb5b6 commit 0980efa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 88 deletions.
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,26 @@
"default": "./dist/index.mjs"
}
},
"files": ["dist"],
"author": "Daniel Schmidt",
"license": "MIT",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/thebuilder/react-intersection-observer.git"
},
"engines": {
"pnpm": ">=9"
},
"packageManager": "[email protected]+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",
"build:copy": "node scripts/build-copy.cjs",
"postbuild": "size-limit",
"dev": "run-p dev:*",
"dev:package": "tsup src/index.tsx --watch",
"dev:storybook": "pnpm --filter storybook dev",
"lint": "biome check .",
"release": "np --contents dist",
"version": "pnpm build",
"storybook:build": "pnpm build:bundle && pnpm --filter storybook build",
"test": "vitest"
Expand Down
20 changes: 9 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 0 additions & 71 deletions scripts/build-copy.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion src/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ afterEach(() => {
* Create a custom IntersectionObserver mock, allowing us to intercept the `observe` and `unobserve` calls.
* We keep track of the elements being observed, so when `mockAllIsIntersecting` is triggered it will
* know which elements to trigger the event on.
* @param mockFn The mock function to use. Defaults to `jest.fn`.
* @param mockFn The mock function to use. Defaults to `vi.fn`.
*/
export function setupIntersectionMocking(mockFn: typeof jest.fn) {
global.IntersectionObserver = mockFn((cb, options = {}) => {
Expand Down

0 comments on commit 0980efa

Please sign in to comment.