diff options
Diffstat (limited to 'crates/mozart/src')
| -rw-r--r-- | crates/mozart/src/commands/init.rs | 9 | ||||
| -rw-r--r-- | crates/mozart/src/commands/install.rs | 26 |
2 files changed, 22 insertions, 13 deletions
diff --git a/crates/mozart/src/commands/init.rs b/crates/mozart/src/commands/init.rs index 25600f7..49176ab 100644 --- a/crates/mozart/src/commands/init.rs +++ b/crates/mozart/src/commands/init.rs @@ -700,12 +700,17 @@ fn parse_repositories(repos: &[String]) -> anyhow::Result<Vec<RawRepository>> { .as_str() .ok_or_else(|| anyhow::anyhow!("Repository JSON must contain a 'url' field"))? .to_string(); - result.push(RawRepository { repo_type, url }); + result.push(RawRepository { + repo_type, + url: Some(url), + package: None, + }); } else { // Plain URL result.push(RawRepository { repo_type: "vcs".to_string(), - url: repo.clone(), + url: Some(repo.clone()), + package: None, }); } } diff --git a/crates/mozart/src/commands/install.rs b/crates/mozart/src/commands/install.rs index a10dd69..1cc4e6f 100644 --- a/crates/mozart/src/commands/install.rs +++ b/crates/mozart/src/commands/install.rs @@ -608,18 +608,22 @@ pub async fn install_from_lock( continue; } + // A package with neither dist nor source has no install action. + // This covers Composer's `type: metapackage` (modeled explicitly + // as "no installer") and inline `type: package` definitions used + // in test fixtures that intentionally omit download metadata. + // Mozart records the operation and the installed.json entry but + // performs no filesystem work, mirroring Composer's + // MetapackageInstaller. + if pkg.dist.is_none() && pkg.source.is_none() { + continue; + } + let dist = pkg.dist.as_ref().ok_or_else(|| { - if pkg.source.is_some() { - anyhow::anyhow!( - "Package {} has no dist information. Use --prefer-source to install from VCS.", - pkg.name, - ) - } else { - anyhow::anyhow!( - "Package {} has no dist or source information", - pkg.name, - ) - } + anyhow::anyhow!( + "Package {} has no dist information. Use --prefer-source to install from VCS.", + pkg.name, + ) })?; let mut progress = make_progress(!config.no_progress, &pkg.name, &pkg.version); |
