-
Notifications
You must be signed in to change notification settings - Fork 16
feat(models): add generic artifact generation to enable caching #1023
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found couple of improvements and many unrelated changes. Please review your PRs changes with focus.
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit c27a5c4 with previous commit 562c83b. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 2 groups improved, 👎 1 group regressed, 👍 7 audits improved, 👎 2 audits regressed, 11 audits changed without impacting score🗃️ Groups
18 other groups are unchanged. 🛡️ Audits
585 other audits are unchanged. |
export const artifactGenerationCommand = z.object({ | ||
command: z.string({ description: 'Generate artefact files' }).min(1), | ||
args: z | ||
.array(z.string(), { | ||
description: 'Arguments to be passed to the artefact generation command.', | ||
}) | ||
.optional(), | ||
}); | ||
|
||
export type ArtefactGenerationCommand = z.infer< | ||
typeof artifactGenerationCommand | ||
>; | ||
|
||
export const pluginArtefactOptionsSchema = z.object({ | ||
generateArtefacts: artifactGenerationCommand.optional(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're standardizing the configuration, maybe a good time to agree on what's a more user-friendly way to configure commands.
Currently, the user has to do something like { command: 'yarn', args: ['test', '--coverage'] }
. But why not let them simply provide 'yarn test --coverage'
? It's both less verbose and more intuitive, I think 🤔
We could also theoretically support a union of both object and string, but I think that would be unnecessarily complicated.
@BioPhoton @vmasek What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember thinking the same some time ago and I was up for supporting both especially so we don't introduce a breaking change (and maybe deprecating the object with args), but really I see no issue to having both
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndriiSiuta Could you please add support for string commands? As I understand it, the consensus is both of these should be valid:
-
{ generateArtifactsCommand: 'yarn test --coverage', artifactsPath: 'coverage/lcov.info', }
-
{ generateArtifactsCommand: { command: 'yarn', args: ['test', '--coverage'], }, artifactsPath: 'coverage/lcov.info', }
The schema validation can be implemented with a z.union([...])
.
Closes #1021