Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve prefix and suffix options #11

Open
TonyGravagno opened this issue Jul 10, 2023 · 0 comments
Open

Improve prefix and suffix options #11

TonyGravagno opened this issue Jul 10, 2023 · 0 comments

Comments

@TonyGravagno
Copy link
Owner

The 'suffix' option only applies to the filename. The new 'modify' option applies to both the filename and the schema const.

Enhance this to be more specific : A third array value in modify can specify how the modifications are applied :

- Add an enum with modification types : file, schema, type
- The third array value will be an array with any of those values. Examples:


["/address/", "_Address", [ 'schema' , 'type' ] ]
export const userAddress // undescore removed in camelCasing
export type userAddressType
filename remains useraddress.ts

["^log(.$)", "schema_$1_log", [ 'file' ] ]
export const logaudits
export type logauditsType
filename schema_audits_log.ts

["/address/", "_Address", [ 'schema' , 'type' ] ]
["^", "schema_", [ 'file' ] ]
["$", "Schema", [ 'schema' ] ]
["$", "ZodType", [ 'type' ] ]
export const userAddressSchema
export type userAddressZodType
filename schema_useraddress.ts // preference, don't capitalize for Linux

Going forward this can be used as an alternative/replacement for the suffix option. It also eliminates the hardcoded `${typeName}Type`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant