-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor: cache project context in toolbox to avoid passing it everywhere #115
base: main
Are you sure you want to change the base?
Conversation
src/commands/setup-ci.ts
Outdated
toolbox.interactive.surveyStep( | ||
'Created snapshot of project state before execution.' | ||
) | ||
|
||
context.selectedOptions = await getSelectedOptions(toolbox) | ||
toolbox.context.selectedOptions = await getSelectedOptions(toolbox) |
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'd prefer a setter here and possibly in other places getter instead of just toolbox.context.variable -> so noone is tempted to write (override) something
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 was never really happy with the fact that we kept selectedOptions
in context, I now created new small extension ConfigExtension
which manages the cli configuration - my idea is that it will be the information about what recipes should be generated for what branches, what vendor etc.
For now our config is very simple, it's just a subset of available recipes. So basically I extracted the layer obtaining this information (from flags in case of --preset
provided and otherwise from survey) to ConfigExtension
Now you have to use toolbox.config.selectedRecipes()
instead of toolbox.context.selectedOptions
, so also no way to accidentally override the config
Resolves #43