Everduin94 / better-commits

A CLI for creating better commits following the conventional commits specification
MIT License
1.88k stars 69 forks source link

Reduce Size: Replace Zod with Valibot #57

Closed Everduin94 closed 2 months ago

Everduin94 commented 6 months ago

Zod makes up 30% of the size of better-commits. Zod is crucial to better-commits, so it shouldn't simply be removed. But, better-commits is a very small project and uses a minimal amount of the Zod API.

Thus, replacing Zod with Valibot seems like a pretty good choice for a project of this size.

Action Items

Caveat: Better-commits makes use of advanced utilities like refine and transform. See this documentation for replacements. Namely, custom and transform

Caveat: Unsure of effort needed to replace Zod-Validation-Error

ravvi-kumar commented 3 months ago

Hi @Everduin94 , I would like to do this task. I will come up with my findings. And then, can you please assign this issue to me?

Everduin94 commented 3 months ago

@ravvi-kumar - Sure thing, just a heads up. Based on how the project is written, this is a deceptively large task.

ravvi-kumar commented 3 months ago

Hi @Everduin94,

I'm hoping to test the recent changes locally. Is there a recommended workflow for this?

Additionally, I'm currently encountering a blocker related to returning clear custom error messages . while I've been exploring the Valibot documentation on custom validation (custom validation documentation: https://valibot.dev/api/custom/), I'm still unsure about how to return clear error message like you are doing with zod's refine method. Could you provide some guidance on how to achieve this?

Everduin94 commented 3 months ago

@ravvi-kumar - Hey this looks like a great start. Give me a few days to get to helping on this.

This might help you on the custom error: https://github.com/fabian-hiller/valibot/discussions/361 - If not, I would post a question there

To test locally: npm run start. - I would either comment out the part that does git commit or just cancel every commit.

ravvi-kumar commented 3 months ago

@Everduin94 - hope this works 🤞, Btw, the test was passed https://github.com/fabian-hiller/valibot/pull/494

ravvi-kumar commented 3 months ago

Hi @Everduin94 , can you please review this PR https://github.com/Everduin94/better-commits/pull/89

Everduin94 commented 3 months ago

@ravvi-kumar - Sorry for the delay. I'll get to this when I have the chance. I've been busy at work + I have a 5 month old baby + I have a bjj tournament in a week. I bit off more than I can chew at the moment 😅

ravvi-kumar commented 3 months ago

@Everduin94 - congrats man and wish you good luck for you match. no issue, we can continue whenever you get a chance. 😊

github-actions[bot] commented 2 months ago

:tada: This issue has been resolved in version 1.15.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: