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

Wrong npm tag on pre-release #586

Closed
MoonLiightz opened this issue Jan 10, 2020 · 3 comments
Closed

Wrong npm tag on pre-release #586

MoonLiightz opened this issue Jan 10, 2020 · 3 comments
Labels

Comments

@MoonLiightz
Copy link

Hi guys, I'm not sure if this is a "bug" or if I have misunderstood something. See the following scenario:

The version in my package.json: "version": "0.2.1-rc.0".
Now I want to release a new rc-version (0.2.1-rc.1) and execute release-it --preRelease=rc --npm.tag=next, but I get this warning WARNING No version found in npm registry. Assuming new package.. Just for your information, the version detection (0.2.1-rc.1) works anyway and the package is in the registry, it's just the warning. I did a little debugging (with --dry-run) and found out, that release-it looks for the wrong npm tag: $ npm show <hidden-name>@rc version (rc instead of next).
After some more debugging, I found that when I changed the following function

async resolveTag(version) {
const { isPreRelease, preReleaseId } = parseVersion(version);
return !isPreRelease ? DEFAULT_TAG : preReleaseId || (await this.guessPreReleaseTag());
}

into

  async resolveTag(version) {
    const { isPreRelease, preReleaseId } = parseVersion(version);
    return !isPreRelease ? DEFAULT_TAG : (await this.guessPreReleaseTag());
  }

it works as expected and the warning is no longer shown.
A --dry-run shows now $ npm show <hidden-name>@next version

I didn't go deeper into the code, so I can't judge if it's a good idea to adopt this change or what it might do. Maybe I just misunderstood something and that's why I get the warning. But if not, I can create a PR if you wish.

@webpro
Copy link
Collaborator

webpro commented Jan 11, 2020

Looks like you understand everything perfectly. Definitely sounds like a bug and I'll investigate/fix shortly. Thanks!

@webpro
Copy link
Collaborator

webpro commented Feb 18, 2020

Should be fixed in v12.5.0

@MoonLiightz
Copy link
Author

Can I confirm, thanks for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants