ts-to-zod
ts-to-zod copied to clipboard
Append created types to specified file, if that file already exists.
Feature description
Allow types to be added to existing file, rather than overwriting a file that may exist.
Input
npm ts-to-zod src/iDontTrustThisApi.ts src/nowIcanValidateEverything.ts
Output
if src/nowIcanValidateEverything.ts
exists, add output to end of file. Otherwise create file.
Feel free to create a PR!
Hello @sp88011,
When you write:
if src/nowIcanValidateEverything.ts exists, add output to end of file. Otherwise create file.
👉 what would be the behaviour is we call npm ts-to-zod src/iDontTrustThisApi.ts src/nowIcanValidateEverything.ts
several times in a row (because iDontTrustThisApi.ts
has been modified)?
Appending the generation output of nowIcanValidateEverything.ts
which already contains a previous version of the generated Zod validators would lead to a messy file, wouldn't it?
Could you share a bit more about your use case?