juliencrn / usehooks-ts

React hook library, ready to use, written in Typescript.
https://usehooks-ts.com
MIT License
6.42k stars 417 forks source link

Publish on npm? #26

Closed vfonic closed 3 years ago

vfonic commented 3 years ago

This great repo sounds like a great candidate for publishing on npm for easier updating and security auditing. If someone knows how to set it up, it could also support tree shaking, since each of the hooks is in its own file.

What do you think?

jeanlucmongrain commented 3 years ago

That is actualy the only reason I'm not using this project and star it. I don't add an abnormal installation step for a single dependency or copy & paste code, better to reuse properly

juliencrn commented 3 years ago

Thanks for the feedback guys. I think there are very good packages for hooks, well tested and with a ton of hooks (e.g. react-use).

So, my initial goal here wasn't do the same, but just giving some simple code as well for understanding purpose and to speed development too. My opinion is if I only need a pair of hooks, I prefer copy/paste there from a confidence source and keeping things simple.

I'm not a huge fan of packaging everything (cf: is-odd seems like a joke).

If you want to package some hooks from this project, here or somewhere else, feel free to do what you want.

The truth, I'm not really closed to package it, it may be a good idea too. I will consider it 👍

vfonic commented 3 years ago

To be fair to, now archived, is-odd package from 2014, copy-pasting code snippets in 2021 seems like a joke. What if you realize there's a bug in one of the hooks? What's easier: copy-pasting the new code snippet hook in every project that uses that hook or updating the package via npm? How would you inform the other developers, users of the hook with a bug that there's a bug? Should they check this repo regularly? Isn't there a faster way to check for updates?

What's faster?

  1. npm i useHooks.ts
  2. Switch to editor
  3. import { useBoolean } from 'useHooks.ts'
  4. Use the hook

or

  1. Open GitHub (if you're lucky enough, you'll have this repo bookmarked or have it locally so you'll cd into it)
  2. Open useBoolean.ts file (either on GitHub or locally)
  3. Select all, copy
  4. Switch back to main project
  5. File new => useBoolean.ts => make sure it's in the right directory
  6. Paste

Sorry for mini rant. I thought that since you put so much effort in creating all these hooks and the documentation website, it's such a shame that people like myself and @bclermont and others don't get to use it because of the last 1% needed to publish this. If you've never published a package this is a great opportunity to experience the whole process.

juliencrn commented 3 years ago

Thank you mate, you're right. I will do it

vfonic commented 3 years ago

You sir are a legend! 🚀 Thanks for the great work you've put into this!

EDIT: Unrelated, I figured that the link to your GH profile doesn't work in the footer of your portfolio website.

juliencrn commented 3 years ago

Oh man, good catch, thanks! 👏

jeanlucmongrain commented 3 years ago

As this issue had been closed, where is the package?

juliencrn commented 3 years ago

I re-open the issue as long as the branch isn't merged on master. It's coming soon

juliencrn commented 3 years ago

It's early stage, but it's now available on npm!

vfonic commented 2 years ago

You just got featured all over the place! 🎉 I've seen the link to this npm package in at least two newsletters. :)

I hope it doesn't come with too many issues, but hopefully we all benefit from bugs found and new contributions.