-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: Add cargo component add
command
#18
Conversation
This commit introduces the `add` command, analogous to `cargo add` for adding dependendcies to the manifest. This command validates: 1. Name conflicts between dependencies 2. Only 1 default export can exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me, just a few comments.
Regarding the validation of the interface file, I think we might as well check it at least exists when adding it to Cargo.toml
; as to whether or not it parses as an interface definition, I'm fine with leaving that up to the other commands that need to read the file contents.
This commit simplifies the package option to make it singular, this makes it easier to validate edge cases around multiple package specifications
Add a more specific and standard message for the recently added dependency
Use `find` instead of `map` + `contains`
@peterhuene thanks for the review, this should be ready for another pass. I also realized that in my original implementation I was not validating the presence of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Implements #5
This commit introduces the
add
command, analogous tocargo add
foradding dependendcies to the manifest.
This command validates:
For reference, this the help output of the subcommand:
Some open questions around the design:
.wit
file; I left it this way operating under the assumption that it's a concern of thebuild
command to validate the existence of the interface file. Also, I can see a possibility of this command being used as a starting point to get theCargo.toml
changes ready, rather than as a final step. That said, if you think this should be validated at this step, I can definitely add that in.--dry-run
option currently prints the un-written state of the manifest to the stdout, not sure if there's a better course of action here.