Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌳Maintainance Update (v8.0.0) #227

Merged
merged 13 commits into from
Jan 17, 2023
Merged

🌳Maintainance Update (v8.0.0) #227

merged 13 commits into from
Jan 17, 2023

Conversation

snelsi
Copy link
Collaborator

@snelsi snelsi commented Jan 8, 2023

This PR is a combination of various fixes, project setup improvements, and chore/dependencies updates.

It includes some major (and possibly breaking) changes, so make sure to test it before the release. Also, please consider releasing this as a new major version (v8).

✅ ChangeLog:

Dependencies

  • Update all dev dependencies to the latest version
  • Remove unused/redundant dependencies
  • Regenerate yarn.lock

Docs

  • Update License copyright year to 2023
  • Fix License copyright name

Refactor

  • Minor code cleanup
  • Remove redundant isSSR check inside the useEffect hook
  • Cleanup examples, remove unused imports

Types

  • Add missing TS types
  • Fixed some problematic TS types
  • Swap any with unknown where possible
  • Add stricter template requirements for the useResizeDetector hook

Eslint + Prettier

  • Add proper Eslint + Prettier setup
  • Remove redundant .vscode prettier config
  • Remove redundant formatting rules inside .eslintrc
  • Add formatting and linting related scripts to package.json:
    • prettier - run Prettier formatting on all files,
    • lint - run Eslint linting on all files,
    • lint-fix - run Eslint linting on all files and fix all auto-fixable problems,
    • fix - run both Prettier + Eslint
  • Run prettier + eslint fix for all files, fix eslint errors and warnings

Rollup v3

  • Update to Rollup v3
  • Update plugins config:
    • rollup-plugin-typescript2 => @rollup/plugin-typescript
    • @rollup/plugin-terser added
    • rollup-plugin-node-externals added
  • Add export of ResizeDetectorProps and useResizeDetectorProps types in the root
  • Add missing prepublishOnly script

⚠️ Breaking Changes:

  • Generated TS types inside the build folder moved to the types folder
  • Remove the deprecated withPolyfill.d.ts file
  • ComponentsProps => ResizeDetectorProps
  • patchResizeHandlerType => PatchedResizeObserverCallback
  • If both handleWidth and handleHeight are turned off, ResizeObserver and resizeCallback won't be created

Testing Fork

You can test this PR by installing my fork npm i @snelsi/react-resize-detector:
https://www.npmjs.com/package/@snelsi/react-resize-detector

Note about Terser and Build size In my tests adding `terser` rollup plugin reduces the build output from ~200kb to ~56kb `(-72% reduction)` by removing comments, and spaces, and minimizing variable names:

image

But it uglifies the source code, so I'm not sure if it makes sense to keep it or not. Will probably remove it after some more
testing.

@snelsi snelsi added enhancement help wanted dependencies Pull requests that update a dependency file typescript labels Jan 8, 2023
@snelsi snelsi requested a review from maslianok January 8, 2023 23:14
@snelsi snelsi self-assigned this Jan 8, 2023
@snelsi snelsi changed the title Maintainance Update (v8.0.0) 🌳Maintainance Update (v8.0.0) Jan 8, 2023
@snelsi snelsi changed the title 🌳Maintainance Update (v8.0.0) 🌳Maintainance Update __(v8.0.0)__ Jan 8, 2023
@snelsi snelsi changed the title 🌳Maintainance Update __(v8.0.0)__ 🌳Maintainance Update _(v8.0.0)_ Jan 8, 2023
@snelsi snelsi changed the title 🌳Maintainance Update _(v8.0.0)_ 🌳Maintainance Update (v8.0.0) Jan 8, 2023
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Denis Rul
Copyright (c) 2023 Vitalii Maslianok
Copy link
Owner

Choose a reason for hiding this comment

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

🤣

@@ -1,4 +1,4 @@
# Handle element resizes like it's 2022!
# Handle element resizes like it's 2023!
Copy link
Owner

Choose a reason for hiding this comment

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

🎄

Copy link
Owner

@maslianok maslianok left a comment

Choose a reason for hiding this comment

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

WOW! 😲
Thank you so much for this PR 👏 Well done!

@maslianok maslianok merged commit c4333a6 into maslianok:master Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement help wanted typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants