mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(install): duplicate dependencies in package.json
(#26128)
Fixes https://github.com/denoland/deno/issues/26120
This commit is contained in:
parent
66929de3ba
commit
ccdbeb433b
9 changed files with 58 additions and 0 deletions
|
@ -130,8 +130,10 @@ impl NpmConfig {
|
|||
fn add(&mut self, selected: SelectedPackage, dev: bool) {
|
||||
let (name, version) = package_json_dependency_entry(selected);
|
||||
if dev {
|
||||
self.dependencies.swap_remove(&name);
|
||||
self.dev_dependencies.insert(name, version);
|
||||
} else {
|
||||
self.dev_dependencies.swap_remove(&name);
|
||||
self.dependencies.insert(name, version);
|
||||
}
|
||||
}
|
||||
|
|
16
tests/specs/install/install_add_dep_existing/__test__.jsonc
Normal file
16
tests/specs/install/install_add_dep_existing/__test__.jsonc
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"tempDir": true,
|
||||
"steps": [
|
||||
{
|
||||
"args": "install npm:@denotest/esm-basic",
|
||||
"output": "install.out"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"eval",
|
||||
"console.log(Deno.readTextFileSync('package.json').trim())"
|
||||
],
|
||||
"output": "package.json.out"
|
||||
}
|
||||
]
|
||||
}
|
4
tests/specs/install/install_add_dep_existing/install.out
Normal file
4
tests/specs/install/install_add_dep_existing/install.out
Normal file
|
@ -0,0 +1,4 @@
|
|||
Add npm:@denotest/esm-basic@1.0.0
|
||||
Download http://localhost:4260/@denotest/esm-basic
|
||||
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
|
||||
Initialize @denotest/esm-basic@1.0.0
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"devDependencies": { "@denotest/esm-basic": "^1.0.0" }
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@denotest/esm-basic": "^1.0.0"
|
||||
}
|
||||
}
|
16
tests/specs/install/install_add_dev_existing/__test__.jsonc
Normal file
16
tests/specs/install/install_add_dev_existing/__test__.jsonc
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"tempDir": true,
|
||||
"steps": [
|
||||
{
|
||||
"args": "install --dev npm:@denotest/esm-basic",
|
||||
"output": "install.out"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"eval",
|
||||
"console.log(Deno.readTextFileSync('package.json').trim())"
|
||||
],
|
||||
"output": "package.json.out"
|
||||
}
|
||||
]
|
||||
}
|
4
tests/specs/install/install_add_dev_existing/install.out
Normal file
4
tests/specs/install/install_add_dev_existing/install.out
Normal file
|
@ -0,0 +1,4 @@
|
|||
Add npm:@denotest/esm-basic@1.0.0
|
||||
Download http://localhost:4260/@denotest/esm-basic
|
||||
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
|
||||
Initialize @denotest/esm-basic@1.0.0
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"dependencies": { "@denotest/esm-basic": "^1.0.0" }
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"@denotest/esm-basic": "^1.0.0"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue