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

Allow to use dioxus-cli within a cargo workspace #1547

Closed
ryo33 opened this issue Oct 16, 2023 · 2 comments · Fixed by #2745
Closed

Allow to use dioxus-cli within a cargo workspace #1547

ryo33 opened this issue Oct 16, 2023 · 2 comments · Fixed by #2745
Assignees
Labels
cli Related to the dioxus-cli program enhancement New feature or request
Milestone

Comments

@ryo33
Copy link
Contributor

ryo33 commented Oct 16, 2023

I'd like to work on this on my own if this feature is welcomed.

Specific Demand

I'm using dioxus in a cargo workspace and want to run the dx command within the workspace root instead of cd to the dioxus project before run dx. Also, although I did not do it yet, a workspace could include multiple dioxus projects in the monorepo context.

Implement Suggestion

Add -p, --package [<SPEC>] Package with the target to run option to several dx's commands.

@ealmloff ealmloff added enhancement New feature or request cli Related to the dioxus-cli program labels Oct 16, 2023
@ealmloff
Copy link
Member

ealmloff commented Oct 16, 2023

This would be a great addition to the CLI! It would be useful for the main Dioxus repo which uses workspace with Dioxus examples within workspace members.

RGafiyatullin added a commit to RGafiyatullin/dioxus that referenced this issue Nov 15, 2023
Although the `dx` CLI allows to specify a package name to chose from workspace members,
it does not support workspace members specified as glob-wildcards.
Neither it respects the effective package name, specified in the crate's `Cargo.toml`.

This PR addresses that issue:
- upon `dx build ...`, if the `--bin` CLI-argument is provided, treat the current dir as a workspace;
- search through the workspace's `members`: resolve each of them with `glob`;
- assume that any workspace member has a `Cargo.toml` in it (cargo does it, so it's okay);
- read said manifest, and check the package name in it;
- if found — there we have our sought package.
ealmloff pushed a commit that referenced this issue Nov 15, 2023
…rs, real package names) (#1642)

* Related to #1547: use `dioxus-cli` within a workspace

Although the `dx` CLI allows to specify a package name to chose from workspace members,
it does not support workspace members specified as glob-wildcards.
Neither it respects the effective package name, specified in the crate's `Cargo.toml`.

This PR addresses that issue:
- upon `dx build ...`, if the `--bin` CLI-argument is provided, treat the current dir as a workspace;
- search through the workspace's `members`: resolve each of them with `glob`;
- assume that any workspace member has a `Cargo.toml` in it (cargo does it, so it's okay);
- read said manifest, and check the package name in it;
- if found — there we have our sought package.

* Use cargo-metadata to find out the workspace structure

* glob is unused
@jkelleyrtp jkelleyrtp added this to the 0.6.0 milestone Jul 25, 2024
matthunz added a commit that referenced this issue Jul 30, 2024
* Fix tests

* Pass package argument to Cargo

* Fix git rev
@jkelleyrtp
Copy link
Member

Cargo build, serve, bundle, and fmt now all apply based on the package arg.

Only check is not yet supported on a per-package basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the dioxus-cli program enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants