diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-22 00:37:54 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-22 00:37:54 +0900 |
| commit | 0a8e5935e6305819bb02d8c69e2f046ff397913a (patch) | |
| tree | e5a288e679477b1603d7989e986ca22bbe590aa4 /crates/mozart/src/commands/install.rs | |
| parent | b5af594fec7da72b15c9a202c641af0494db6355 (diff) | |
| download | php-mozart-0a8e5935e6305819bb02d8c69e2f046ff397913a.tar.gz php-mozart-0a8e5935e6305819bb02d8c69e2f046ff397913a.tar.zst php-mozart-0a8e5935e6305819bb02d8c69e2f046ff397913a.zip | |
refactor(workspace): split monolithic crate into 6 workspace crates
Extract modules from the single `mozart` crate into 5 focused library
crates to improve compilation parallelism and architectural clarity:
- mozart-constraint: version constraint parser (independent)
- mozart-core: base types, console, validation, platform utilities
- mozart-archiver: archive creation (tar, zip, bzip2)
- mozart-registry: Packagist API, cache, resolver, downloader, lockfile
- mozart-autoload: autoloader generation and PHP scanner
Refactor Console::from_cli and build_cache_config to accept primitive
args instead of &Cli to break circular dependencies. Introduce
[workspace.dependencies] for centralized version management. Remove 9
unused direct dependencies from the CLI crate.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/install.rs')
| -rw-r--r-- | crates/mozart/src/commands/install.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/crates/mozart/src/commands/install.rs b/crates/mozart/src/commands/install.rs index fb7335b..1094d99 100644 --- a/crates/mozart/src/commands/install.rs +++ b/crates/mozart/src/commands/install.rs @@ -1,8 +1,8 @@ -use crate::console; -use crate::downloader; -use crate::installed; -use crate::lockfile; use clap::Args; +use mozart_core::console; +use mozart_registry::downloader; +use mozart_registry::installed; +use mozart_registry::lockfile; use std::collections::{BTreeMap, HashSet}; use std::path::{Path, PathBuf}; @@ -475,7 +475,7 @@ pub fn install_from_lock( let suffix = lock.content_hash.clone(); - crate::autoload::generate(&crate::autoload::AutoloadConfig { + mozart_autoload::autoload::generate(&mozart_autoload::autoload::AutoloadConfig { project_dir: working_dir.to_path_buf(), vendor_dir: vendor_dir.to_path_buf(), dev_mode, @@ -485,7 +485,7 @@ pub fn install_from_lock( apcu: config.apcu_autoloader, apcu_prefix: config.apcu_autoloader_prefix.clone(), strict_psr: false, - platform_check: crate::autoload::PlatformCheckMode::Full, + platform_check: mozart_autoload::autoload::PlatformCheckMode::Full, ignore_platform_reqs: config.ignore_platform_reqs, })?; @@ -499,7 +499,7 @@ pub fn install_from_lock( pub fn execute( args: &InstallArgs, cli: &super::Cli, - console: &crate::console::Console, + console: &mozart_core::console::Console, ) -> anyhow::Result<()> { // Step 1: Resolve the working directory let working_dir = resolve_working_dir(cli); @@ -507,8 +507,8 @@ pub fn execute( // Step 2: Validate arguments if !args.packages.is_empty() { let pkgs = args.packages.join(" "); - return Err(crate::exit_code::bail( - crate::exit_code::GENERAL_ERROR, + return Err(mozart_core::exit_code::bail( + mozart_core::exit_code::GENERAL_ERROR, format!( "Invalid argument {pkgs}. Use \"mozart require {pkgs}\" instead to add packages to your composer.json." ), @@ -516,8 +516,8 @@ pub fn execute( } if args.no_install { - return Err(crate::exit_code::bail( - crate::exit_code::GENERAL_ERROR, + return Err(mozart_core::exit_code::bail( + mozart_core::exit_code::GENERAL_ERROR, "Invalid option \"--no-install\". Use \"mozart update --no-install\" instead if you are trying to update the composer.lock file.", )); } @@ -537,8 +537,8 @@ pub fn execute( // Step 3: Read composer.lock let lock_path = working_dir.join("composer.lock"); if !lock_path.exists() { - return Err(crate::exit_code::bail( - crate::exit_code::LOCK_FILE_INVALID, + return Err(mozart_core::exit_code::bail( + mozart_core::exit_code::LOCK_FILE_INVALID, "No composer.lock file present. Run \"mozart update\" to generate one.", )); } |
