-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npx taze major
and npx taze minor
generate different minor outputs when major version is 0
#54
Comments
Major version equal to zero is an exception |
@ntnyq yep so perhaps the behavior is expected, but I would expect this:
or this:
But instead there's nothing in |
The behavior is expected. Only the output for counters needs some improvements. PR welcome |
@antfu which outputs need improvement? I might be able to work on that :) could you help me understand why the behavior is expected? it seems counterintuitive that a |
❯ npx taze major
- node-starter - 1 minor
+ node-starter - 1 major
vitest dev ~2mo ^0.23.4 → ^0.25.3 ~6d The counter is wrong. But it only shows up with |
So seems like I'm entering a rabbit hole 😅 A minimal reproduction classifies const semver = require('semver'); // "semver": "^7.3.8" in package.json
console.log(`${semver.diff('0.23.4', '0.25.3')}`); // outputs "minor" What do you think about a minimal change like this? // src/utils/versions.ts
export function changeVersionRange(version: string, mode: Exclude<RangeMode, 'latest' | 'newest'>) {
if (!semver.validRange(version))
return null
if (mode === 'default')
return version
const min = semver.minVersion(version)
if (!min)
return null
+ if (semver.major(min) === 0 && mode === 'minor')
+ return `>=${min} <1.x`
return {
major: '>=',
minor: '^',
patch: '~',
}[mode] + min
} |
Isn't your change making it the opposite? |
Describe the bug
It looks like
taze minor
andtaze major
interpret minor changes differently when the major version is0
; I think this is unexpected behavior, but let me know if it is meant to be this way!In the repro:
Reproduction
https://stackblitz.com/edit/node-ugjrw2?file=package.json&view=editor
System Info
❯ npx envinfo --system --binaries --browsers success Install finished in 6.376s System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 7.17.0 - /usr/local/bin/npm
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: