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

split task/plugin options #569

Merged
merged 18 commits into from
Apr 10, 2024
Merged

Conversation

apaleslimghost
Copy link
Member

@apaleslimghost apaleslimghost commented Jan 15, 2024

this PR adds support for loading task options from .toolkitrc.ymls, validating them against (task-option-specific) schemas, and passing those into the task constructors as an argument (separate from plugin options, which has been renamed to this.pluginOptions, and avoiding merging them with plugin options to make it clearer for task authors)

this PR does not yet implement any actual task options. that's a much bigger task; i've made a start in #570.

@apaleslimghost apaleslimghost marked this pull request as ready for review January 16, 2024 12:38
@apaleslimghost apaleslimghost requested a review from a team as a code owner January 16, 2024 12:38
@apaleslimghost apaleslimghost changed the title WIP split task/plugin options split task/plugin options Jan 16, 2024
Copy link
Contributor

@ivomurrell ivomurrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall! I'll be interested to see the outcomes of the PRs to add the task options to be able to judge if the change justifies the increase in code complexity but on first glance I agree that it will make configuration less mysterious to the user.

there's a few places where we're missing behaviour parity between plugin options and task options that we'll need to copy over

core/cli/src/config.ts Outdated Show resolved Hide resolved
core/cli/src/config.ts Outdated Show resolved Hide resolved
core/cli/src/help.ts Show resolved Hide resolved
core/cli/src/install.ts Show resolved Hide resolved
core/cli/src/plugin/options.ts Show resolved Hide resolved
@@ -194,6 +196,8 @@ const isPartialOptional = (partial: ZodPartial): partial is z.ZodOptional<z.ZodT
typeof (partial as z.ZodOptional<z.ZodTypeAny>).unwrap === 'function'

export default async ({ logger, config, toolKitConfig, configPath }: OptionsParams): Promise<boolean> => {
toolKitConfig.options.plugins = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: we should be prompting for task options at the same time as plugin options (using the same optionsPromptForPlugin function preferably)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll do this after we have task options in place (#570). this doesn't feel essential for this PR

lib/config/src/index.ts Outdated Show resolved Hide resolved
lib/options/src/index.ts Show resolved Hide resolved
lib/base/src/task.ts Outdated Show resolved Hide resolved
lib/base/src/task.ts Show resolved Hide resolved
@ivomurrell ivomurrell force-pushed the next branch 2 times, most recently from 761ec5f to 83c4594 Compare April 3, 2024 10:39
@apaleslimghost apaleslimghost changed the base branch from next to old-next April 3, 2024 11:15
@apaleslimghost apaleslimghost force-pushed the CPP-1852-task-vs-plugin-options branch from 25ff6e9 to f3336e0 Compare April 3, 2024 14:15
@apaleslimghost apaleslimghost changed the base branch from old-next to next April 3, 2024 14:15
@apaleslimghost apaleslimghost force-pushed the CPP-1852-task-vs-plugin-options branch from f3336e0 to 4513ac6 Compare April 3, 2024 14:47
@apaleslimghost apaleslimghost force-pushed the CPP-1852-task-vs-plugin-options branch from 30d913f to 73ed836 Compare April 8, 2024 10:34
@apaleslimghost apaleslimghost changed the base branch from next to update-prettier April 8, 2024 10:34
@apaleslimghost apaleslimghost force-pushed the CPP-1852-task-vs-plugin-options branch 2 times, most recently from c6edc15 to c365a95 Compare April 8, 2024 10:51
Base automatically changed from update-prettier to next April 9, 2024 11:54
core/cli/src/config.ts Outdated Show resolved Hide resolved
@apaleslimghost apaleslimghost force-pushed the CPP-1852-task-vs-plugin-options branch from b8590ce to 2b0ccad Compare April 9, 2024 16:45
@apaleslimghost apaleslimghost merged commit d34e2ad into next Apr 10, 2024
15 checks passed
@apaleslimghost apaleslimghost deleted the CPP-1852-task-vs-plugin-options branch April 10, 2024 13:09
ivomurrell pushed a commit that referenced this pull request Sep 5, 2024
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

Successfully merging this pull request may close these issues.

2 participants