Skip to content

refactor: extract shared dry-run, config-persist, and command helpers (v0.4.4)#18

Merged
masonlet merged 8 commits into
mainfrom
refactor/helpers
Jul 4, 2026
Merged

refactor: extract shared dry-run, config-persist, and command helpers (v0.4.4)#18
masonlet merged 8 commits into
mainfrom
refactor/helpers

Conversation

@masonlet

@masonlet masonlet commented Jul 4, 2026

Copy link
Copy Markdown
Member

Summary

Deduplication pass, extracts four shared helpers for four copied patterns across modules, plus two small output fixes

Changes

Refactors

  • utils::report_summary replaces the copied
    if dry_run { if verbose { "Would X" } } else { "X" } block in
    mono/config.rs (×2) and mono/watch.rs.
  • mono::npm::read_package_json shared reader for
    {repo}/package.json (verbose warnings on unreadable/malformed files), replacing
    duplicated logic in create_mono_repo_package_json and get_watch_command.
  • run_timed collapses the six identical
    crate::time! { ctx.runner.run(...) } wrappers across cmake/meson/npm builds.
  • config::persist_or_dry_run pins the no mutate/save on dry-run block
    in one place for add_config, remove_config, add_profile, remove_profile.

Fixes

  • Watch scripts generate_watch_scripts resolved each lib's watch command twice, reading/parsing every package.json twice and printing every verbose warning twice. Commands are now resolved once.
  • Output visibility: per-repo "Cloning {name}" progress now always prints; per-wrap "Generated wrap" messages are now verbose-only in both real and dry-run modes Update failures remain always visible. Updated test_clone_repos_per_repo_lines_always_shown accordingly.

Tests

  • Direct unit tests for two new public helpers whose paths existing tests didn't exercise: report_summary (full dry-run + verbose) and read_package_json (missing-file and malformed-JSON branches + verbose).

@masonlet
masonlet merged commit 1f6a231 into main Jul 4, 2026
10 checks passed
@masonlet
masonlet deleted the refactor/helpers branch July 4, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant