refactor(dev): align cargo dev command modules
Some checks are pending
Rust / Format (push) Waiting to run
Rust / Clippy (push) Waiting to run
Rust / Generated Docs (push) Waiting to run
Rust / Test (Linux) (push) Waiting to run
Rust / Test (macOS) (push) Waiting to run
TypeScript / Typecheck (push) Waiting to run
TypeScript / Test (push) Waiting to run
TypeScript / Build (push) Waiting to run

This commit is contained in:
Bryan Helmkamp 2026-04-25 19:50:31 -04:00
parent d37f75a878
commit bbe4d3c68c
No known key found for this signature in database
7 changed files with 26 additions and 26 deletions

View file

@ -3,8 +3,8 @@ use std::path::{Path, PathBuf};
use anyhow::Result;
use clap::{Args, Subcommand};
use super::generate_cli_reference::generate_cli_reference_root;
use super::generate_options_reference::generate_options_reference_root;
use super::docs_cli_reference::docs_cli_reference_root;
use super::docs_options_reference::docs_options_reference_root;
use super::workspace_root;
#[derive(Debug, Args)]
@ -37,13 +37,13 @@ pub(crate) fn docs(args: DocsArgs) -> Result<()> {
}
fn refresh_docs(root: &Path) -> Result<()> {
generate_cli_reference_root(root, false)?;
generate_options_reference_root(root, false)
docs_cli_reference_root(root, false)?;
docs_options_reference_root(root, false)
}
fn check_docs(root: &Path) -> Result<()> {
generate_cli_reference_root(root, true)?;
generate_options_reference_root(root, true)
docs_cli_reference_root(root, true)?;
docs_options_reference_root(root, true)
}
#[expect(

View file

@ -15,7 +15,7 @@ const FENCE_END: &str = "<!-- /generated:cli -->";
clippy::disallowed_methods,
reason = "dev generator reports the generated docs path directly and intentionally uses sync filesystem I/O"
)]
pub(crate) fn generate_cli_reference_root(root: &Path, check: bool) -> Result<()> {
pub(crate) fn docs_cli_reference_root(root: &Path, check: bool) -> Result<()> {
let path = root.join(CLI_REFERENCE_PATH);
let current =
std::fs::read_to_string(&path).with_context(|| format!("reading {}", path.display()))?;

View file

@ -15,7 +15,7 @@ const FENCE_END: &str = "<!-- /generated:options -->";
clippy::disallowed_methods,
reason = "dev generator reports the generated docs path directly and intentionally uses sync filesystem I/O"
)]
pub(crate) fn generate_options_reference_root(root: &Path, check: bool) -> Result<()> {
pub(crate) fn docs_options_reference_root(root: &Path, check: bool) -> Result<()> {
let path = root.join(OPTIONS_REFERENCE_PATH);
let current =
std::fs::read_to_string(&path).with_context(|| format!("reading {}", path.display()))?;

View file

@ -1,11 +1,11 @@
mod check_spa_budgets;
mod docker_build;
mod docs;
mod generate_cli_reference;
mod generate_options_reference;
mod refresh_spa;
mod docs_cli_reference;
mod docs_options_reference;
mod release;
mod spa;
mod spa_check;
mod spa_refresh;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};

View file

@ -1,8 +1,8 @@
use anyhow::Result;
use clap::{Args, Subcommand};
use super::check_spa_budgets::{CheckSpaBudgetsArgs, check_spa_budgets};
use super::refresh_spa::{RefreshSpaArgs, refresh_spa};
use super::spa_check::{SpaCheckArgs, spa_check};
use super::spa_refresh::{SpaRefreshArgs, spa_refresh};
#[derive(Debug, Args)]
pub(crate) struct SpaArgs {
@ -13,15 +13,15 @@ pub(crate) struct SpaArgs {
#[derive(Debug, Subcommand)]
enum SpaCommand {
/// Rebuild and refresh the embedded Fabro web SPA bundle.
Refresh(RefreshSpaArgs),
Refresh(SpaRefreshArgs),
/// Verify embedded Fabro web SPA assets are current and within budget.
Check(CheckSpaBudgetsArgs),
Check(SpaCheckArgs),
}
pub(crate) fn spa(args: SpaArgs) -> Result<()> {
match args.command {
Some(SpaCommand::Refresh(args)) => refresh_spa(args),
Some(SpaCommand::Check(args)) => check_spa_budgets(args),
Some(SpaCommand::Refresh(args)) => spa_refresh(args),
Some(SpaCommand::Check(args)) => spa_check(args),
None => print_spa_help(),
}
}

View file

@ -6,14 +6,14 @@ use anyhow::{Context, Result, bail};
use clap::Args;
use walkdir::WalkDir;
use super::refresh_spa::{TempDir, mirror_dist, run_bun_build};
use super::spa_refresh::{TempDir, mirror_dist, run_bun_build};
use super::workspace_root;
const DEFAULT_ASSET_BUDGET_BYTES: u64 = 15 * 1024 * 1024;
const DEFAULT_PAYLOAD_BUDGET_BYTES: u64 = 5 * 1024 * 1024;
#[derive(Debug, Args)]
pub(crate) struct CheckSpaBudgetsArgs {
pub(crate) struct SpaCheckArgs {
/// Repository root containing lib/crates/fabro-spa/assets.
#[arg(long, hide = true)]
root: Option<PathBuf>,
@ -32,7 +32,7 @@ pub(crate) struct CheckSpaBudgetsArgs {
clippy::print_stdout,
reason = "dev spa check command reports measured budgets directly"
)]
pub(crate) fn check_spa_budgets(args: CheckSpaBudgetsArgs) -> Result<()> {
pub(crate) fn spa_check(args: SpaCheckArgs) -> Result<()> {
let root = args.root.unwrap_or_else(workspace_root);
let web_dir = root.join("apps/fabro-web");
let dist_dir = web_dir.join("dist");

View file

@ -5,14 +5,14 @@ use anyhow::{Context, Result, bail};
use clap::Args;
use walkdir::WalkDir;
use super::check_spa_budgets::check_spa_asset_budgets;
use super::spa_check::check_spa_asset_budgets;
use super::workspace_root;
const DEFAULT_ASSET_BUDGET_BYTES: u64 = 15 * 1024 * 1024;
const DEFAULT_PAYLOAD_BUDGET_BYTES: u64 = 5 * 1024 * 1024;
#[derive(Debug, Args)]
pub(crate) struct RefreshSpaArgs {
pub(crate) struct SpaRefreshArgs {
/// Repository root containing apps/fabro-web and lib/crates/fabro-spa.
#[arg(long, hide = true)]
root: Option<PathBuf>,
@ -27,9 +27,9 @@ pub(crate) struct RefreshSpaArgs {
pub(super) payload_budget_bytes: u64,
}
pub(crate) fn refresh_spa(args: RefreshSpaArgs) -> Result<()> {
pub(crate) fn spa_refresh(args: SpaRefreshArgs) -> Result<()> {
let root = args.root.unwrap_or_else(workspace_root);
refresh_spa_root(
spa_refresh_root(
&root,
args.skip_build,
args.asset_budget_bytes,
@ -41,7 +41,7 @@ pub(crate) fn refresh_spa(args: RefreshSpaArgs) -> Result<()> {
clippy::print_stdout,
reason = "dev spa refresh command reports progress directly"
)]
pub(super) fn refresh_spa_root(
pub(super) fn spa_refresh_root(
root: &Path,
skip_build: bool,
asset_budget_bytes: u64,