deno icon indicating copy to clipboard operation
deno copied to clipboard

feat(cli): add `deno bump-version` subcommand

Open JLCarveth opened this issue 3 months ago • 9 comments

Adds a deno bump-version subcommand similar to npm version

  • Ideally, deno init should be updated to include a default value for the version field in deno.json.
  • Right now the implementation uses the first version field it finds in either deno.json(c) or package.json, but perhaps we would instead prefer to check both files explicitly in case there are discrepancies.
  • TODO: Implement tests

Closes #30358

JLCarveth avatar Aug 29 '25 14:08 JLCarveth

Hey @JLCarveth we'll try to give you initial review this week. Is there anything that is blocking you at the moment?

bartlomieju avatar Sep 23 '25 17:09 bartlomieju

Hey @JLCarveth we'll try to give you initial review this week. Is there anything that is blocking you at the moment?

Should I look into setting a default value for the version field in deno init?

JLCarveth avatar Sep 23 '25 18:09 JLCarveth

@JLCarveth I'm not sure - deno init --lib already creates a structure with deno.json that has a version set - I think we're covered here.

bartlomieju avatar Sep 23 '25 18:09 bartlomieju

@JLCarveth we just discussed this during the CLI meeting - overall this looks good, but we have a couple comments:

  • we're not sure about the name of the subcommand - we might want to use a verb here, like deno increase-version or deno bump-version
  • the Git integration seems extracurricular and maybe could be skipped (unless there's a strong prior art that it should be there?)

bartlomieju avatar Sep 24 '25 16:09 bartlomieju

The Git integration was based on the npm behaviour: https://docs.npmjs.com/cli/v8/commands/npm-version#git-tag-version

If the team would prefer a simpler integration it could be removed

JLCarveth avatar Sep 24 '25 16:09 JLCarveth

After thinking on it further, I agree that the git integration is not necessary. Adds more maintenance burden when a simple bash function can handle the git stuff. I'll remove that tomorrow

JLCarveth avatar Sep 25 '25 18:09 JLCarveth

@JLCarveth sounds good, can you also rename the subcommand to bump-version please?

bartlomieju avatar Sep 26 '25 11:09 bartlomieju

@JLCarveth I think we're ready to land this one - I'm thinking we could do it this week, without waiting for another minor release - how about we land this one as "unstable"? If so, let's add a small banner anytime this command is run that says: Warning deno bump-version is experimental as subject to change.

bartlomieju avatar Oct 13 '25 10:10 bartlomieju

Walkthrough

Adds a new bump-version CLI subcommand and related types (VersionFlags, VersionIncrement) and a DenoSubcommand::BumpVersion variant. Implements tools::bump_version::bump_version_command to locate deno.json or package.json, read and parse the current version, compute increments (major, minor, patch, pre* variants), update the config in place, and log results. Exposes cli/tools::bump_version module. Adds integration tests covering increments, file selection, no-config failure, and no-increment behavior.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.04% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main feature: adding a deno bump-version subcommand, which aligns perfectly with the changeset's core objective.
Description check ✅ Passed The description explains the feature, mentions the related issue #30358, and notes implementation considerations about version field location and the TODO for tests.
Linked Issues check ✅ Passed The PR fully addresses issue #30358 by implementing a deno bump-version subcommand supporting semantic version bumping with Major/Minor/Patch/Prerelease strategies, file I/O, and error handling.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the bump-version feature: CLI args, subcommand dispatch, the command implementation, module exports, and integration tests.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 02 '25 18:12 coderabbitai[bot]