Skip to content

Commit

Permalink
Lowercase the specifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
irbull committed Dec 8, 2024
1 parent 2f5c078 commit 07be4c3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cli/tools/registry/pm/outdated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use deno_semver::package::PackageReq;
use deno_semver::VersionReq;
use deno_terminal::colors;
use serde::Serialize;
use serde::Serializer;

use crate::args::CacheSetting;
use crate::args::CliOptions;
Expand All @@ -29,7 +30,7 @@ use super::deps::PackageLatestVersion;

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize)]
struct OutdatedPackage {
#[serde(rename = "specifier")]
#[serde(rename = "specifier", serialize_with = "lowercase_serializer")]
kind: DepKind,
#[serde(rename = "latest")]
latest: String,
Expand All @@ -40,6 +41,16 @@ struct OutdatedPackage {
name: String,
}

fn lowercase_serializer<S>(kind: &DepKind, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
match kind {
DepKind::Npm => s.serialize_str("npm"),
DepKind::Jsr => s.serialize_str("jsr"),
}
}

#[allow(clippy::print_stdout)]
fn print_outdated_table(packages: &[OutdatedPackage]) {
const HEADINGS: &[&str] = &["Package", "Current", "Update", "Latest"];
Expand Down

0 comments on commit 07be4c3

Please sign in to comment.