Reduce Size: Replace Zod with Valibot
Everduin94 opened this issue Β· comments
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
- Replace Zod with Valibot
- Replace Zod-Validation-Error
- Remove Zod
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
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?
@ravvi-kumar - Sure thing, just a heads up. Based on how the project is written, this is a deceptively large task.
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?
@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: fabian-hiller/valibot#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.
@Everduin94 -
hope this works π€,
Btw, the test was passed fabian-hiller/valibot#494
Hi @Everduin94 ,
can you please review this PR #89
@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 π
@Everduin94 - congrats man and wish you good luck for you match. no issue, we can continue whenever you get a chance. π
π This issue has been resolved in version 1.15.1 π
The release is available on:
Your semantic-release bot π¦π