Skip to main content

Crate changepacks_utils

Crate changepacks_utils 

Source
Expand description

§changepacks-utils

Shared utilities for the changepacks system.

Provides git repository operations via gix, version calculation, dependency sorting with Kahn’s algorithm, config management, and format detection for JSON indentation. These utilities are used across all language-specific crates and CLI commands.

Functions§

apply_reverse_dependencies
Apply reverse dependency updates: if package A depends on package B (via workspace:*), and B is being updated, then A should also be updated as PATCH.
clear_update_logs
Remove all update logs without confirmation
detect_indent
Detects JSON indentation (2-space, 4-space, or tab) from file content.
display_update
Display the version update as a formatted string
find_current_git_repo
Find git repository from current directory using gix
find_project_dirs
Find project directories containing specific files from git tracked files
gen_changepack_result_map
Generate a changepack result map from projects and update results
gen_update_map
Generate update map from changepack logs
get_changepacks_config
Get the changepacks configuration from .changepacks/config.json Returns default config if the file doesn’t exist or is empty
get_changepacks_dir
Get the .changepacks directory path from the git repository root
get_relative_path
Get the relative path from a git root to an absolute path
next_version
Calculate the next version based on semver and update type
sort_by_dependencies
Sort projects by their dependencies using topological sort. Projects with no dependencies or whose dependencies are already published will come first. Returns a sorted vector of project references (no cloning, just reordering).
split_version
Split a version string into prefix and version parts