fix: handle disabled features

This commit is contained in:
daimond113 2024-08-27 19:07:11 +02:00
parent e14f350336
commit 8168bb5124
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
3 changed files with 7 additions and 0 deletions

View file

@ -183,6 +183,7 @@ impl InstallCommand {
.link_dependencies(&downloaded_graph) .link_dependencies(&downloaded_graph)
.context("failed to link dependencies")?; .context("failed to link dependencies")?;
#[cfg(feature = "patches")]
project project
.apply_patches(&downloaded_graph) .apply_patches(&downloaded_graph)
.context("failed to apply patches")?; .context("failed to apply patches")?;

View file

@ -4,6 +4,7 @@ use pesde::Project;
mod add; mod add;
mod auth; mod auth;
mod config; mod config;
#[cfg(any(feature = "lune", feature = "luau"))]
mod execute; mod execute;
mod init; mod init;
mod install; mod install;
@ -63,6 +64,7 @@ pub enum Subcommand {
Outdated(outdated::OutdatedCommand), Outdated(outdated::OutdatedCommand),
/// Executes a binary package without needing to be run in a project directory /// Executes a binary package without needing to be run in a project directory
#[cfg(any(feature = "lune", feature = "luau"))]
#[clap(name = "x", visible_alias = "execute", visible_alias = "exec")] #[clap(name = "x", visible_alias = "execute", visible_alias = "exec")]
Execute(execute::ExecuteCommand), Execute(execute::ExecuteCommand),
} }
@ -93,6 +95,7 @@ impl Subcommand {
update.run(project, multi, reqwest) update.run(project, multi, reqwest)
} }
Subcommand::Outdated(outdated) => outdated.run(project), Subcommand::Outdated(outdated) => outdated.run(project),
#[cfg(any(feature = "lune", feature = "luau"))]
Subcommand::Execute(execute) => execute.run(project, reqwest), Subcommand::Execute(execute) => execute.run(project, reqwest),
} }
} }

View file

@ -21,12 +21,15 @@ pub enum ScriptName {
impl Display for ScriptName { impl Display for ScriptName {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
#[cfg(feature = "roblox")]
match self { match self {
#[cfg(feature = "roblox")] #[cfg(feature = "roblox")]
ScriptName::RobloxSyncConfigGenerator => write!(f, "roblox_sync_config_generator"), ScriptName::RobloxSyncConfigGenerator => write!(f, "roblox_sync_config_generator"),
#[cfg(feature = "wally-compat")] #[cfg(feature = "wally-compat")]
ScriptName::SourcemapGenerator => write!(f, "sourcemap_generator"), ScriptName::SourcemapGenerator => write!(f, "sourcemap_generator"),
} }
#[cfg(not(feature = "roblox"))]
Ok(())
} }
} }