-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
🚧 enhance get current version #117
Conversation
Codecov Report
@@ Coverage Diff @@
## main #117 +/- ##
==========================================
- Coverage 96.15% 95.96% -0.20%
==========================================
Files 16 16
Lines 312 322 +10
Branches 35 32 -3
==========================================
+ Hits 300 309 +9
- Misses 7 8 +1
Partials 5 5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned below, it's probably better to avoid the last tag detection fallback.
We should warn the user that we'll be using the initial commit as a base.
What do you think @edbzn?
getLastTag().pipe( | ||
tap((tag) => { | ||
logger.warn(`🟠 No previous semver tag found, fallback from: ${tag}`); | ||
}) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edbzn I think that getLastTag
is a dangerous fallback heuristic. In most cases, this will produce a surprising behavior.
I am thinking about a monorepo with lots of already versioned packages (a=3.0.0, b=4.0.0)then we add a new package. This package will then use the version of the last tagged package (a or b) which is wrong.
we can just skip this step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other thing here is that getLastTag()
returns a tag and not a version.
switchMap((since) => | ||
iif(() => since === `0.0.0`, getFirstCommitRef(), of(since)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the current version is not found, maybe since
's value should be null
. This way we can make the difference between detecting a 0.0.0
version and not detecting any version.
If since
is null
(or currently 0.0.0
), then before bumping, we can log something like: Couldn't find a previous version tag for this project. New version will be calculated based on all changes since first commit. If your project is already versioned, please tag the last release commit with my-prefix-x-y-z
and run this command again.
Agree! Let's improve this. |
Co-authored-by: Younes Jaaidi <yjaaidi@gmail.com>
Following this discussion #102, handle the current version differently, @yjaaidi what do you think?