diff --git a/CHANGELOG.md b/CHANGELOG.md index 98bf346..f70f6d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed - Fix `self-upgrade` overwriting its own binary by @daimond113 +- Allow use of Luau packages in `execute` command by @daimond113 ## [0.5.0-rc.4] - 2024-10-12 ### Added diff --git a/src/cli/commands/execute.rs b/src/cli/commands/execute.rs index c0f5ae7..435a444 100644 --- a/src/cli/commands/execute.rs +++ b/src/cli/commands/execute.rs @@ -40,20 +40,35 @@ impl ExecuteCommand { .refresh(&project) .context("failed to refresh source")?; - let mut results = source - .resolve( - &PesdeDependencySpecifier { - name: self.package.0, - version: self.package.1.unwrap_or(VersionReq::STAR), - index: None, - target: None, - }, - &project, - TargetKind::Lune, - ) - .context("failed to resolve package")?; + let version_req = self.package.1.unwrap_or(VersionReq::STAR); + let Some((version, pkg_ref)) = ('finder: { + let specifier = PesdeDependencySpecifier { + name: self.package.0.clone(), + version: version_req.clone(), + index: None, + target: None, + }; - let (version, pkg_ref) = results.1.pop_last().context("no package found")?; + if let Some(res) = source + .resolve(&specifier, &project, TargetKind::Lune) + .context("failed to resolve package")? + .1 + .pop_last() + { + break 'finder Some(res); + } + + source + .resolve(&specifier, &project, TargetKind::Luau) + .context("failed to resolve package")? + .1 + .pop_last() + }) else { + anyhow::bail!( + "no Lune or Luau package could be found for {}@{version_req}", + self.package.0, + ); + }; log::info!("found package {}@{version}", pkg_ref.name);