-
Notifications
You must be signed in to change notification settings - Fork 21
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: implement -D, -O options for add command #12
Conversation
crates/package_json/src/lib.rs
Outdated
@@ -16,6 +17,22 @@ pub struct PackageJson { | |||
value: Value, | |||
} | |||
|
|||
pub enum DependencyType { |
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.
Should this be called DependencyGroup instead? Should I add peer dependencies, bundled dependencies in this PR?
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.
I like dependencygroup better, but I'm ok with dependencytype as well. I think we can split the PRs. That's ok
crates/cli/src/commands.rs
Outdated
} else if self.optional { | ||
DependencyType::Optional | ||
} else { | ||
DependencyType::Normal |
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.
What do you think about naming this as Default
?
crates/package_json/src/lib.rs
Outdated
@@ -16,6 +17,22 @@ pub struct PackageJson { | |||
value: Value, | |||
} | |||
|
|||
pub enum DependencyType { |
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.
I like dependencygroup better, but I'm ok with dependencytype as well. I think we can split the PRs. That's ok
crates/package_json/src/lib.rs
Outdated
Optional, | ||
} | ||
|
||
impl Into<&str> for DependencyType { |
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.
Can you also add From trait as well?
crates/cli/src/commands.rs
Outdated
#[arg(short = 'D', group = "dependency_type")] | ||
dev: bool, | ||
/// Add the package as a optional dependency | ||
#[arg(short = 'O', group = "dependency_type")] |
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.
long value should be added as save-optional
crates/cli/src/commands.rs
Outdated
@@ -23,8 +24,26 @@ pub enum Subcommands { | |||
pub struct AddArgs { | |||
/// Name of the package | |||
pub package: String, | |||
/// Add the package as a dev dependency | |||
#[arg(short = 'D', group = "dependency_type")] |
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.
long value should be added as save-dev
Can you add a TODO in the code so we don't forget? |
Sure |
Is this PR ready to get merged? |
@anonrig Yes! |
One caveat is if a package already exists in another dependecy group, we don't remove the existing entry. Can we fix it in another PR?