Move APM and NPM before the system upgrade. Fix trying to use NPM locally

This commit is contained in:
Roey Darwish Dror
2018-06-06 11:27:43 +03:00
parent 6c2a0c476b
commit 4fb6c8548c

View File

@@ -135,6 +135,25 @@ fn main() -> Result<(), Error> {
}
}
if let Ok(npm) = which("npm") {
terminal.print_separator("Node Package Manager");
Command::new(&npm)
.args(&["update", "-g"])
.spawn()?
.wait()?
.report("Node Package Manager", &mut reports);
}
if let Ok(apm) = which("apm") {
terminal.print_separator("Atom Package Manager");
Command::new(&apm)
.args(&["upgrade", "--confirm=false"])
.spawn()?
.wait()
.map_err(Error::from)?
.report("Atom Package Manager", &mut reports);
}
if cfg!(target_os = "linux") {
let sudo = which("sudo");
@@ -251,33 +270,6 @@ 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);
}
if let Ok(apm) = which("apm") {
terminal.print_separator("Atom Package Manager");
Command::new(&apm)
.args(&["upgrade", "--confirm=false"])
.spawn()?
.wait()
.map_err(Error::from)?
.report("Atom Package Manager", &mut reports);
}
let mut reports: Vec<_> = reports.into_iter().collect();
reports.sort();