1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-21 23:04:45 -05:00

fix(add): Support dist tags in deno add (#24960)

Fixes #24956.
This commit is contained in:
Nathan Whitaker 2024-08-08 18:45:41 +02:00 committed by GitHub
parent e36b1a3aa8
commit 3f692bed0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 0 deletions

View file

@ -124,6 +124,10 @@ impl NpmFetchResolver {
let maybe_get_nv = || async {
let name = req.name.clone();
let package_info = self.package_info(&name).await?;
if let Some(dist_tag) = req.version_req.tag() {
let version = package_info.dist_tags.get(dist_tag)?.clone();
return Some(PackageNv { name, version });
}
// Find the first matching version of the package.
let mut versions = package_info.versions.keys().collect::<Vec<_>>();
versions.sort();

View file

@ -0,0 +1,9 @@
{
"tempDir": true,
"steps": [
{
"args": "add npm:ajv@latest",
"output": "Add npm:ajv@8.11.0\n"
}
]
}

View file

View file

@ -0,0 +1,12 @@
{
"tempDir": true,
"steps": [
{
"envs": {
"DENO_FUTURE": "1"
},
"args": "install npm:ajv@latest",
"output": "install.out"
}
]
}

View file

@ -0,0 +1,15 @@
Add npm:ajv@8.11.0
[UNORDERED_START]
Download http://localhost:4260/ajv
Download http://localhost:4260/fast-deep-equal
Download http://localhost:4260/json-schema-traverse
Download http://localhost:4260/require-from-string
Download http://localhost:4260/uri-js
Download http://localhost:4260/punycode
Download http://localhost:4260/ajv/ajv-8.11.0.tgz
Download http://localhost:4260/fast-deep-equal/fast-deep-equal-3.1.3.tgz
Download http://localhost:4260/uri-js/uri-js-4.4.1.tgz
Download http://localhost:4260/json-schema-traverse/json-schema-traverse-1.0.0.tgz
Download http://localhost:4260/require-from-string/require-from-string-2.0.2.tgz
Download http://localhost:4260/punycode/punycode-2.1.1.tgz
[UNORDERED_END]