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

FYI: Alpha version numbers #1124

Closed
rstacruz opened this issue Jun 8, 2017 · 10 comments
Closed

FYI: Alpha version numbers #1124

rstacruz opened this issue Jun 8, 2017 · 10 comments

Comments

@rstacruz
Copy link
Contributor

rstacruz commented Jun 8, 2017

Hey, this isn't a bug, more of a "just thought I'd let you know", but the alpha version scheme (1.0.0-alpha9) is not lexically sortable. You can test this by doing npm show gatsby versions --json:

npm show gatsby versions --json

  "1.0.0-alpha2",
  "1.0.0-alpha20",
  "1.0.0-alpha21",
  "1.0.0-alpha3",
  "1.0.0-alpha4",
  "1.0.0-alpha5",
  "1.0.0-alpha6",
  "1.0.0-alpha7",
  "1.0.0-alpha8",
  "1.0.0-alpha8-test1",
  "1.0.0-alpha9",
  "1.0.0-alpha9-test1",
  ...
]

The latest alpha (1.0.0-alpha21) doesn't show up at the end of the list. This can be remedied by naming it as 1.0.0-alpha.21.

From semver.org:

http://semver.org/#spec-item-9
A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version.
Examples: 1.0.0-alpha, 1.0.0-alpha.1, (...snip)

Great work on Gatsby by the way!

@KyleAMathews
Copy link
Contributor

Oh thank you so much! People have kept complaining about this and I never quite knew what was going wrong. 😅

Oh well, this is how you learn how to open source I guess... I'll make the next alpha using this pattern. Sheesh. (eh, tried that and the . sorts behind 1 so that doesn't work. So either I make up some sort of weird naming scheme (balpha) or I can just wait I guess until I finish my current PR and release a beta).

@rstacruz
Copy link
Contributor Author

rstacruz commented Jun 8, 2017

Awesome! Also TIL there's also + for build ID's, like 1.0.0-alpha+20170708, something I'll probably try using when releasing forks of other libs :)

@casprwang
Copy link
Contributor

casprwang commented Jun 14, 2017

Now it make sense why gatsby@next kept giving me gatsby@1.0.0-alpha9-test1 from npm 😅. Thanks for sharing.

@casprwang
Copy link
Contributor

btw the current work-around for me is setting

...
    "gatsby": "1.0.0-alpha21",
    "other-gatsby-plugins": "next",
...

in package.json

@rstacruz
Copy link
Contributor Author

rstacruz commented Jun 17, 2017

hey just so you know, the 22-alpha is also breaking this scheme. Notice how it's listed after .23:

  "1.0.0-alpha.23",
  "1.0.0-alpha.22-alpha.0be09b66",
  "1.0.0-alpha.22-alpha.18f02e94",
  "1.0.0-alpha.22-alpha.19f7c727",
  "1.0.0-alpha.22-alpha.2d2aa0ef",
  "1.0.0-alpha.22-alpha.96b0b727",
  "1.0.0-alpha.22-alpha.acbc22e8",
  "1.0.0-alpha.test",

May i suggest -alpha.22.1+acbc22e8?

@KyleAMathews
Copy link
Contributor

@rstacruz hrmmm I'm just using lerna publish --canary for this... do you know if there's a way to make this change to how it does releases?

@rstacruz
Copy link
Contributor Author

rstacruz commented Jun 17, 2017

oh, i see! lerna seems to prepend -alpha by default. This is still causing weirdness even in the beta versions:

  "1.0.0-beta.1",
  "1.0.0-beta.2",
  "1.0.0-beta.1-alpha.82c23a65"

I'm guessing giving it a version 1.0.0-beta.1.pre before doing a canary release would be a decent workaround (giving a final output of 1.0.0-beta.1.pre-alpha.82c23a65)

@KyleAMathews
Copy link
Contributor

yeah that makes sense. Though... the sorting is still correct by tag — if you install gatsby@next you'll get 1.0.0-beta.2 not the canary. Right?

@rstacruz
Copy link
Contributor Author

let me try that now.

@rstacruz
Copy link
Contributor Author

yep, it seems so. as long as the next dist-tag is set correctly it should be good.

→  npm dist-tag ls gatsby
canary: 1.0.0-beta.1-alpha.82c23a65
latest: 0.12.48
next: 1.0.0-beta.2
test: 1.0.0-alpha9-test1
testing: 1.0.0-alpha-testing-7

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

No branches or pull requests

3 participants