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

dx new in existing multicrate workspace #2350

Open
alexanderjophus opened this issue Apr 20, 2024 · 1 comment
Open

dx new in existing multicrate workspace #2350

alexanderjophus opened this issue Apr 20, 2024 · 1 comment
Labels
cli Related to the dioxus-cli program enhancement New feature or request

Comments

@alexanderjophus
Copy link
Contributor

Feature Request

When creating a new project with dx new, after the directory is created cargo fmt is ran. If this is in a workspace where the user has not pre-added the crate to workspace members list, the user is presented with a cargo fmt error message.

Everything else runs fine, and the command has an exit code of 0, as everything is fine, it just looks worrying.

Implement Suggestion

Not sure how possible it is, currently investigating, but if the user is in a workspace either

  • the user is asked in the template whether to add the newly created crate to members or not
  • or; add it anyway without asking
@alexanderjophus
Copy link
Contributor Author

I'm reading cargo-metadata, but nothing is jumping out at me to say "this is a workspace" vs "this is a standalone package.

Maybe checking the length of workspace_members, and if there's only 1 checking if it matches the workspace_root?

I'm thinking of use cases/edge cases though;

  • A user runs dx new - their current directory is outside any cargo workspace
    • This is as-is, and should predictably make the directory and run cargo fmt as well as the rest of the flow
  • A user runs dx new - their current directory is a multi-crate cargo workspace
    • This is the flow I just ran, and everything is made fine (I just had to add the new crate to package members), I'd like to avoid this manual work if possible.
  • A user runs dx new - their current directory is a single rust crate
    • This produces the directory, but possibly isn't what the user expected? (Not sure what I'd expect here)

@ealmloff ealmloff added enhancement New feature or request cli Related to the dioxus-cli program labels Apr 24, 2024
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

No branches or pull requests

2 participants