feat: allow index files customization#2058
feat: allow index files customization#2058maastrich wants to merge 3 commits intoorval-labs:masterfrom
Conversation
|
I've an update for the readme if you want me to add it in the pull request 👀 |
|
Sure |
|
Hey @melloware, I've pushed it with my last commit |
|
OK i have added some others for review |
AllieJonsson
left a comment
There was a problem hiding this comment.
Thanks for your contribution, I added a few comments!
| }; | ||
|
|
||
| const normalizeIndexFiles = ( | ||
| indexFiles: OutputIndexFiles | boolean | undefined = true, |
There was a problem hiding this comment.
We don't need to have the default value of the param here
| indexFiles: OutputIndexFiles | boolean | undefined = true, | ||
| ): NormalizedOutputIndexFiles => { | ||
| if (isBoolean(indexFiles)) { | ||
| return indexFiles |
There was a problem hiding this comment.
Add a const defaultIndexFiles or similar and use it here and in the case where indexFiles is not a boolean
There was a problem hiding this comment.
I'm not sure we should have a file like this, why not just add these cases to their respective config file react-query.config.ts and zod.config.ts?
| return { | ||
| workspace: (implementations: string[]) => implementations, | ||
| schemas: (schemas: GeneratorSchema[]) => schemas, | ||
| ...indexFiles, |
There was a problem hiding this comment.
If a user puts
{
schemas: undefined
}in the config, we will get undefined here. I'd suggest doing something like
const defaultIndex = {
workspace: (implementations: string[]) => implementations,
schemas: (schemas: GeneratorSchema[]) => schemas,
};
return {
workspace: indexFiles.workspace ?? defaultIndex.workspace,
schemas: indexFiles.schemas ?? defaultIndex.schemas,
};
Status
READY
Related
Fix #2044
Description
add a way to customize index files:
add a way to expose custom files:
Steps to Test or Reproduce
generated/multi-client/*index.tsin each client, it should only include files that were exposed (no models)./extrafiles/index