summaryrefslogtreecommitdiff
path: root/cli/tools/registry/pm.rs
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-09-07 02:22:27 -0700
committerGitHub <noreply@github.com>2024-09-07 02:22:27 -0700
commit98e8e2f8bc685675b305e5cc596571801a8e0160 (patch)
tree0ed2bb77b2b6e1f7c8dde0b319cdcadea7e310bd /cli/tools/registry/pm.rs
parenta9ed06b8324d4b139aea516d045bdbd091f15be9 (diff)
feat(add/install): Flag to add dev dependency to package.json (#25495)
``` deno install --dev npm:chalk ``` Adds to `devDependencies` if a `package.json` is present, otherwise it just adds to `imports` in `deno.json`
Diffstat (limited to 'cli/tools/registry/pm.rs')
-rw-r--r--cli/tools/registry/pm.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/cli/tools/registry/pm.rs b/cli/tools/registry/pm.rs
index 099267908..1f8463b00 100644
--- a/cli/tools/registry/pm.rs
+++ b/cli/tools/registry/pm.rs
@@ -502,6 +502,7 @@ pub async fn add(
}
}
+ let dev = add_flags.dev;
for selected_package in selected_packages {
log::info!(
"Add {}{}{}",
@@ -512,14 +513,14 @@ pub async fn add(
if selected_package.package_name.starts_with("npm:") {
if let Some(npm) = &mut npm_config {
- npm.add(selected_package, false);
+ npm.add(selected_package, dev);
} else {
- deno_config.as_mut().unwrap().add(selected_package, false);
+ deno_config.as_mut().unwrap().add(selected_package, dev);
}
} else if let Some(deno) = &mut deno_config {
- deno.add(selected_package, false);
+ deno.add(selected_package, dev);
} else {
- npm_config.as_mut().unwrap().add(selected_package, false);
+ npm_config.as_mut().unwrap().add(selected_package, dev);
}
}