Move APM and NPM before the system upgrade. Fix trying to use NPM locally
This commit is contained in:
46
src/main.rs
46
src/main.rs
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user