mirror of
https://github.com/denoland/deno.git
synced 2024-12-18 13:22:55 -05:00
fix(outdated): show a suggestion for updating (#27304)
Show command to update dependencies based on the output of "deno outdated" command. Closes https://github.com/denoland/deno/issues/27256
This commit is contained in:
parent
94c7653d0e
commit
c3af09821a
9 changed files with 43 additions and 0 deletions
|
@ -100,6 +100,24 @@ fn print_outdated_table(packages: &[OutdatedPackage]) {
|
|||
println!("└{package_fill}┴{current_fill}┴{update_fill}┴{latest_fill}┘",);
|
||||
}
|
||||
|
||||
#[allow(clippy::print_stdout)]
|
||||
fn print_suggestion(compatible: bool) {
|
||||
println!();
|
||||
let (cmd, txt) = if compatible {
|
||||
("", "compatible")
|
||||
} else {
|
||||
(" --latest", "available")
|
||||
};
|
||||
println!(
|
||||
"{}",
|
||||
color_print::cformat!(
|
||||
"<p(245)>Run</> <u>deno outdated --update{}</> <p(245)>to update to the latest {} versions,</>\n<p(245)>or</> <u>deno outdated --help</> <p(245)>for more information.</>",
|
||||
cmd,
|
||||
txt,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
fn print_outdated(
|
||||
deps: &mut DepManager,
|
||||
compatible: bool,
|
||||
|
@ -148,6 +166,7 @@ fn print_outdated(
|
|||
if !outdated.is_empty() {
|
||||
outdated.sort();
|
||||
print_outdated_table(&outdated);
|
||||
print_suggestion(compatible);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -13,3 +13,6 @@
|
|||
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
|
||||
│ npm:@denotest/breaking-change-between-versions │ 1.0.0 │ 1.0.0 │ 2.0.0 │
|
||||
└────────────────────────────────────────────────┴─────────┴────────┴────────┘
|
||||
|
||||
Run deno outdated --update --latest to update to the latest available versions,
|
||||
or deno outdated --help for more information.
|
||||
|
|
|
@ -5,3 +5,6 @@
|
|||
├──────────────────────────────────┼─────────┼────────┼────────┤
|
||||
│ npm:@denotest/has-patch-versions │ 0.1.0 │ 0.1.1 │ 0.2.0 │
|
||||
└──────────────────────────────────┴─────────┴────────┴────────┘
|
||||
|
||||
Run deno outdated --update to update to the latest compatible versions,
|
||||
or deno outdated --help for more information.
|
||||
|
|
|
@ -7,3 +7,6 @@
|
|||
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
|
||||
│ npm:@denotest/breaking-change-between-versions │ 1.0.0 │ 1.0.0 │ 2.0.0 │
|
||||
└────────────────────────────────────────────────┴─────────┴────────┴────────┘
|
||||
|
||||
Run deno outdated --update --latest to update to the latest available versions,
|
||||
or deno outdated --help for more information.
|
||||
|
|
|
@ -5,3 +5,6 @@
|
|||
├──────────────────────────────────┼─────────┼────────┼────────┤
|
||||
│ npm:@denotest/bin │ 0.6.0 │ 0.6.0 │ 1.0.0 │
|
||||
└──────────────────────────────────┴─────────┴────────┴────────┘
|
||||
|
||||
Run deno outdated --update --latest to update to the latest available versions,
|
||||
or deno outdated --help for more information.
|
||||
|
|
|
@ -13,3 +13,6 @@
|
|||
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
|
||||
│ npm:@denotest/breaking-change-between-versions │ 1.0.0 │ 1.0.0 │ 2.0.0 │
|
||||
└────────────────────────────────────────────────┴─────────┴────────┴────────┘
|
||||
|
||||
Run deno outdated --update --latest to update to the latest available versions,
|
||||
or deno outdated --help for more information.
|
||||
|
|
|
@ -3,3 +3,6 @@
|
|||
├────────────────────────┼─────────┼────────┼────────┤
|
||||
│ jsr:@denotest/subtract │ 0.2.0 │ 0.2.0 │ 1.0.0 │
|
||||
└────────────────────────┴─────────┴────────┴────────┘
|
||||
|
||||
Run deno outdated --update --latest to update to the latest available versions,
|
||||
or deno outdated --help for more information.
|
||||
|
|
|
@ -7,3 +7,6 @@
|
|||
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
|
||||
│ npm:@denotest/breaking-change-between-versions │ 1.0.0 │ 1.0.0 │ 2.0.0 │
|
||||
└────────────────────────────────────────────────┴─────────┴────────┴────────┘
|
||||
|
||||
Run deno outdated --update --latest to update to the latest available versions,
|
||||
or deno outdated --help for more information.
|
||||
|
|
|
@ -3,3 +3,6 @@
|
|||
├──────────────────────────────────┼─────────┼────────┼────────┤
|
||||
│ npm:@denotest/has-patch-versions │ 0.1.0 │ 0.1.1 │ 0.2.0 │
|
||||
└──────────────────────────────────┴─────────┴────────┴────────┘
|
||||
|
||||
Run deno outdated --update to update to the latest compatible versions,
|
||||
or deno outdated --help for more information.
|
||||
|
|
Loading…
Reference in a new issue