From d445b1814a0533fd75b8961b6a1523625aabdbab Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 3 May 2026 00:33:21 +0300 Subject: [PATCH] treewide: migrate to multi-crate layout Signed-off-by: NotAShelf Change-Id: I11a2103f3530f07409177404577b90136a6a6964 --- Cargo.lock | 46 ++++++++++ Cargo.toml | 85 +++++++++---------- crates/pakker-cli/Cargo.toml | 47 ++++++++++ {src => crates/pakker-cli/src}/cli.rs | 0 .../pakker-cli/src}/cli/commands/add.rs | 0 .../pakker-cli/src}/cli/commands/add_prj.rs | 0 .../pakker-cli/src}/cli/commands/cfg.rs | 0 .../pakker-cli/src}/cli/commands/cfg_prj.rs | 0 .../src}/cli/commands/credentials.rs | 0 .../src}/cli/commands/credentials_set.rs | 0 .../src}/cli/commands/credentials_test.rs | 0 .../pakker-cli/src}/cli/commands/diff.rs | 0 .../pakker-cli/src}/cli/commands/export.rs | 0 .../pakker-cli/src}/cli/commands/fetch.rs | 0 .../pakker-cli/src}/cli/commands/fork.rs | 0 .../pakker-cli/src}/cli/commands/import.rs | 0 .../pakker-cli/src}/cli/commands/init.rs | 0 .../pakker-cli/src}/cli/commands/inspect.rs | 0 .../pakker-cli/src}/cli/commands/link.rs | 0 .../pakker-cli/src}/cli/commands/ls.rs | 0 .../pakker-cli/src}/cli/commands/mod.rs | 0 .../pakker-cli/src}/cli/commands/remote.rs | 0 .../src}/cli/commands/remote_update.rs | 0 .../pakker-cli/src}/cli/commands/rm.rs | 0 .../pakker-cli/src}/cli/commands/set.rs | 0 .../pakker-cli/src}/cli/commands/status.rs | 0 .../pakker-cli/src}/cli/commands/sync.rs | 0 .../pakker-cli/src}/cli/commands/unlink.rs | 0 .../pakker-cli/src}/cli/commands/update.rs | 0 {src => crates/pakker-cli/src}/cli/tests.rs | 0 src/main.rs => crates/pakker-cli/src/lib.rs | 41 +++------ crates/pakker-core/Cargo.toml | 47 ++++++++++ {src => crates/pakker-core/src}/error.rs | 3 +- {src => crates/pakker-core/src}/export.rs | 0 .../pakker-core/src}/export/cache.rs | 0 .../pakker-core/src}/export/profile_config.rs | 0 .../pakker-core/src}/export/profiles.rs | 0 .../pakker-core/src}/export/rules.rs | 0 {src => crates/pakker-core/src}/fetch.rs | 0 {src => crates/pakker-core/src}/git/mod.rs | 0 {src => crates/pakker-core/src}/http.rs | 0 {src => crates/pakker-core/src}/ipc.rs | 0 crates/pakker-core/src/lib.rs | 21 +++++ {src => crates/pakker-core/src}/model.rs | 0 .../pakker-core/src}/model/config.rs | 0 .../pakker-core/src}/model/credentials.rs | 0 .../pakker-core/src}/model/enums.rs | 0 {src => crates/pakker-core/src}/model/fork.rs | 0 .../pakker-core/src}/model/lockfile.rs | 0 .../pakker-core/src}/model/override.rs | 0 .../pakker-core/src}/model/project.rs | 0 {src => crates/pakker-core/src}/platform.rs | 0 .../pakker-core/src}/platform/curseforge.rs | 0 .../pakker-core/src}/platform/github.rs | 0 .../pakker-core/src}/platform/modrinth.rs | 0 .../src}/platform/multiplatform.rs | 0 .../pakker-core/src}/platform/traits.rs | 0 .../pakker-core/src}/rate_limiter.rs | 0 {src => crates/pakker-core/src}/resolver.rs | 0 {src => crates/pakker-core/src}/ui_utils.rs | 0 .../pakker-core/src}/utils/flexver.rs | 0 {src => crates/pakker-core/src}/utils/hash.rs | 0 {src => crates/pakker-core/src}/utils/id.rs | 0 {src => crates/pakker-core/src}/utils/mod.rs | 0 pakker/Cargo.toml | 21 +++++ pakker/src/main.rs | 6 ++ {tests => pakker/tests}/common/mod.rs | 4 +- {tests => pakker/tests}/fork_from_path.rs | 0 68 files changed, 248 insertions(+), 73 deletions(-) create mode 100644 crates/pakker-cli/Cargo.toml rename {src => crates/pakker-cli/src}/cli.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/add.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/add_prj.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/cfg.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/cfg_prj.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/credentials.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/credentials_set.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/credentials_test.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/diff.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/export.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/fetch.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/fork.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/import.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/init.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/inspect.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/link.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/ls.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/mod.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/remote.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/remote_update.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/rm.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/set.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/status.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/sync.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/unlink.rs (100%) rename {src => crates/pakker-cli/src}/cli/commands/update.rs (100%) rename {src => crates/pakker-cli/src}/cli/tests.rs (100%) rename src/main.rs => crates/pakker-cli/src/lib.rs (87%) create mode 100644 crates/pakker-core/Cargo.toml rename {src => crates/pakker-core/src}/error.rs (99%) rename {src => crates/pakker-core/src}/export.rs (100%) rename {src => crates/pakker-core/src}/export/cache.rs (100%) rename {src => crates/pakker-core/src}/export/profile_config.rs (100%) rename {src => crates/pakker-core/src}/export/profiles.rs (100%) rename {src => crates/pakker-core/src}/export/rules.rs (100%) rename {src => crates/pakker-core/src}/fetch.rs (100%) rename {src => crates/pakker-core/src}/git/mod.rs (100%) rename {src => crates/pakker-core/src}/http.rs (100%) rename {src => crates/pakker-core/src}/ipc.rs (100%) create mode 100644 crates/pakker-core/src/lib.rs rename {src => crates/pakker-core/src}/model.rs (100%) rename {src => crates/pakker-core/src}/model/config.rs (100%) rename {src => crates/pakker-core/src}/model/credentials.rs (100%) rename {src => crates/pakker-core/src}/model/enums.rs (100%) rename {src => crates/pakker-core/src}/model/fork.rs (100%) rename {src => crates/pakker-core/src}/model/lockfile.rs (100%) rename {src => crates/pakker-core/src}/model/override.rs (100%) rename {src => crates/pakker-core/src}/model/project.rs (100%) rename {src => crates/pakker-core/src}/platform.rs (100%) rename {src => crates/pakker-core/src}/platform/curseforge.rs (100%) rename {src => crates/pakker-core/src}/platform/github.rs (100%) rename {src => crates/pakker-core/src}/platform/modrinth.rs (100%) rename {src => crates/pakker-core/src}/platform/multiplatform.rs (100%) rename {src => crates/pakker-core/src}/platform/traits.rs (100%) rename {src => crates/pakker-core/src}/rate_limiter.rs (100%) rename {src => crates/pakker-core/src}/resolver.rs (100%) rename {src => crates/pakker-core/src}/ui_utils.rs (100%) rename {src => crates/pakker-core/src}/utils/flexver.rs (100%) rename {src => crates/pakker-core/src}/utils/hash.rs (100%) rename {src => crates/pakker-core/src}/utils/id.rs (100%) rename {src => crates/pakker-core/src}/utils/mod.rs (100%) create mode 100644 pakker/Cargo.toml create mode 100644 pakker/src/main.rs rename {tests => pakker/tests}/common/mod.rs (96%) rename {tests => pakker/tests}/fork_from_path.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 4971f9d..3294160 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2886,6 +2886,16 @@ dependencies = [ [[package]] name = "pakker" version = "1.0.2" +dependencies = [ + "git2", + "pakker-cli", + "tempfile", + "tokio", +] + +[[package]] +name = "pakker-cli" +version = "1.0.2" dependencies = [ "anyhow", "async-trait", @@ -2902,6 +2912,42 @@ dependencies = [ "libc", "log", "md-5", + "pakker-core", + "rand 0.10.1", + "regex", + "reqwest", + "semver", + "serde", + "serde_json", + "sha1", + "sha2 0.11.0", + "strsim", + "tempfile", + "textwrap", + "thiserror 2.0.18", + "tokio", + "walkdir", + "yansi", + "zip", +] + +[[package]] +name = "pakker-core" +version = "1.0.2" +dependencies = [ + "anyhow", + "async-trait", + "comfy-table", + "dialoguer", + "futures", + "git2", + "glob", + "indicatif", + "keyring", + "keyring-core", + "libc", + "log", + "md-5", "mockito", "rand 0.10.1", "regex", diff --git a/Cargo.toml b/Cargo.toml index e4511e0..c5472de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,53 +1,52 @@ -[package] -name = "pakker" -version = "1.0.2" -edition = "2024" -authors = [ "NotAShelf " ] -description = "A fast, reliable multiplatform modpack manager for Minecraft" -keywords = [ "minecraft", "modpack", "modrinth", "curseforge", "package-manager" ] +[workspace] +members = [ "crates/*", "pakker" ] +resolver = "3" + +[workspace.package] categories = [ "command-line-utilities", "games" ] +edition = "2024" +keywords = [ "minecraft", "modpack", "modrinth", "curseforge", "package-manager" ] rust-version = "1.94.0" -readme = true +version = "1.0.2" +[workspace.dependencies] +pakker-cli = { path = "./crates/pakker-cli" } +pakker-core = { path = "./crates/pakker-core" } -[dependencies] -anyhow = "1.0.102" -async-trait = "0.1.89" -clap = { version = "4.6.1", features = [ "derive" ] } -comfy-table = "7.2.2" -dialoguer = "0.12.0" -env_logger = "0.11.10" -futures = "0.3.32" -git2 = "0.20.4" -glob = "0.3.3" -indicatif = "0.18.4" +anyhow = "1.0.102" +async-trait = "0.1.89" +clap = { version = "4.6.1", features = [ "derive" ] } +comfy-table = "7.2.2" +dialoguer = "0.12.0" +env_logger = "0.11.10" +futures = "0.3.32" +git2 = "0.20.4" +glob = "0.3.3" +indicatif = "0.18.4" keyring = "4.0.0" keyring-core = "1.0.0" -libc = "0.2.186" -log = "0.4.29" -md-5 = "0.11.0" -rand = "0.10.1" -regex = "1.12.3" -reqwest = { version = "0.13.3", features = [ "json" ] } -semver = "1.0.28" -serde = { version = "1.0.228", features = [ "derive" ] } -serde_json = "1.0.149" -sha1 = "0.11.0" -sha2 = "0.11.0" -strsim = "0.11.1" -tempfile = "3.27.0" -textwrap = "0.16.2" -thiserror = "2.0.18" -tokio = { version = "1.52.1", features = [ "full" ] } -walkdir = "2.5.0" -yansi = "1.0.1" -zip = "8.6.0" +libc = "0.2.186" +log = "0.4.29" +md-5 = "0.11.0" +mockito = "1.7.2" +rand = "0.10.1" +regex = "1.12.3" +reqwest = { version = "0.13.3", features = [ "json" ] } +semver = "1.0.28" +serde = { version = "1.0.228", features = [ "derive" ] } +serde_json = "1.0.149" +sha1 = "0.11.0" +sha2 = "0.11.0" +strsim = "0.11.1" +tempfile = "3.27.0" +textwrap = "0.16.2" +thiserror = "2.0.18" +tokio = { version = "1.52.1", features = [ "full" ] } +walkdir = "2.5.0" +yansi = "1.0.1" +zip = "8.6.0" -[dev-dependencies] -mockito = "1.7.2" -tempfile = "3.27.0" - -[lints.clippy] +[workspace.lints.clippy] cargo = { level = "warn", priority = -1 } complexity = { level = "warn", priority = -1 } nursery = { level = "warn", priority = -1 } diff --git a/crates/pakker-cli/Cargo.toml b/crates/pakker-cli/Cargo.toml new file mode 100644 index 0000000..2605491 --- /dev/null +++ b/crates/pakker-cli/Cargo.toml @@ -0,0 +1,47 @@ +[package] +name = "pakker-cli" +version.workspace = true +edition.workspace = true +description = "CLI library for Pakker" +keywords.workspace = true +categories.workspace = true +rust-version.workspace = true +readme = "../../docs/README.md" + +[dependencies] +pakker-core.workspace = true + +anyhow.workspace = true +async-trait.workspace = true +clap.workspace = true +comfy-table.workspace = true +dialoguer.workspace = true +env_logger.workspace = true +futures.workspace = true +git2.workspace = true +glob.workspace = true +indicatif.workspace = true +keyring.workspace = true +keyring-core.workspace = true +libc.workspace = true +log.workspace = true +md-5.workspace = true +rand.workspace = true +regex.workspace = true +reqwest.workspace = true +semver.workspace = true +serde.workspace = true +serde_json.workspace = true +sha1.workspace = true +sha2.workspace = true +strsim.workspace = true +tempfile.workspace = true +textwrap.workspace = true +thiserror.workspace = true +tokio.workspace = true +walkdir.workspace = true +yansi.workspace = true +zip.workspace = true + +[lints] +workspace = true diff --git a/src/cli.rs b/crates/pakker-cli/src/cli.rs similarity index 100% rename from src/cli.rs rename to crates/pakker-cli/src/cli.rs diff --git a/src/cli/commands/add.rs b/crates/pakker-cli/src/cli/commands/add.rs similarity index 100% rename from src/cli/commands/add.rs rename to crates/pakker-cli/src/cli/commands/add.rs diff --git a/src/cli/commands/add_prj.rs b/crates/pakker-cli/src/cli/commands/add_prj.rs similarity index 100% rename from src/cli/commands/add_prj.rs rename to crates/pakker-cli/src/cli/commands/add_prj.rs diff --git a/src/cli/commands/cfg.rs b/crates/pakker-cli/src/cli/commands/cfg.rs similarity index 100% rename from src/cli/commands/cfg.rs rename to crates/pakker-cli/src/cli/commands/cfg.rs diff --git a/src/cli/commands/cfg_prj.rs b/crates/pakker-cli/src/cli/commands/cfg_prj.rs similarity index 100% rename from src/cli/commands/cfg_prj.rs rename to crates/pakker-cli/src/cli/commands/cfg_prj.rs diff --git a/src/cli/commands/credentials.rs b/crates/pakker-cli/src/cli/commands/credentials.rs similarity index 100% rename from src/cli/commands/credentials.rs rename to crates/pakker-cli/src/cli/commands/credentials.rs diff --git a/src/cli/commands/credentials_set.rs b/crates/pakker-cli/src/cli/commands/credentials_set.rs similarity index 100% rename from src/cli/commands/credentials_set.rs rename to crates/pakker-cli/src/cli/commands/credentials_set.rs diff --git a/src/cli/commands/credentials_test.rs b/crates/pakker-cli/src/cli/commands/credentials_test.rs similarity index 100% rename from src/cli/commands/credentials_test.rs rename to crates/pakker-cli/src/cli/commands/credentials_test.rs diff --git a/src/cli/commands/diff.rs b/crates/pakker-cli/src/cli/commands/diff.rs similarity index 100% rename from src/cli/commands/diff.rs rename to crates/pakker-cli/src/cli/commands/diff.rs diff --git a/src/cli/commands/export.rs b/crates/pakker-cli/src/cli/commands/export.rs similarity index 100% rename from src/cli/commands/export.rs rename to crates/pakker-cli/src/cli/commands/export.rs diff --git a/src/cli/commands/fetch.rs b/crates/pakker-cli/src/cli/commands/fetch.rs similarity index 100% rename from src/cli/commands/fetch.rs rename to crates/pakker-cli/src/cli/commands/fetch.rs diff --git a/src/cli/commands/fork.rs b/crates/pakker-cli/src/cli/commands/fork.rs similarity index 100% rename from src/cli/commands/fork.rs rename to crates/pakker-cli/src/cli/commands/fork.rs diff --git a/src/cli/commands/import.rs b/crates/pakker-cli/src/cli/commands/import.rs similarity index 100% rename from src/cli/commands/import.rs rename to crates/pakker-cli/src/cli/commands/import.rs diff --git a/src/cli/commands/init.rs b/crates/pakker-cli/src/cli/commands/init.rs similarity index 100% rename from src/cli/commands/init.rs rename to crates/pakker-cli/src/cli/commands/init.rs diff --git a/src/cli/commands/inspect.rs b/crates/pakker-cli/src/cli/commands/inspect.rs similarity index 100% rename from src/cli/commands/inspect.rs rename to crates/pakker-cli/src/cli/commands/inspect.rs diff --git a/src/cli/commands/link.rs b/crates/pakker-cli/src/cli/commands/link.rs similarity index 100% rename from src/cli/commands/link.rs rename to crates/pakker-cli/src/cli/commands/link.rs diff --git a/src/cli/commands/ls.rs b/crates/pakker-cli/src/cli/commands/ls.rs similarity index 100% rename from src/cli/commands/ls.rs rename to crates/pakker-cli/src/cli/commands/ls.rs diff --git a/src/cli/commands/mod.rs b/crates/pakker-cli/src/cli/commands/mod.rs similarity index 100% rename from src/cli/commands/mod.rs rename to crates/pakker-cli/src/cli/commands/mod.rs diff --git a/src/cli/commands/remote.rs b/crates/pakker-cli/src/cli/commands/remote.rs similarity index 100% rename from src/cli/commands/remote.rs rename to crates/pakker-cli/src/cli/commands/remote.rs diff --git a/src/cli/commands/remote_update.rs b/crates/pakker-cli/src/cli/commands/remote_update.rs similarity index 100% rename from src/cli/commands/remote_update.rs rename to crates/pakker-cli/src/cli/commands/remote_update.rs diff --git a/src/cli/commands/rm.rs b/crates/pakker-cli/src/cli/commands/rm.rs similarity index 100% rename from src/cli/commands/rm.rs rename to crates/pakker-cli/src/cli/commands/rm.rs diff --git a/src/cli/commands/set.rs b/crates/pakker-cli/src/cli/commands/set.rs similarity index 100% rename from src/cli/commands/set.rs rename to crates/pakker-cli/src/cli/commands/set.rs diff --git a/src/cli/commands/status.rs b/crates/pakker-cli/src/cli/commands/status.rs similarity index 100% rename from src/cli/commands/status.rs rename to crates/pakker-cli/src/cli/commands/status.rs diff --git a/src/cli/commands/sync.rs b/crates/pakker-cli/src/cli/commands/sync.rs similarity index 100% rename from src/cli/commands/sync.rs rename to crates/pakker-cli/src/cli/commands/sync.rs diff --git a/src/cli/commands/unlink.rs b/crates/pakker-cli/src/cli/commands/unlink.rs similarity index 100% rename from src/cli/commands/unlink.rs rename to crates/pakker-cli/src/cli/commands/unlink.rs diff --git a/src/cli/commands/update.rs b/crates/pakker-cli/src/cli/commands/update.rs similarity index 100% rename from src/cli/commands/update.rs rename to crates/pakker-cli/src/cli/commands/update.rs diff --git a/src/cli/tests.rs b/crates/pakker-cli/src/cli/tests.rs similarity index 100% rename from src/cli/tests.rs rename to crates/pakker-cli/src/cli/tests.rs diff --git a/src/main.rs b/crates/pakker-cli/src/lib.rs similarity index 87% rename from src/main.rs rename to crates/pakker-cli/src/lib.rs index 62c9a2b..503c82d 100644 --- a/src/main.rs +++ b/crates/pakker-cli/src/lib.rs @@ -7,28 +7,20 @@ reason = "license and repository not yet configured" )] -mod cli; -mod error; -mod export; -mod fetch; -mod git; -mod http; -mod ipc; -mod model; -mod platform; -mod rate_limiter; -mod resolver; -mod ui_utils; -mod utils; - use std::{env, path::PathBuf}; use clap::Parser; + +pub mod cli; + +pub use pakker_core::{ + error, export, fetch, git, http, ipc, model, platform, rate_limiter, resolver, + ui_utils, utils, +}; + use cli::{Cli, Commands}; use error::PakkerError; -/// Search for pakker-lock.json in current directory and parent directories -/// Returns the directory containing pakker-lock.json, or None if not found fn find_working_directory() -> Option { let mut current_dir = env::current_dir().ok()?; @@ -38,24 +30,20 @@ fn find_working_directory() -> Option { return Some(current_dir); } - // Try parent directory if !current_dir.pop() { - // Reached filesystem root return None; } } } -#[tokio::main] -async fn main() -> Result<(), PakkerError> { +pub async fn run() -> Result<(), PakkerError> { let cli = Cli::parse(); - // Initialize logging based on verbosity level let log_level = match cli.verbose { - 0 => "warn", // Default: only warnings and errors - 1 => "info", // -v: info level - 2 => "debug", // -vv: debug level - _ => "trace", // -vvv+: trace level (most verbose) + 0 => "warn", + 1 => "info", + 2 => "debug", + _ => "trace", }; env_logger::Builder::from_env( @@ -65,17 +53,14 @@ async fn main() -> Result<(), PakkerError> { .format_module_path(false) .init(); - // Initialize the platform keyring store so credential commands work. if let Err(e) = keyring::use_native_store(false) { log::warn!("Failed to initialize platform keyring store: {e}"); } - // Search for pakker-lock.json in current directory and parent directories let working_dir = find_working_directory().unwrap_or_else(|| PathBuf::from(".")); let lockfile_path = working_dir.join("pakker-lock.json"); let config_path = working_dir.join("pakker.json"); - let global_yes = cli.yes; match cli.command { diff --git a/crates/pakker-core/Cargo.toml b/crates/pakker-core/Cargo.toml new file mode 100644 index 0000000..f7281a0 --- /dev/null +++ b/crates/pakker-core/Cargo.toml @@ -0,0 +1,47 @@ +[package] +name = "pakker-core" +version.workspace = true +edition.workspace = true +description = "Core library for Pakker" +keywords.workspace = true +categories.workspace = true +rust-version.workspace = true +readme = "../../docs/README.md" + +[dependencies] +anyhow.workspace = true +async-trait.workspace = true +comfy-table.workspace = true +dialoguer.workspace = true +futures.workspace = true +git2.workspace = true +glob.workspace = true +indicatif.workspace = true +keyring.workspace = true +keyring-core.workspace = true +libc.workspace = true +log.workspace = true +md-5.workspace = true +rand.workspace = true +regex.workspace = true +reqwest.workspace = true +semver.workspace = true +serde.workspace = true +serde_json.workspace = true +sha1.workspace = true +sha2.workspace = true +strsim.workspace = true +tempfile.workspace = true +textwrap.workspace = true +thiserror.workspace = true +tokio.workspace = true +walkdir.workspace = true +yansi.workspace = true +zip.workspace = true + +[dev-dependencies] +mockito.workspace = true +tempfile.workspace = true + +[lints] +workspace = true diff --git a/src/error.rs b/crates/pakker-core/src/error.rs similarity index 99% rename from src/error.rs rename to crates/pakker-core/src/error.rs index 2455aaf..03947f7 100644 --- a/src/error.rs +++ b/crates/pakker-core/src/error.rs @@ -10,10 +10,11 @@ pub enum ErrorSeverity { /// Fatal error - operation cannot continue #[default] Error, + /// Warning - operation can continue but may have issues Warning, + /// Info - informational message - #[expect(dead_code, reason = "reserved for future use")] Info, } diff --git a/src/export.rs b/crates/pakker-core/src/export.rs similarity index 100% rename from src/export.rs rename to crates/pakker-core/src/export.rs diff --git a/src/export/cache.rs b/crates/pakker-core/src/export/cache.rs similarity index 100% rename from src/export/cache.rs rename to crates/pakker-core/src/export/cache.rs diff --git a/src/export/profile_config.rs b/crates/pakker-core/src/export/profile_config.rs similarity index 100% rename from src/export/profile_config.rs rename to crates/pakker-core/src/export/profile_config.rs diff --git a/src/export/profiles.rs b/crates/pakker-core/src/export/profiles.rs similarity index 100% rename from src/export/profiles.rs rename to crates/pakker-core/src/export/profiles.rs diff --git a/src/export/rules.rs b/crates/pakker-core/src/export/rules.rs similarity index 100% rename from src/export/rules.rs rename to crates/pakker-core/src/export/rules.rs diff --git a/src/fetch.rs b/crates/pakker-core/src/fetch.rs similarity index 100% rename from src/fetch.rs rename to crates/pakker-core/src/fetch.rs diff --git a/src/git/mod.rs b/crates/pakker-core/src/git/mod.rs similarity index 100% rename from src/git/mod.rs rename to crates/pakker-core/src/git/mod.rs diff --git a/src/http.rs b/crates/pakker-core/src/http.rs similarity index 100% rename from src/http.rs rename to crates/pakker-core/src/http.rs diff --git a/src/ipc.rs b/crates/pakker-core/src/ipc.rs similarity index 100% rename from src/ipc.rs rename to crates/pakker-core/src/ipc.rs diff --git a/crates/pakker-core/src/lib.rs b/crates/pakker-core/src/lib.rs new file mode 100644 index 0000000..eb864a5 --- /dev/null +++ b/crates/pakker-core/src/lib.rs @@ -0,0 +1,21 @@ +#![expect( + clippy::multiple_crate_versions, + reason = "transitive dependency version conflicts from upstream crates" +)] +#![expect( + clippy::cargo_common_metadata, + reason = "license and repository not yet configured" +)] + +pub mod error; +pub mod export; +pub mod fetch; +pub mod git; +pub mod http; +pub mod ipc; +pub mod model; +pub mod platform; +pub mod rate_limiter; +pub mod resolver; +pub mod ui_utils; +pub mod utils; diff --git a/src/model.rs b/crates/pakker-core/src/model.rs similarity index 100% rename from src/model.rs rename to crates/pakker-core/src/model.rs diff --git a/src/model/config.rs b/crates/pakker-core/src/model/config.rs similarity index 100% rename from src/model/config.rs rename to crates/pakker-core/src/model/config.rs diff --git a/src/model/credentials.rs b/crates/pakker-core/src/model/credentials.rs similarity index 100% rename from src/model/credentials.rs rename to crates/pakker-core/src/model/credentials.rs diff --git a/src/model/enums.rs b/crates/pakker-core/src/model/enums.rs similarity index 100% rename from src/model/enums.rs rename to crates/pakker-core/src/model/enums.rs diff --git a/src/model/fork.rs b/crates/pakker-core/src/model/fork.rs similarity index 100% rename from src/model/fork.rs rename to crates/pakker-core/src/model/fork.rs diff --git a/src/model/lockfile.rs b/crates/pakker-core/src/model/lockfile.rs similarity index 100% rename from src/model/lockfile.rs rename to crates/pakker-core/src/model/lockfile.rs diff --git a/src/model/override.rs b/crates/pakker-core/src/model/override.rs similarity index 100% rename from src/model/override.rs rename to crates/pakker-core/src/model/override.rs diff --git a/src/model/project.rs b/crates/pakker-core/src/model/project.rs similarity index 100% rename from src/model/project.rs rename to crates/pakker-core/src/model/project.rs diff --git a/src/platform.rs b/crates/pakker-core/src/platform.rs similarity index 100% rename from src/platform.rs rename to crates/pakker-core/src/platform.rs diff --git a/src/platform/curseforge.rs b/crates/pakker-core/src/platform/curseforge.rs similarity index 100% rename from src/platform/curseforge.rs rename to crates/pakker-core/src/platform/curseforge.rs diff --git a/src/platform/github.rs b/crates/pakker-core/src/platform/github.rs similarity index 100% rename from src/platform/github.rs rename to crates/pakker-core/src/platform/github.rs diff --git a/src/platform/modrinth.rs b/crates/pakker-core/src/platform/modrinth.rs similarity index 100% rename from src/platform/modrinth.rs rename to crates/pakker-core/src/platform/modrinth.rs diff --git a/src/platform/multiplatform.rs b/crates/pakker-core/src/platform/multiplatform.rs similarity index 100% rename from src/platform/multiplatform.rs rename to crates/pakker-core/src/platform/multiplatform.rs diff --git a/src/platform/traits.rs b/crates/pakker-core/src/platform/traits.rs similarity index 100% rename from src/platform/traits.rs rename to crates/pakker-core/src/platform/traits.rs diff --git a/src/rate_limiter.rs b/crates/pakker-core/src/rate_limiter.rs similarity index 100% rename from src/rate_limiter.rs rename to crates/pakker-core/src/rate_limiter.rs diff --git a/src/resolver.rs b/crates/pakker-core/src/resolver.rs similarity index 100% rename from src/resolver.rs rename to crates/pakker-core/src/resolver.rs diff --git a/src/ui_utils.rs b/crates/pakker-core/src/ui_utils.rs similarity index 100% rename from src/ui_utils.rs rename to crates/pakker-core/src/ui_utils.rs diff --git a/src/utils/flexver.rs b/crates/pakker-core/src/utils/flexver.rs similarity index 100% rename from src/utils/flexver.rs rename to crates/pakker-core/src/utils/flexver.rs diff --git a/src/utils/hash.rs b/crates/pakker-core/src/utils/hash.rs similarity index 100% rename from src/utils/hash.rs rename to crates/pakker-core/src/utils/hash.rs diff --git a/src/utils/id.rs b/crates/pakker-core/src/utils/id.rs similarity index 100% rename from src/utils/id.rs rename to crates/pakker-core/src/utils/id.rs diff --git a/src/utils/mod.rs b/crates/pakker-core/src/utils/mod.rs similarity index 100% rename from src/utils/mod.rs rename to crates/pakker-core/src/utils/mod.rs diff --git a/pakker/Cargo.toml b/pakker/Cargo.toml new file mode 100644 index 0000000..f19462b --- /dev/null +++ b/pakker/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "pakker" +version.workspace = true +edition.workspace = true +description = "A fast, reliable multiplatform modpack manager for Minecraft" +keywords.workspace = true +categories.workspace = true +rust-version.workspace = true +readme = "../docs/README.md" + +[dependencies] +pakker-cli.workspace = true + +tokio.workspace = true + +[dev-dependencies] +git2.workspace = true +tempfile.workspace = true + +[lints] +workspace = true diff --git a/pakker/src/main.rs b/pakker/src/main.rs new file mode 100644 index 0000000..609f560 --- /dev/null +++ b/pakker/src/main.rs @@ -0,0 +1,6 @@ +use pakker_cli::error::PakkerError; + +#[tokio::main] +async fn main() -> Result<(), PakkerError> { + pakker_cli::run().await +} diff --git a/tests/common/mod.rs b/pakker/tests/common/mod.rs similarity index 96% rename from tests/common/mod.rs rename to pakker/tests/common/mod.rs index b8f64cb..ef8bdbc 100644 --- a/tests/common/mod.rs +++ b/pakker/tests/common/mod.rs @@ -4,7 +4,9 @@ use git2::{Repository, Signature}; pub fn pakker_bin_path() -> PathBuf { let manifest = env!("CARGO_MANIFEST_DIR"); - PathBuf::from(manifest).join("target/debug/pakker") + PathBuf::from(manifest) + .join("..") + .join("target/debug/pakker") } pub fn init_bare_repo(path: &PathBuf) -> Result { diff --git a/tests/fork_from_path.rs b/pakker/tests/fork_from_path.rs similarity index 100% rename from tests/fork_from_path.rs rename to pakker/tests/fork_from_path.rs