Skip to content

1.8.0 - Optionally sync package.json version during release creation

Choose a tag to compare

@allanmcarvalho allanmcarvalho released this 04 Nov 13:30
· 20 commits to 1.x since this release

Added

  • Added an interactive option to update the root package.json version to match the selected release version during frontend release creation.
    • The user is prompted: “Update package.json to {$selectedVersion}?”
    • The prompt defaults to false and the update only proceeds when the updater determines it is safe (canUpdate($projectRoot)).
  • Introduced App\Support\Release\PackageJsonVersionWriter to safely write package.json updates.
  • Added GitWorkingTree::isTracked() to verify package.json is tracked by git before attempting an update.

Changed

  • Updated app/Commands/Versioning/CreateReleaseCommand.php to include the new confirmation prompt and guard the update behind safety checks.
  • Improved release-side README version badge handling:
    • Better support for repositories that contain multiple existing managed version badges.
    • When multiple matching managed badges exist, the last match is replaced and duplicates are removed.

Testing

  • Extended feature tests to cover:
    • The new confirmation prompt behavior.
    • Updating package.json and src/ProjectVersion.php only when the user confirms.
    • Improved failure messaging/rollback behavior, including ensuring the repository remains clean and package.json is unchanged when preparation fails.

User impact / Compatibility

  • Behavior change: release:create may modify the root package.json version only if the user confirms the prompt and the update writer determines the update is safe.
  • If the repository layout is unsuitable (e.g., package.json is missing, symlinked, or not tracked by git), the update will not be performed.
  • README updates: if multiple managed version badges were present, only the last matching one is updated and earlier duplicates are removed—no additional user action is required beyond reviewing the README changes.