Skip to content

Commit 7a5e7c4

Browse files
committed
fix: Adds NPM command to run on windows
1 parent a52cdf0 commit 7a5e7c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/licenses.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ pub fn analyze_python_licenses(package_file_path: &str) -> Vec<LicenseInfo> {
159159

160160
/// Analyze the licenses of JavaScript dependencies
161161
pub fn analyze_js_licenses(package_json_path: &str) -> Vec<LicenseInfo> {
162+
#[cfg(windows)]
163+
const NPM: &str = "npm.cmd";
164+
#[cfg(not(windows))]
165+
const NPM: &str = "npm";
166+
162167
let content = fs::read_to_string(package_json_path).expect("Failed to read package.json file");
163168
let package_json: PackageJson =
164169
serde_json::from_str(&content).expect("Failed to parse package.json");
@@ -168,7 +173,7 @@ pub fn analyze_js_licenses(package_json_path: &str) -> Vec<LicenseInfo> {
168173
all_dependencies
169174
.par_iter()
170175
.map(|(name, version)| {
171-
let output = Command::new("npm")
176+
let output = Command::new(NPM)
172177
.arg("view")
173178
.arg(name)
174179
.arg("version")

0 commit comments

Comments
 (0)