feat(config/modes): lay groundwork for multiple configuration structures - #142
Conversation
| .array( | ||
| z.object({ | ||
| folder: z.string(), | ||
| actorFullName: z.string().regex(/^[a-z0-9_.-]+\/[a-z0-9_.-]+$/), |
There was a problem hiding this comment.
We can actually use the ones from apify/const https://github.com/apify/apify-shared-js/blob/4b158ab55dfcb0d65265a5503ff069b76a1d276f/packages/consts/src/consts.ts#L148
There was a problem hiding this comment.
i had it but the code looked deranged.
I'll add them back then
There was a problem hiding this comment.
added them @ruocco-l.
It's kinda sus tho, would be great for them to expose an actorFullName regex (with ~ or /)
metalwarrior665
left a comment
There was a problem hiding this comment.
I think this might be a bit of overkill as the different formats will likely be very similar extensions of each other. But it is not that much code and we can refactor later.
| [CONFIG_FILE_STRATEGY.LEGACY]: LEGACY_PARSER, | ||
| } as const; | ||
|
|
||
| const ModeSelectionSchema = z.enum(CONFIG_FILE_STRATEGY).default(CONFIG_FILE_STRATEGY.LEGACY); |
There was a problem hiding this comment.
How does it pick if the file satisfies multiple parsers?
There was a problem hiding this comment.
they are an enum, so it can only match one. You explicitly state the resolution method and if not, legacy is the default (which is the current method we use). That way this is backwards compatible and users can pick different methods according to what they think is more comfortable.
Added groundwork for multiple config structures, named current one as
legacy.Adding a new one should be simple since all post-processing is done in shared code.
To add a new one you need to:
I still need to do some test trimming.
NOTE:
load-config.test.tsis renamedactor-config.test.tswith a few additions/deletions.Made sure both were green before getting rid of
actor-config