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

feat: implement -D, -O options for add command #12

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

vramana
Copy link
Contributor

@vramana vramana commented Jul 18, 2023

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?

@@ -16,6 +17,22 @@ pub struct PackageJson {
value: Value,
}

pub enum DependencyType {
Copy link
Contributor Author

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?

Copy link
Member

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

} else if self.optional {
DependencyType::Optional
} else {
DependencyType::Normal
Copy link
Member

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?

@@ -16,6 +17,22 @@ pub struct PackageJson {
value: Value,
}

pub enum DependencyType {
Copy link
Member

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

Optional,
}

impl Into<&str> for DependencyType {
Copy link
Member

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?

#[arg(short = 'D', group = "dependency_type")]
dev: bool,
/// Add the package as a optional dependency
#[arg(short = 'O', group = "dependency_type")]
Copy link
Member

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

@@ -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")]
Copy link
Member

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

@anonrig
Copy link
Member

anonrig commented Jul 18, 2023

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?

Can you add a TODO in the code so we don't forget?

@vramana
Copy link
Contributor Author

vramana commented Jul 18, 2023

Can you add a TODO in the code so we don't forget?

Sure

@anonrig
Copy link
Member

anonrig commented Jul 18, 2023

Is this PR ready to get merged?

@vramana
Copy link
Contributor Author

vramana commented Jul 18, 2023

@anonrig Yes!

@anonrig anonrig merged commit fe613e2 into pnpm:main Jul 18, 2023
11 of 12 checks passed
@vramana vramana deleted the add-commands branch July 18, 2023 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants