mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
feat: remove unnecessary feature flags
This commit is contained in:
parent
afee3a0c2a
commit
821cc989ef
11 changed files with 13 additions and 87 deletions
|
@ -28,10 +28,7 @@ bin = [
|
|||
"serde_json",
|
||||
"winreg"
|
||||
]
|
||||
wally-compat = ["zip", "serde_json", "roblox"]
|
||||
roblox = []
|
||||
lune = []
|
||||
luau = []
|
||||
wally-compat = ["zip", "serde_json"]
|
||||
patches = ["git2"]
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -47,9 +47,6 @@ sentry-log = "0.34.0"
|
|||
sentry-actix = "0.34.0"
|
||||
|
||||
pesde = { path = "..", features = [
|
||||
"roblox",
|
||||
"lune",
|
||||
"luau",
|
||||
"wally-compat",
|
||||
"git2",
|
||||
] }
|
||||
|
|
|
@ -105,14 +105,7 @@ impl InitCommand {
|
|||
|
||||
let target_env = inquire::Select::new(
|
||||
"What environment are you targeting for your package?",
|
||||
vec![
|
||||
#[cfg(feature = "roblox")]
|
||||
"roblox",
|
||||
#[cfg(feature = "lune")]
|
||||
"lune",
|
||||
#[cfg(feature = "luau")]
|
||||
"luau",
|
||||
],
|
||||
vec!["roblox", "roblox_server", "lune", "luau"],
|
||||
)
|
||||
.prompt()
|
||||
.unwrap();
|
||||
|
@ -121,6 +114,7 @@ impl InitCommand {
|
|||
["environment"] = toml_edit::value(target_env);
|
||||
|
||||
if target_env == "roblox"
|
||||
|| target_env == "roblox_server"
|
||||
|| inquire::Confirm::new(&format!(
|
||||
"Would you like to setup a default {} script?",
|
||||
ScriptName::RobloxSyncConfigGenerator
|
||||
|
|
|
@ -4,7 +4,6 @@ use pesde::Project;
|
|||
mod add;
|
||||
mod auth;
|
||||
mod config;
|
||||
#[cfg(any(feature = "lune", feature = "luau"))]
|
||||
mod execute;
|
||||
mod init;
|
||||
mod install;
|
||||
|
@ -65,7 +64,6 @@ pub enum Subcommand {
|
|||
Outdated(outdated::OutdatedCommand),
|
||||
|
||||
/// 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")]
|
||||
Execute(execute::ExecuteCommand),
|
||||
}
|
||||
|
@ -93,7 +91,6 @@ impl Subcommand {
|
|||
Subcommand::Add(add) => add.run(project),
|
||||
Subcommand::Update(update) => update.run(project, multi, reqwest),
|
||||
Subcommand::Outdated(outdated) => outdated.run(project),
|
||||
#[cfg(any(feature = "lune", feature = "luau"))]
|
||||
Subcommand::Execute(execute) => execute.run(project, reqwest),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ impl PublishCommand {
|
|||
anyhow::bail!("no exports found in target");
|
||||
}
|
||||
|
||||
#[cfg(feature = "roblox")]
|
||||
if matches!(
|
||||
manifest.target,
|
||||
Target::Roblox { .. } | Target::RobloxServer { .. }
|
||||
|
@ -82,7 +81,6 @@ impl PublishCommand {
|
|||
));
|
||||
|
||||
let mut display_includes: Vec<String> = vec![MANIFEST_FILE_NAME.to_string()];
|
||||
#[cfg(feature = "roblox")]
|
||||
let mut display_build_files: Vec<String> = vec![];
|
||||
|
||||
let (lib_path, bin_path, target_kind) = (
|
||||
|
@ -91,14 +89,11 @@ impl PublishCommand {
|
|||
manifest.target.kind(),
|
||||
);
|
||||
|
||||
#[cfg(feature = "roblox")]
|
||||
let mut roblox_target = match &mut manifest.target {
|
||||
Target::Roblox { build_files, .. } => Some(build_files),
|
||||
Target::RobloxServer { build_files, .. } => Some(build_files),
|
||||
_ => None,
|
||||
};
|
||||
#[cfg(not(feature = "roblox"))]
|
||||
let roblox_target = None::<()>;
|
||||
|
||||
if !manifest.includes.insert(MANIFEST_FILE_NAME.to_string()) {
|
||||
display_includes.push(MANIFEST_FILE_NAME.to_string());
|
||||
|
@ -398,20 +393,16 @@ impl PublishCommand {
|
|||
.map_or("(none)".to_string(), |p| p.to_string())
|
||||
);
|
||||
|
||||
match roblox_target {
|
||||
#[cfg(feature = "roblox")]
|
||||
true => {
|
||||
println!("\tbuild files: {}", display_build_files.join(", "));
|
||||
}
|
||||
_ => {
|
||||
println!(
|
||||
"\tbin path: {}",
|
||||
manifest
|
||||
.target
|
||||
.bin_path()
|
||||
.map_or("(none)".to_string(), |p| p.to_string())
|
||||
);
|
||||
}
|
||||
if roblox_target {
|
||||
println!("\tbuild files: {}", display_build_files.join(", "));
|
||||
} else {
|
||||
println!(
|
||||
"\tbin path: {}",
|
||||
manifest
|
||||
.target
|
||||
.bin_path()
|
||||
.map_or("(none)".to_string(), |p| p.to_string())
|
||||
);
|
||||
}
|
||||
|
||||
println!(
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
//! pesde has its own registry, however it can also use Wally, and Git repositories as package sources.
|
||||
//! It has been designed with multiple targets in mind, namely Roblox, Lune, and Luau.
|
||||
|
||||
#[cfg(not(any(feature = "roblox", feature = "lune", feature = "luau")))]
|
||||
compile_error!("at least one of the features `roblox`, `lune`, or `luau` must be enabled");
|
||||
|
||||
use crate::{lockfile::Lockfile, manifest::Manifest};
|
||||
use gix::sec::identity::Account;
|
||||
use std::{
|
||||
|
|
|
@ -105,7 +105,6 @@ pub fn get_lib_require_path(
|
|||
path
|
||||
};
|
||||
|
||||
#[cfg(feature = "roblox")]
|
||||
if matches!(target, TargetKind::Roblox | TargetKind::RobloxServer) {
|
||||
let (prefix, path) = match target.try_into() {
|
||||
Ok(place_kind) if !destination_dir.starts_with(root_container_dir) => (
|
||||
|
@ -177,7 +176,6 @@ pub mod errors {
|
|||
#[derive(Debug, Error)]
|
||||
pub enum GetLibRequirePath {
|
||||
/// The path for the RobloxPlaceKind could not be found
|
||||
#[cfg(feature = "roblox")]
|
||||
#[error("could not find the path for the RobloxPlaceKind {0}")]
|
||||
RobloxPlaceKindPathNotFound(crate::manifest::target::RobloxPlaceKind),
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@ impl Project {
|
|||
.or_default()
|
||||
.insert(version_id, types);
|
||||
|
||||
#[cfg(feature = "roblox")]
|
||||
if let Some(build_files) = Some(&node.target)
|
||||
.filter(|_| !node.node.pkg_ref.like_wally())
|
||||
.and_then(|t| t.build_files())
|
||||
|
@ -281,7 +280,6 @@ pub mod errors {
|
|||
FullMoon(String, Vec<full_moon::Error>),
|
||||
|
||||
/// An error occurred while generating a Roblox sync config
|
||||
#[cfg(feature = "roblox")]
|
||||
#[error("error generating roblox sync config for {0}")]
|
||||
GenerateRobloxSyncConfig(String, #[source] std::io::Error),
|
||||
|
||||
|
|
|
@ -77,7 +77,6 @@ pub struct Manifest {
|
|||
/// A list of globs pointing to workspace members' directories
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub workspace_members: Vec<String>,
|
||||
#[cfg(feature = "roblox")]
|
||||
/// The Roblox place of this project
|
||||
#[serde(default, skip_serializing)]
|
||||
pub place: BTreeMap<target::RobloxPlaceKind, String>,
|
||||
|
|
|
@ -13,29 +13,21 @@ use std::{
|
|||
)]
|
||||
pub enum TargetKind {
|
||||
/// A Roblox target
|
||||
#[cfg(feature = "roblox")]
|
||||
Roblox,
|
||||
/// A Roblox server target
|
||||
#[cfg(feature = "roblox")]
|
||||
RobloxServer,
|
||||
/// A Lune target
|
||||
#[cfg(feature = "lune")]
|
||||
Lune,
|
||||
/// A Luau target
|
||||
#[cfg(feature = "luau")]
|
||||
Luau,
|
||||
}
|
||||
|
||||
impl Display for TargetKind {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
#[cfg(feature = "roblox")]
|
||||
TargetKind::Roblox => write!(f, "roblox"),
|
||||
#[cfg(feature = "roblox")]
|
||||
TargetKind::RobloxServer => write!(f, "roblox_server"),
|
||||
#[cfg(feature = "lune")]
|
||||
TargetKind::Lune => write!(f, "lune"),
|
||||
#[cfg(feature = "luau")]
|
||||
TargetKind::Luau => write!(f, "luau"),
|
||||
}
|
||||
}
|
||||
|
@ -46,13 +38,9 @@ impl FromStr for TargetKind {
|
|||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
#[cfg(feature = "roblox")]
|
||||
"roblox" => Ok(Self::Roblox),
|
||||
#[cfg(feature = "roblox")]
|
||||
"roblox_server" => Ok(Self::RobloxServer),
|
||||
#[cfg(feature = "lune")]
|
||||
"lune" => Ok(Self::Lune),
|
||||
#[cfg(feature = "luau")]
|
||||
"luau" => Ok(Self::Luau),
|
||||
t => Err(errors::TargetKindFromStr::Unknown(t.to_string())),
|
||||
}
|
||||
|
@ -62,13 +50,9 @@ impl FromStr for TargetKind {
|
|||
impl TargetKind {
|
||||
/// All possible target variants
|
||||
pub const VARIANTS: &'static [TargetKind] = &[
|
||||
#[cfg(feature = "roblox")]
|
||||
TargetKind::Roblox,
|
||||
#[cfg(feature = "roblox")]
|
||||
TargetKind::RobloxServer,
|
||||
#[cfg(feature = "lune")]
|
||||
TargetKind::Lune,
|
||||
#[cfg(feature = "luau")]
|
||||
TargetKind::Luau,
|
||||
];
|
||||
|
||||
|
@ -91,7 +75,6 @@ impl TargetKind {
|
|||
#[serde(rename_all = "snake_case", tag = "environment")]
|
||||
pub enum Target {
|
||||
/// A Roblox target
|
||||
#[cfg(feature = "roblox")]
|
||||
Roblox {
|
||||
/// The path to the lib export file
|
||||
#[serde(default)]
|
||||
|
@ -101,7 +84,6 @@ pub enum Target {
|
|||
build_files: BTreeSet<String>,
|
||||
},
|
||||
/// A Roblox server target
|
||||
#[cfg(feature = "roblox")]
|
||||
RobloxServer {
|
||||
/// The path to the lib export file
|
||||
#[serde(default)]
|
||||
|
@ -111,7 +93,6 @@ pub enum Target {
|
|||
build_files: BTreeSet<String>,
|
||||
},
|
||||
/// A Lune target
|
||||
#[cfg(feature = "lune")]
|
||||
Lune {
|
||||
/// The path to the lib export file
|
||||
#[serde(default)]
|
||||
|
@ -121,7 +102,6 @@ pub enum Target {
|
|||
bin: Option<RelativePathBuf>,
|
||||
},
|
||||
/// A Luau target
|
||||
#[cfg(feature = "luau")]
|
||||
Luau {
|
||||
/// The path to the lib export file
|
||||
#[serde(default)]
|
||||
|
@ -136,13 +116,9 @@ impl Target {
|
|||
/// Returns the kind of this target
|
||||
pub fn kind(&self) -> TargetKind {
|
||||
match self {
|
||||
#[cfg(feature = "roblox")]
|
||||
Target::Roblox { .. } => TargetKind::Roblox,
|
||||
#[cfg(feature = "roblox")]
|
||||
Target::RobloxServer { .. } => TargetKind::RobloxServer,
|
||||
#[cfg(feature = "lune")]
|
||||
Target::Lune { .. } => TargetKind::Lune,
|
||||
#[cfg(feature = "luau")]
|
||||
Target::Luau { .. } => TargetKind::Luau,
|
||||
}
|
||||
}
|
||||
|
@ -150,13 +126,9 @@ impl Target {
|
|||
/// Returns the path to the lib export file
|
||||
pub fn lib_path(&self) -> Option<&RelativePathBuf> {
|
||||
match self {
|
||||
#[cfg(feature = "roblox")]
|
||||
Target::Roblox { lib, .. } => lib.as_ref(),
|
||||
#[cfg(feature = "roblox")]
|
||||
Target::RobloxServer { lib, .. } => lib.as_ref(),
|
||||
#[cfg(feature = "lune")]
|
||||
Target::Lune { lib, .. } => lib.as_ref(),
|
||||
#[cfg(feature = "luau")]
|
||||
Target::Luau { lib, .. } => lib.as_ref(),
|
||||
}
|
||||
}
|
||||
|
@ -164,13 +136,9 @@ impl Target {
|
|||
/// Returns the path to the bin export file
|
||||
pub fn bin_path(&self) -> Option<&RelativePathBuf> {
|
||||
match self {
|
||||
#[cfg(feature = "roblox")]
|
||||
Target::Roblox { .. } => None,
|
||||
#[cfg(feature = "roblox")]
|
||||
Target::RobloxServer { .. } => None,
|
||||
#[cfg(feature = "lune")]
|
||||
Target::Lune { bin, .. } => bin.as_ref(),
|
||||
#[cfg(feature = "luau")]
|
||||
Target::Luau { bin, .. } => bin.as_ref(),
|
||||
}
|
||||
}
|
||||
|
@ -178,9 +146,7 @@ impl Target {
|
|||
/// Returns the Roblox build files
|
||||
pub fn build_files(&self) -> Option<&BTreeSet<String>> {
|
||||
match self {
|
||||
#[cfg(feature = "roblox")]
|
||||
Target::Roblox { build_files, .. } => Some(build_files),
|
||||
#[cfg(feature = "roblox")]
|
||||
Target::RobloxServer { build_files, .. } => Some(build_files),
|
||||
_ => None,
|
||||
}
|
||||
|
@ -193,7 +159,6 @@ impl Display for Target {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "roblox")]
|
||||
/// The kind of a Roblox place property
|
||||
#[derive(
|
||||
SerializeDisplay, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd,
|
||||
|
@ -206,7 +171,6 @@ pub enum RobloxPlaceKind {
|
|||
Server,
|
||||
}
|
||||
|
||||
#[cfg(feature = "roblox")]
|
||||
impl TryInto<RobloxPlaceKind> for &TargetKind {
|
||||
type Error = ();
|
||||
|
||||
|
@ -219,7 +183,6 @@ impl TryInto<RobloxPlaceKind> for &TargetKind {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "roblox")]
|
||||
impl Display for RobloxPlaceKind {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
|
|
|
@ -12,7 +12,6 @@ use std::{
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
pub enum ScriptName {
|
||||
/// Generates a config for syncing tools for Roblox. For example, for Rojo it should create a `default.project.json` file
|
||||
#[cfg(feature = "roblox")]
|
||||
RobloxSyncConfigGenerator,
|
||||
/// Prints a sourcemap for a Wally package, used for finding the library export file
|
||||
#[cfg(feature = "wally-compat")]
|
||||
|
@ -21,15 +20,11 @@ pub enum ScriptName {
|
|||
|
||||
impl Display for ScriptName {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
#[cfg(feature = "roblox")]
|
||||
match self {
|
||||
#[cfg(feature = "roblox")]
|
||||
ScriptName::RobloxSyncConfigGenerator => write!(f, "roblox_sync_config_generator"),
|
||||
#[cfg(feature = "wally-compat")]
|
||||
ScriptName::SourcemapGenerator => write!(f, "sourcemap_generator"),
|
||||
}
|
||||
#[cfg(not(feature = "roblox"))]
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue