fix: Warn when defaulting to --inc=patch in CLI#859
Merged
owlstronaut merged 1 commit intonpm:mainfrom May 7, 2026
Merged
Conversation
pjohnmeyer
commented
May 7, 2026
owlstronaut
approved these changes
May 7, 2026
Merged
owlstronaut
pushed a commit
that referenced
this pull request
May 8, 2026
🤖 I have created a release *beep* *boop* --- ## [7.8.0](v7.7.4...v7.8.0) (2026-05-08) ### Features * [`0d0a0a2`](0d0a0a2) [#855](#855) Add `truncate` function (#855) (@pjohnmeyer, @owlstronaut) ### Bug Fixes * [`3905343`](3905343) [#859](#859) Warn when defaulting to --inc=patch in CLI (@pjohnmeyer) ### Documentation * [`c368af6`](c368af6) [#853](#853) fix typos in documentation (#853) (@ankitkumar572005) * [`37776c3`](37776c3) [#846](#846) fix BNF grammar to distinguish prerelease from build identifiers (#846) (@abhu85, @claude) ### Chores * [`9542e09`](9542e09) [#860](#860) template-oss-apply (@owlstronaut) * [`937bc2c`](937bc2c) [#860](#860) `template-oss-apply@5.0.0` (@owlstronaut) * [`6946fef`](6946fef) [#852](#852) bump @npmcli/template-oss from 4.29.0 to 4.30.0 (#852) (@dependabot[bot], @npm-cli-bot) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a warning log message to the CLI when the
--incrementoption is provided with an invalid increment type. This provides adequate feedback to the user about what is happening, and prepares them for a future where this may no longer be allowed.In #108 (comment), @mklement0 points out (correctly, IMO):
As @lukekarrys points out in his reply, however, he considers erroring here to be a breaking change. I would tend to agree as this behavior has become part of the contract between the CLI user and the CLI.
The issue is being tracked for the next major version of the CLI, so I offer up that we can safely add the warning indicating that a bad value has been provided, simultaneously preserving the contract, and preparing users for the possibility of a future change. As
console.warndoes not output tostdout, existing redirection and/or piping of output should survive this change, thus it will not be breaking. Examples:The only breakage, then, would occur if we consider
stderr(or in this case lack thereof) output to also be part of the CLI contract. Example:In this case the warning and the new version are both output to
./new-version.err, and any processing of that output expecting only3.2.2might fail.Alternative
We could, instead, add a flag to the CLI to opt-in to new behavior re: the
--incflag. This could be done in three different ways I can immediately think of:--increment-strict: an alternate flag used instead of--incrementthat enforces the validity of the argument; downside is that we would then want to remove this in the next release, creating another breaking change--future: a generic flag that hides all breaking "next version" (currently 8) functionality behind a feature flag, used in combination with--incrementto enforce the validity of the argument--verbose: adds the additional "warning" logging added in this PR, with the opportunity for more usage elsewhereI think the approach in this PR is the simplest and requires the least change in the future, but
--futureand--verboseopen up other options going forward.References
Relates to #108