diff --git a/.config/supervisord/supervisord.conf b/.config/supervisord/supervisord.conf index cf0229c..6c7b69d 100644 --- a/.config/supervisord/supervisord.conf +++ b/.config/supervisord/supervisord.conf @@ -26,7 +26,7 @@ autostart=true [program:delve] user=root -command=/bin/bash -c 'pid=""; while [ -z "$pid" ]; do pid=$(pgrep gpx_factry); done; /root/go/bin/dlv attach --api-version=2 --headless --continue --accept-multiclient --listen=:2345 $pid' +command=/bin/bash -c 'pid=""; while [ -z "$pid" ]; do pid=$(pgrep gpx_factry); done; /root/go/bin/dlv attach --api-version=2 --headless --accept-multiclient --listen=:2345 $pid' stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 redirect_stderr=true diff --git a/src/QueryEditor/util.ts b/src/QueryEditor/util.ts index f3668e4..026ed35 100644 --- a/src/QueryEditor/util.ts +++ b/src/QueryEditor/util.ts @@ -351,16 +351,12 @@ export function semverCompare(a: string, b: string): number { if (b.startsWith('v')) { b = b.substring(1) } - const aParts = a.split('.') - const bParts = b.split('.') + const aParts = a.split(/[-.]/) + const bParts = b.split(/[-.]/) - for (let i = 0; i < aParts.length; i++) { - if (i >= bParts.length) { - return 1 - } - - const aPart = parseInt(aParts[i], 10) - const bPart = parseInt(bParts[i], 10) + for (let i = 0; i < Math.min(aParts.length, bParts.length); i++) { + const aPart = parseInt(aParts[i] || '0', 10) + const bPart = parseInt(bParts[i] || '0', 10) if (aPart < bPart) { return -1 @@ -369,11 +365,13 @@ export function semverCompare(a: string, b: string): number { if (aPart > bPart) { return 1 } + + if (aParts[i] !== bParts[i]) { + return aParts[i] > bParts[i] ? 1 : -1 + } } - if (aParts.length < bParts.length) { - return -1 - } else if (aParts.length > bParts.length) { + if (aParts.length > bParts.length) { return 1 }