ajoberstar / reckon

Infer a project's version from your Git repository.
Apache License 2.0
185 stars 28 forks source link

[Question] Why force an alphabetical order of stages? #148

Closed YarnSphere closed 3 years ago

YarnSphere commented 3 years ago

I'm considering using this plugin.

However, one design decision I don't understand is the alphabetical order of stages. Why is this necessary?

Why isn't it possible to specify, in order: dev, alpha, beta, rc, final and have dev be the first stage? Why can't the plugin sort by index in the provided order of stages instead of sorting them alphabetically?

Even in the provided example (stageFromProp('milestone', 'rc', 'final')), final sorts (alphabetically) before rc, yet it is somehow the last stage. Is final a "hardcoded" stage? Why not use the last provided stage as the "final" stage?

Thank you.

ajoberstar commented 3 years ago

This is to comply with the SemVer spec (see 11.4).

Final is a "logical" stage to just indicate you're releasing a normal version (i.e. one without any pre-release information). The word final doesn't appear in the version string, so it does sort last according to SemVer.

YarnSphere commented 3 years ago

Got it! Makes sense, thank you.