Skip to content

Commit

Permalink
Merge pull request #559 from thebuilder/beta
Browse files Browse the repository at this point in the history
  • Loading branch information
thebuilder authored Jun 14, 2022
2 parents 3d4534e + 0fa2241 commit ea76e44
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
"name": "react-intersection-observer",
"version": "8.26.1",
"description": "Monitor if a component is inside the viewport, using IntersectionObserver API",
"source": "src/index.tsx",
"main": "dist/react-intersection-observer.js",
"module": "dist/react-intersection-observer.m.js",
"unpkg": "dist/react-intersection-observer.umd.js",
"typings": "dist/index.d.ts",
"source": "./src/index.tsx",
"main": "./dist/react-intersection-observer.js",
"module": "./dist/react-intersection-observer.mjs",
"exports": {
"require": "./dist/react-intersection-observer.js",
"default": "./dist/react-intersection-observer.modern.mjs"
},
"unpkg": "./dist/react-intersection-observer.umd.js",
"typings": "./dist/index.d.ts",
"author": "Daniel Schmidt",
"sideEffects": false,
"repository": {
Expand Down Expand Up @@ -89,19 +93,19 @@
},
"size-limit": [
{
"path": "dist/react-intersection-observer.m.js",
"path": "dist/react-intersection-observer.mjs",
"name": "InView",
"import": "{ InView }",
"limit": "1.8 kB"
},
{
"path": "dist/react-intersection-observer.m.js",
"path": "dist/react-intersection-observer.mjs",
"name": "useInView",
"import": "{ useInView }",
"limit": "1.3 kB"
},
{
"path": "dist/react-intersection-observer.m.js",
"path": "dist/react-intersection-observer.mjs",
"name": "observe",
"import": "{ observe }",
"limit": "1 kB"
Expand Down
21 changes: 19 additions & 2 deletions scripts/build-copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,25 @@ packageFieldsToRemove.forEach((field) => {
});

// Remove 'dist' from the files inside the 'dist' dir, after we move them
const fields = ['main', 'module', 'unpkg', 'esmodule', 'exports', 'typings'];
fields.forEach((key) => (pck[key] = pck[key]?.replace('dist/', '')));
const fields = [
'main',
'module',
'unpkg',
'exports',
'esmodule',
'exports',
'typings',
];
fields.forEach((key) => {
if (typeof pck[key] === 'object') {
const keys = Object.keys(pck[key]);
keys.forEach((subkey) => {
pck[key][subkey] = pck[key][subkey]?.replace('./dist/', './');
});
} else {
pck[key] = pck[key]?.replace('./dist/', './');
}
});

fs.writeFileSync(
path.resolve(distDir, 'package.json'),
Expand Down

1 comment on commit ea76e44

@vercel
Copy link

@vercel vercel bot commented on ea76e44 Jun 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.