Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 85f9664

Browse files
authored
Don't make pnpm a seperate step (#944)
Fixes #938
1 parent 2320106 commit 85f9664

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ pub enum Step {
113113
Pip3,
114114
Pkg,
115115
Pkgin,
116-
Pnpm,
117116
Powershell,
118117
Raco,
119118
Remotes,

src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ fn run() -> Result<()> {
335335
runner.execute(Step::Vim, "voom", || vim::run_voom(&base_dirs, run_type))?;
336336
runner.execute(Step::Kakoune, "Kakoune", || kakoune::upgrade_kak_plug(&ctx))?;
337337
runner.execute(Step::Node, "npm", || node::run_npm_upgrade(&ctx))?;
338-
runner.execute(Step::Pnpm, "pnpm", || node::pnpm_global_update(&ctx))?;
339338
runner.execute(Step::Containers, "Containers", || containers::run_containers(&ctx))?;
340339
runner.execute(Step::Deno, "deno", || node::deno_upgrade(&ctx))?;
341340
runner.execute(Step::Composer, "composer", || generic::run_composer_update(&ctx))?;

src/steps/node.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ use crate::{error::SkipStep, execution_context::ExecutionContext};
1919
#[allow(clippy::upper_case_acronyms)]
2020
struct NPM {
2121
command: PathBuf,
22+
pnpm: Option<PathBuf>,
2223
}
2324

2425
impl NPM {
2526
fn new(command: PathBuf) -> Self {
26-
Self { command }
27+
Self {
28+
command,
29+
pnpm: require("pnpm").ok(),
30+
}
2731
}
2832

2933
#[cfg(target_os = "linux")]
@@ -40,7 +44,7 @@ impl NPM {
4044
if use_sudo {
4145
run_type
4246
.execute("sudo")
43-
.arg(&self.command)
47+
.arg(self.pnpm.as_ref().unwrap_or(&self.command))
4448
.args(&["update", "-g"])
4549
.check_run()?;
4650
} else {
@@ -92,25 +96,6 @@ pub fn run_npm_upgrade(ctx: &ExecutionContext) -> Result<()> {
9296
}
9397
}
9498

95-
pub fn pnpm_global_update(ctx: &ExecutionContext) -> Result<()> {
96-
let pnpm = require("pnpm")?;
97-
98-
print_separator("Performant Node Package Manager");
99-
#[cfg(target_os = "linux")]
100-
if should_use_sudo(&require("npm").map(NPM::new)?, ctx)? {
101-
ctx.run_type()
102-
.execute("sudo")
103-
.arg(pnpm)
104-
.args(&["update", "-g"])
105-
.check_run()
106-
} else {
107-
ctx.run_type().execute(&pnpm).args(&["update", "-g"]).check_run()
108-
}
109-
110-
#[cfg(not(target_os = "linux"))]
111-
ctx.run_type().execute(&pnpm).args(&["update", "-g"]).check_run()
112-
}
113-
11499
pub fn deno_upgrade(ctx: &ExecutionContext) -> Result<()> {
115100
let deno = require("deno")?;
116101
let deno_dir = ctx.base_dirs().home_dir().join(".deno");

0 commit comments

Comments
 (0)