committed by
GitHub
parent
23201065c6
commit
85f96647a4
@@ -113,7 +113,6 @@ pub enum Step {
|
|||||||
Pip3,
|
Pip3,
|
||||||
Pkg,
|
Pkg,
|
||||||
Pkgin,
|
Pkgin,
|
||||||
Pnpm,
|
|
||||||
Powershell,
|
Powershell,
|
||||||
Raco,
|
Raco,
|
||||||
Remotes,
|
Remotes,
|
||||||
|
|||||||
@@ -335,7 +335,6 @@ fn run() -> Result<()> {
|
|||||||
runner.execute(Step::Vim, "voom", || vim::run_voom(&base_dirs, run_type))?;
|
runner.execute(Step::Vim, "voom", || vim::run_voom(&base_dirs, run_type))?;
|
||||||
runner.execute(Step::Kakoune, "Kakoune", || kakoune::upgrade_kak_plug(&ctx))?;
|
runner.execute(Step::Kakoune, "Kakoune", || kakoune::upgrade_kak_plug(&ctx))?;
|
||||||
runner.execute(Step::Node, "npm", || node::run_npm_upgrade(&ctx))?;
|
runner.execute(Step::Node, "npm", || node::run_npm_upgrade(&ctx))?;
|
||||||
runner.execute(Step::Pnpm, "pnpm", || node::pnpm_global_update(&ctx))?;
|
|
||||||
runner.execute(Step::Containers, "Containers", || containers::run_containers(&ctx))?;
|
runner.execute(Step::Containers, "Containers", || containers::run_containers(&ctx))?;
|
||||||
runner.execute(Step::Deno, "deno", || node::deno_upgrade(&ctx))?;
|
runner.execute(Step::Deno, "deno", || node::deno_upgrade(&ctx))?;
|
||||||
runner.execute(Step::Composer, "composer", || generic::run_composer_update(&ctx))?;
|
runner.execute(Step::Composer, "composer", || generic::run_composer_update(&ctx))?;
|
||||||
|
|||||||
@@ -19,11 +19,15 @@ use crate::{error::SkipStep, execution_context::ExecutionContext};
|
|||||||
#[allow(clippy::upper_case_acronyms)]
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
struct NPM {
|
struct NPM {
|
||||||
command: PathBuf,
|
command: PathBuf,
|
||||||
|
pnpm: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NPM {
|
impl NPM {
|
||||||
fn new(command: PathBuf) -> Self {
|
fn new(command: PathBuf) -> Self {
|
||||||
Self { command }
|
Self {
|
||||||
|
command,
|
||||||
|
pnpm: require("pnpm").ok(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
@@ -40,7 +44,7 @@ impl NPM {
|
|||||||
if use_sudo {
|
if use_sudo {
|
||||||
run_type
|
run_type
|
||||||
.execute("sudo")
|
.execute("sudo")
|
||||||
.arg(&self.command)
|
.arg(self.pnpm.as_ref().unwrap_or(&self.command))
|
||||||
.args(&["update", "-g"])
|
.args(&["update", "-g"])
|
||||||
.check_run()?;
|
.check_run()?;
|
||||||
} else {
|
} else {
|
||||||
@@ -92,25 +96,6 @@ pub fn run_npm_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pnpm_global_update(ctx: &ExecutionContext) -> Result<()> {
|
|
||||||
let pnpm = require("pnpm")?;
|
|
||||||
|
|
||||||
print_separator("Performant Node Package Manager");
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
if should_use_sudo(&require("npm").map(NPM::new)?, ctx)? {
|
|
||||||
ctx.run_type()
|
|
||||||
.execute("sudo")
|
|
||||||
.arg(pnpm)
|
|
||||||
.args(&["update", "-g"])
|
|
||||||
.check_run()
|
|
||||||
} else {
|
|
||||||
ctx.run_type().execute(&pnpm).args(&["update", "-g"]).check_run()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "linux"))]
|
|
||||||
ctx.run_type().execute(&pnpm).args(&["update", "-g"]).check_run()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deno_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
pub fn deno_upgrade(ctx: &ExecutionContext) -> Result<()> {
|
||||||
let deno = require("deno")?;
|
let deno = require("deno")?;
|
||||||
let deno_dir = ctx.base_dirs().home_dir().join(".deno");
|
let deno_dir = ctx.base_dirs().home_dir().join(".deno");
|
||||||
|
|||||||
Reference in New Issue
Block a user