fix: allow luau packages in exec command

This commit is contained in:
daimond113 2024-10-12 18:51:01 +02:00
parent 48c5d159b4
commit b6459623b7
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
2 changed files with 29 additions and 13 deletions

View file

@ -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

View file

@ -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),
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,
},
&project,
TargetKind::Lune,
)
.context("failed to resolve package")?;
};
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);