From 4c31530c0b8a0c986e8f262f6279513504b4d0d3 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 6 Jun 2018 06:45:58 +0200 Subject: [PATCH] Support for updating the node package manager One could consider to also run `npm audit fix` as is suggested by `npm`. --- src/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main.rs b/src/main.rs index 910da3b8..b3e2a674 100644 --- a/src/main.rs +++ b/src/main.rs @@ -251,6 +251,23 @@ fn main() -> Result<(), Error> { .report("System upgrade", &mut reports);; } + if let Ok(npm) = which("npm") { + terminal.print_separator("Node Package Manager"); + Command::new(&npm) + .args(&["install", "npm"]) + .spawn()? + .wait()? + .check() + .and_then(|()| { + Command::new(&npm) + .args(&["update", "-g"]) + .spawn()? + .wait() + .map_err(Error::from) + })? + .report("Node Package Manager", &mut reports); + } + let mut reports: Vec<_> = reports.into_iter().collect(); reports.sort();