create-typeser 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,7 +69,18 @@ export function validateArtifact(tool, artifact, os, arch) {
69
69
  return artifact;
70
70
  }
71
71
 
72
- const compare = (a, b) => a.localeCompare(b, 'en', {numeric: true});
72
+ export function compare(a, b) {
73
+ const parse = value => value.split(/[+-]/).map(part => part.split('.').map(Number));
74
+ const [aMain, aExtra = []] = parse(a);
75
+ const [bMain, bExtra = []] = parse(b);
76
+ for (const [left, right] of [[aMain, bMain], [aExtra, bExtra]]) {
77
+ for (let i = 0; i < Math.max(left.length, right.length); i++) {
78
+ const diff = (left[i] ?? 0) - (right[i] ?? 0);
79
+ if (diff) return diff;
80
+ }
81
+ }
82
+ return 0;
83
+ }
73
84
 
74
85
  async function latestArtifact(tool, os, arch, request) {
75
86
  const signal = AbortSignal.timeout(6500);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typeser",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Create a local TypeSer application with Java and PostgreSQL",
5
5
  "keywords": [
6
6
  "create",