Don't print the NPM separator if the step is skipped (fix #831)
This commit is contained in:
@@ -1,18 +1,20 @@
|
|||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
use crate::executor::{CommandExt, RunType};
|
#[cfg(unix)]
|
||||||
use crate::terminal::print_separator;
|
use std::os::unix::prelude::MetadataExt;
|
||||||
use crate::utils::{require, PathExt};
|
use std::path::PathBuf;
|
||||||
use crate::{error::SkipStep, execution_context::ExecutionContext};
|
use std::process::Command;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use directories::BaseDirs;
|
use directories::BaseDirs;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use nix::unistd::Uid;
|
use nix::unistd::Uid;
|
||||||
#[cfg(unix)]
|
|
||||||
use std::os::unix::prelude::MetadataExt;
|
use crate::executor::{CommandExt, RunType};
|
||||||
use std::path::PathBuf;
|
use crate::terminal::print_separator;
|
||||||
use std::process::Command;
|
use crate::utils::{require, PathExt};
|
||||||
|
use crate::{error::SkipStep, execution_context::ExecutionContext};
|
||||||
|
|
||||||
#[allow(clippy::upper_case_acronyms)]
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
struct NPM {
|
struct NPM {
|
||||||
@@ -33,6 +35,8 @@ impl NPM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn upgrade(&self, run_type: RunType, use_sudo: bool) -> Result<()> {
|
fn upgrade(&self, run_type: RunType, use_sudo: bool) -> Result<()> {
|
||||||
|
print_separator("Node Package Manager");
|
||||||
|
|
||||||
if use_sudo {
|
if use_sudo {
|
||||||
run_type
|
run_type
|
||||||
.execute("sudo")
|
.execute("sudo")
|
||||||
@@ -77,7 +81,6 @@ fn should_use_sudo(npm: &NPM, ctx: &ExecutionContext) -> Result<bool> {
|
|||||||
pub fn run_npm_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
pub fn run_npm_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
||||||
let npm = require("npm").map(NPM::new)?;
|
let npm = require("npm").map(NPM::new)?;
|
||||||
|
|
||||||
print_separator("Node Package Manager");
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
npm.upgrade(ctx.run_type(), should_use_sudo(&npm, ctx)?)
|
npm.upgrade(ctx.run_type(), should_use_sudo(&npm, ctx)?)
|
||||||
|
|||||||
Reference in New Issue
Block a user