mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
fix(add): exact version should not have range ^
specifier (#26302)
Fixes https://github.com/denoland/deno/issues/26299
This commit is contained in:
parent
06778e4e9b
commit
e515f3dd0e
7 changed files with 61 additions and 4 deletions
|
@ -617,9 +617,11 @@ async fn find_package_and_select_version_for_req(
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
let range_symbol = if req.version_req.version_text().starts_with('~') {
|
let range_symbol = if req.version_req.version_text().starts_with('~') {
|
||||||
'~'
|
"~"
|
||||||
|
} else if req.version_req.version_text() == nv.version.to_string() {
|
||||||
|
""
|
||||||
} else {
|
} else {
|
||||||
'^'
|
"^"
|
||||||
};
|
};
|
||||||
Ok(PackageAndVersion::Selected(SelectedPackage {
|
Ok(PackageAndVersion::Selected(SelectedPackage {
|
||||||
import_name: add_package_req.alias,
|
import_name: add_package_req.alias,
|
||||||
|
@ -637,11 +639,15 @@ async fn find_package_and_select_version_for_req(
|
||||||
package_req: req,
|
package_req: req,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
let range_symbol = if req.version_req.version_text().starts_with('~') {
|
let range_symbol = if req.version_req.version_text().starts_with('~') {
|
||||||
'~'
|
"~"
|
||||||
|
} else if req.version_req.version_text() == nv.version.to_string() {
|
||||||
|
""
|
||||||
} else {
|
} else {
|
||||||
'^'
|
"^"
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(PackageAndVersion::Selected(SelectedPackage {
|
Ok(PackageAndVersion::Selected(SelectedPackage {
|
||||||
import_name: add_package_req.alias,
|
import_name: add_package_req.alias,
|
||||||
package_name: npm_prefixed_name,
|
package_name: npm_prefixed_name,
|
||||||
|
|
35
tests/specs/add/exact_version/__test__.jsonc
Normal file
35
tests/specs/add/exact_version/__test__.jsonc
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"tempDir": true,
|
||||||
|
"tests": {
|
||||||
|
"npm": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"args": "add npm:@denotest/esm-basic@1.0.0",
|
||||||
|
"output": "npm_add.out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": [
|
||||||
|
"eval",
|
||||||
|
"console.log(Deno.readTextFileSync('deno.json').trim())"
|
||||||
|
],
|
||||||
|
"output": "npm_deno.json.out"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"jsr": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"args": "add jsr:@denotest/add@1.0.0",
|
||||||
|
"output": "jsr_add.out"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": [
|
||||||
|
"eval",
|
||||||
|
"console.log(Deno.readTextFileSync('deno.json').trim())"
|
||||||
|
],
|
||||||
|
"output": "jsr_deno.json.out"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
tests/specs/add/exact_version/deno.json
Normal file
1
tests/specs/add/exact_version/deno.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{}
|
2
tests/specs/add/exact_version/jsr_add.out
Normal file
2
tests/specs/add/exact_version/jsr_add.out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Add jsr:@denotest/add@1.0.0
|
||||||
|
Download http://127.0.0.1:4250/@denotest/add/1.0.0/mod.ts
|
5
tests/specs/add/exact_version/jsr_deno.json.out
Normal file
5
tests/specs/add/exact_version/jsr_deno.json.out
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"@denotest/add": "jsr:@denotest/add@1.0.0"
|
||||||
|
}
|
||||||
|
}
|
3
tests/specs/add/exact_version/npm_add.out
Normal file
3
tests/specs/add/exact_version/npm_add.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
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
|
5
tests/specs/add/exact_version/npm_deno.json.out
Normal file
5
tests/specs/add/exact_version/npm_deno.json.out
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"@denotest/esm-basic": "npm:@denotest/esm-basic@1.0.0"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue