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

expand scope of allowable fields for targetDefaults #12433

Closed
1 task done
seansfkelley opened this issue Oct 5, 2022 · 2 comments · Fixed by #12435
Closed
1 task done

expand scope of allowable fields for targetDefaults #12433

seansfkelley opened this issue Oct 5, 2022 · 2 comments · Fixed by #12435
Assignees
Labels

Comments

@seansfkelley
Copy link

Description

Judging by the schema, targetDefaults only permits inputs, outputs, and dependsOn fields. A project's target can additionally include executor, options, and configurations.

I would like to be able to define at least executor in targetDefaults, if not also the other fields.

Motivation

I have a monorepo of 100+ packages, 90+ of which have the exact same configurations for builds. I can already DRY up the task dependencies using something like

"targetDefaults": {
  "build": {
    "inputs": ["default"],
    "dependsOn": ["^build", "transpile", "type-check"]
  },
},

but I still have to specify the same executor for the build target in 90+ packages.

Suggested Implementation

Since executor is a simple string, there's no complexity w/r/t override semantics: take the target's if present, and take targetDefault's otherwise.

options and configurations are a little trickier. For consistency with dependsOn and greater flexibility, at the cost of losing DRYness, I would say options specified in the project.json overwrite instead of merging with those from nx.json. Same for configurations, except the overriding happens per-named-configuration, rather than for configurations on the whole.

Alternate Implementations

options and each configuration could merge instead of override, but this has a lot of tricky semantics and is probably not appropriate for a first version of the feature. (Off the top of my head, two things: how do you unset fields, and is it a recursive merge, or a shallow one?)

@AgentEnder
Copy link
Member

Hey @seansfkelley! This is something that we are currently thinking through and will be added in the future.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants