cloudinary-community / cloudinary-util

https://cloudinary-util.vercel.app
MIT License
12 stars 19 forks source link

refactor: migrate Zod to pure TS w/ JSDoc, improve type safety and simplify parsing #217

Closed ssalbdivad closed 1 month ago

ssalbdivad commented 1 month ago

Description

This PR migrates the repo off of Zod schemas toward pure TS with JSDoc annotations that can eventually be used to extract metadata for display in docs.

Generally the external behavior should be identical, with obvious exceptions where schema entry points are no longer available etc., so this would constitute a breaking change for consumers relying on those entrypoints or whose inputs may no longer be valid with new type safety around video/image options.

I've also updated all the tests to .ts so we can be sure the types for the API are working as we expect going forward.

Although all the tests are passing, the doc generation issue remains unsolved, causing the repo-wide build to fail, so that will need to be updated to use a JSDoc parsing tool. However, it should be quite straightforward to wire that up in place of the previous Zod-embedded metadata.

For now, I'm opening this against the beta branch so the required JSDoc parsing logic can be added and other changes can be experimented with before broader consumption.

Issue Ticket Number

N/A

Type of change

Checklist

(Still a draft, need to figure out how to work around missing schemas in build)

colbyfayock commented 1 month ago

lets get this into a beta branch!

github-actions[bot] commented 1 month ago

:tada: This PR is included in version @cloudinary-util/util-v5.0.0-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 1 month ago

:tada: This PR is included in version @cloudinary-util/url-loader-v6.0.0-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 1 month ago

:tada: This PR is included in version @cloudinary-util/types-v2.0.0-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: