Skip to content
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

Bug: Fails when inital version is 0.0.1 #102

Closed
ntziolis opened this issue Feb 28, 2021 · 2 comments
Closed

Bug: Fails when inital version is 0.0.1 #102

ntziolis opened this issue Feb 28, 2021 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ntziolis
Copy link

When creating a new angular lib via nx the default initial version number of the package is 0.0.1 instead of 0.0.0. This causes the plugin to fail when executing nx run mylib:version.

When manually setting the version of to 0.0.0 the command starts working as expected.

Root cause is the following line:

since: version !== '0.0.0' ? `${tagPrefix}${version}` : null,

Suggestion:

  • either add an inital flag in the executer that does something like this:
    since: initial || version !== '0.0.0' ? `${tagPrefix}${version}` : null,
  • or at least fail with a more descriptive error telling the users to either:
    • update the version number of the respective package to 0.0.0
    • or create a tag for the current version number manually
@edbzn edbzn added the bug Something isn't working label Mar 1, 2021
@edbzn
Copy link
Member

edbzn commented Mar 1, 2021

Hi @ntziolis, thank you for spotting this!

Initially we had an --initial-release flag but we removed it as we wanted to make it transparent for the user. It seems to be weak to base our assumption on what's Nx generate (0.0.1), so I would suggest to update the getCurrentVersion function with the following logic :

  • get the last semver tag
  • (first fallback) get the last tag git describe --tags --abbrev=0
  • (second fallback) get the first commit git rev-list --max-parents=0 HEAD

This would also fix users that started to release using another tool with different tag format (without tag prefix for example).

@ntziolis
Copy link
Author

ntziolis commented Mar 1, 2021

I would suggest to update the getCurrentVersion function with the following logic :

  • get the last semver tag
  • (first fallback) get the last tag git describe --tags --abbrev=0
  • (second fallback) get the first commit git rev-list --max-parents=0 HEAD

That would be perfect as this doesn't require the user to intervene manually in majority of cases.

@edbzn edbzn added the help wanted Extra attention is needed label Mar 9, 2021
edbzn added a commit that referenced this issue Mar 23, 2021
Co-authored-by: Younes Jaaidi <yjaaidi@gmail.com>
edbzn added a commit that referenced this issue Mar 23, 2021
Co-authored-by: Younes Jaaidi <yjaaidi@gmail.com>
@edbzn edbzn closed this as completed in f882009 Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants