CLI Overview
The @archibald/cli package is the primary interface for developers to interact with the framework. It provides a set of commands for building, serving, and packaging applications, abstracting away the complexity of the underlying Rspack and SWC configurations.
info
This chapter covers the CLI internals. For day-to-day command usage and available flags, see the CLI usage docs.
Key Technologies
- Commander.js: Used for CLI command definition and argument parsing.
- Inquirer.js: Provides interactive prompts for selecting environments, tenants, and platforms.
- Chalk: Enhances CLI output with colored text for better readability.
Core Philosophy
The CLI is designed to be Tenant and Platform Aware. Every command (build, serve, etc.) requires a context consisting of an environment, a tenant, and a platform. This allows the framework to apply the correct "Shadowing" and configuration overrides during the compilation process.
Internal Orchestration
When a command is executed, the CLI performs a standard preparation sequence:
- Node Version Check: Ensures the environment meets the project's requirements.
- Config Resolution: Loads and merges the
archibald.jsonwith project-specific overrides. - Environment Preparation: Sets up the necessary paths and environment variables.
- Compiler Trigger: Hands over control to the Rspack-based compiler logic.