NOTE!
- This method does not use a parser nor a widget, it uses
semver.js
to allow the sorting of semantic version numbers. - But this method requires a slightly modified version of semver.js for node. All modifications are signified within the file to ease updating.
- The modified semver.js (semver-mod.js) is contained in the new "extras" subfolder. Please include it if you need this specific type of sort.
- Invalid version numbers be sorted using a basic text sort, so they will be grouped with their similar version numbers, but not sorted properly; this demo has some extra code to highlight invalid version numbers.
- In this demo, when the semver 2.0.0 compliant version column is sorted, the order column will be in sequential order.
- Semver example order, from semver.org:
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0
Demo
Order | SemVer 2.0.0 compliant versioning |
---|---|
6 | 1.0.0-beta.2 |
8 | 1.0.0-rc.1 |
2 | 1.0.0-alpha.1 |
1 | 1.0.0-alpha |
10 | 1.0.0 |
4 | 1.0.0-alpha.beta |
3 | 1.0.0-alpha.2 |
7 | 1.0.0-beta.11 |
9 | 1.0.0-rc.2 |
5 | 1.0.0-beta |
11 | 1.0.0beta |