Skip to content

fix(prepare): Make NEW-VERSION optional and auto-create changelog#715

Merged
BYK merged 1 commit intomasterfrom
fix/prepare-optional-version-and-auto-changelog
Jan 13, 2026
Merged

fix(prepare): Make NEW-VERSION optional and auto-create changelog#715
BYK merged 1 commit intomasterfrom
fix/prepare-optional-version-and-auto-changelog

Conversation

@BYK
Copy link
Member

@BYK BYK commented Jan 13, 2026

Summary

Fixes two usability issues with craft prepare:

  1. Optional version argument: craft prepare now works without providing a NEW-VERSION argument, defaulting to the versioning.policy from .craft.yml. Previously it showed Not enough non-option arguments: got 0, need at least 1.

  2. Auto-create changelog: When changelog.policy is set to auto and CHANGELOG.md doesn't exist, it's now automatically created with # Changelog content instead of failing.

Changes

  • src/commands/prepare.ts: Change command syntax from prepare NEW-VERSION to prepare [NEW-VERSION] (yargs optional positional)
  • src/commands/prepare.ts: Add conditional changelog creation for Auto policy before the existence check
  • src/__tests__/prepare-dry-run.e2e.test.ts: Add e2e tests for both scenarios
  • src/__tests__/index.test.ts: Update help text expectation

- Make NEW-VERSION positional argument optional in yargs by using brackets
  syntax. When omitted, falls back to versioning.policy from .craft.yml.
- Auto-create CHANGELOG.md with minimal content when changelog policy is
  'auto' and the file doesn't exist. Simple policy still errors on missing
  file, None policy ignores the file entirely.
- Add e2e tests for both scenarios.
@github-actions
Copy link
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (action) Emit publish request issue URL as annotation by BYK in #708

Bug Fixes 🐛

Docker

  • Add image template var and strict template validation by BYK in #713
  • Add GITHUB_API_TOKEN and x-access-token fallbacks for ghcr.io by BYK in #710

Other

  • (prepare) Make NEW-VERSION optional and auto-create changelog by BYK in #715
  • Don't mention PRs to avoid linking in changelog previews by BYK in #712

🤖 This preview updates automatically when you update the PR.

@BYK BYK requested a review from billyvg January 13, 2026 19:56
@BYK BYK marked this pull request as ready for review January 13, 2026 19:57
@BYK BYK enabled auto-merge (squash) January 13, 2026 19:57
Copy link
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like mostly formatting changes

@BYK BYK merged commit 86aa29b into master Jan 13, 2026
16 checks passed
@BYK BYK deleted the fix/prepare-optional-version-and-auto-changelog branch January 13, 2026 20:13
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.

2 participants