fix: add --package flag to component add/remove/list commands#5420
Closed
rustsoldev wants to merge 2 commits intoDioxusLabs:mainfrom
Closed
fix: add --package flag to component add/remove/list commands#5420rustsoldev wants to merge 2 commits intoDioxusLabs:mainfrom
rustsoldev wants to merge 2 commits intoDioxusLabs:mainfrom
Conversation
The error message in `find_main_package()` suggests using `--package` when multiple binaries exist in a workspace, but the component subcommands didn't actually accept this flag. Now `Add`, `Remove`, and `List` variants pass the package option through to `resolve_config()` → `find_main_package()`. Closes DioxusLabs#5367 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ealmloff
reviewed
Mar 27, 2026
packages/cli/src/cli/component.rs
Outdated
| Self::List { registry } => { | ||
| let config = Self::resolve_config().await?; | ||
| Self::List { registry, package } => { | ||
| let config = Self::resolve_config(package).await?; |
Member
There was a problem hiding this comment.
It looks like this only changes where the config is read from? components_root still points to the workspace so this won't add components to a subcrate like I would expect with a --package argument
…ents_root and global_assets_root When --package is specified, components and assets should be written to that subcrate's directory, not the workspace root. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #5367
dx component addin a workspace with multiple binaries suggests using--packageflag, but the flag didn't exist on the component subcommands--package(-p) flag toAdd,Remove, andListvariants ofComponentCommandresolve_config()→find_main_package()to correctly resolve the target packageChanges
packages/cli/src/cli/component.rs— Added--packageoption toAdd,Remove,Listvariants and updatedresolve_config()to accept package parameterpackages/cli/src/logging.rs— Updated pattern matches to include newpackagefieldTest plan
cargo check -p dioxus-clipasses (25s, zero errors)🤖 Generated with Claude Code