Support for updating the node package manager

One could consider to also run `npm audit fix` as is suggested
by `npm`.
This commit is contained in:
Sebastian Thiel
2018-06-06 06:45:58 +02:00
committed by Roey Darwish Dror
parent 82f44cd173
commit 4c31530c0b

View File

@@ -251,6 +251,23 @@ fn main() -> Result<(), Error> {
.report("System upgrade", &mut reports);; .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(); let mut reports: Vec<_> = reports.into_iter().collect();
reports.sort(); reports.sort();