From 2471c47ed4c7ac3819b571eeaa0002c227062f63 Mon Sep 17 00:00:00 2001 From: The1111mp Date: Wed, 25 Oct 2023 21:12:44 +0800 Subject: [PATCH] fix: Match npm install short name. Signed-off-by: The1111mp --- src/run/npm.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/run/npm.rs b/src/run/npm.rs index d692672..7138701 100644 --- a/src/run/npm.rs +++ b/src/run/npm.rs @@ -19,6 +19,7 @@ use crate::{ lazy_static! { static ref INSTALL: OsString = OsString::from("install"); + static ref SHORT_INSTALL: OsString = OsString::from("i"); static ref UNINSTALL: OsString = OsString::from("uninstall"); static ref GLOBAL: OsString = OsString::from("--global"); static ref SHORT_GLOBAL: OsString = OsString::from("-g"); @@ -30,7 +31,6 @@ lazy_static! { pub(super) fn command(exe: &OsStr, args: &[OsString]) -> Result { let is_global = args.contains(&SHORT_GLOBAL) || args.contains(&GLOBAL); - let is_global_install = is_global && args.contains(&INSTALL); let is_global_uninstall = is_global && args.contains(&UNINSTALL); // for npm uninstall -g packages @@ -49,6 +49,8 @@ pub(super) fn command(exe: &OsStr, args: &[OsString]) -> Result { if status.success() { + let is_global_install = + is_global && (args.contains(&INSTALL) || args.contains(&SHORT_INSTALL)); // npm install -g packages if is_global_install { global_install_packages(args);