Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion registry/npm.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
backends = ["npm:npm"]
backends = ["aqua:npm/cli", "npm:npm"]
description = "the package manager for JavaScript"
idiomatic_files = ["package.json"]
overrides = ["node"]
Expand Down
6 changes: 4 additions & 2 deletions src/backend/npm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ impl Backend for NPMBackend {
let package_manager = settings.npm.package_manager;
let tool_name = self.tool_name();

// Avoid circular dependency when installing npm itself
// But we still need the configured package manager for installation
// Explicit `npm:npm` still bootstraps through node's bundled npm even
// when the registry shorthand prefers aqua. Keep node here so users of
// the npm backend, or the registry fallback, wait for that bootstrap
// npm before installation starts.
if tool_name == "npm" {
return match package_manager {
NpmPackageManager::Auto => Ok(vec!["node"]),
Expand Down
11 changes: 10 additions & 1 deletion src/cli/args/backend_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,11 +742,20 @@ mod tests {
let fa: BackendArg = "gem:bashly".into();
assert_eq!(BackendType::Gem, fa.backend_type());

let fa: BackendArg = "npm".into();
let fa: BackendArg = "npm:npm".into();
assert_str_eq!("npm:npm", fa.full());
assert_eq!(BackendType::Npm, fa.backend_type());
}

#[tokio::test]
async fn test_bare_npm_uses_registry_tool() {
let _config = Config::get().await.unwrap();

let fa: BackendArg = "npm".into();
assert_str_eq!("aqua:npm/cli", fa.full());
assert_eq!(BackendType::Aqua, fa.backend_type());
}

#[tokio::test]
async fn test_backend_arg_pathname() {
let _config = Config::get().await.unwrap();
Expand Down
Loading