From aefa29e5ffc9dba36fb66ba4727c0c7952d75261 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:14:55 +0000 Subject: [PATCH 1/2] Bump @butr/vortexextensionnative from 1.0.128 to 1.0.129 Bumps [@butr/vortexextensionnative](https://github.com/BUTR/Bannerlord.LauncherManager) from 1.0.128 to 1.0.129. - [Commits](https://github.com/BUTR/Bannerlord.LauncherManager/commits) --- updated-dependencies: - dependency-name: "@butr/vortexextensionnative" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 05c180b..5b3008f 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "webpack-node-externals": "^3.0.0" }, "dependencies": { - "@butr/vortexextensionnative": "1.0.128", + "@butr/vortexextensionnative": "1.0.129", "ticks-to-date": "^1.0.6" }, "resolutions": { diff --git a/yarn.lock b/yarn.lock index a57168b..bd9f1da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22,10 +22,10 @@ dependencies: regenerator-runtime "^0.14.0" -"@butr/vortexextensionnative@1.0.128": - version "1.0.128" - resolved "https://registry.yarnpkg.com/@butr/vortexextensionnative/-/vortexextensionnative-1.0.128.tgz#35f9c556069a83f612af229c112ca8a5e923fd42" - integrity sha512-uzXRpGtlhHAwj4jDJWFuQXZfwOb6qa5sG6rUSdLWfbDTo4DKU2SotAEnkvEA7JAJRaY9CUb5PDFVc9+TUaHC0A== +"@butr/vortexextensionnative@1.0.129": + version "1.0.129" + resolved "https://registry.yarnpkg.com/@butr/vortexextensionnative/-/vortexextensionnative-1.0.129.tgz#ca450f98e3f2ec1c4282e1342775471595d71860" + integrity sha512-5dYN/59/DXYDcY2Hrl1h2j2Lz4MMLQ0c8LY3iFzK/vKj0O8i6t5VK8jZNL9JIu3xHzS/8h3A0ekHKclSWeYfkg== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" From 5aaaec32f434e945f0c374b83dc79a0936a5af06 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Tue, 3 Sep 2024 14:22:12 +0300 Subject: [PATCH 2/2] Using Bannerlord version comparison instead of semver on installation --- changelog.txt | 3 +++ package.json | 2 +- src/blse/utils.ts | 15 +++++++++++++-- src/vortex/modFinder.ts | 17 ++++++++++++++--- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9b928ef..6ef67de 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,7 @@ --------------------------------------------------------------------------------------------------- +Version: 1.1.4 +* Using Bannerlord version comparison instead of semver on installation +--------------------------------------------------------------------------------------------------- Version: 1.1.3 * Added reload button for Mod Options Tab * Install Harmony when installing BLSE diff --git a/package.json b/package.json index 05c180b..ca62d0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "game-mount-and-blade-ii-bannerlord-butr", - "version": "1.1.3", + "version": "1.1.4", "description": "A Vortex extension for Mount and Blade II: Bannerlord mod management.", "author": "BUTR Team & Nexus Mods", "license": "GPL-3.0+", diff --git a/src/blse/utils.ts b/src/blse/utils.ts index 9311e89..080db3a 100644 --- a/src/blse/utils.ts +++ b/src/blse/utils.ts @@ -1,5 +1,5 @@ -import { gte } from 'semver'; import { actions, selectors, types, util } from 'vortex-api'; +import { BannerlordModuleManager } from '@butr/vortexextensionnative'; import { BLSE_MOD_ID, BLSE_URL, GAME_ID, HARMONY_MOD_ID } from '../common'; import { downloadAndEnableLatestModVersion, hasPersistentBannerlordMods } from '../vortex'; import { LocalizationManager } from '../localization'; @@ -23,7 +23,18 @@ export const findBLSEMod = (mods: IBannerlordModStorage): IBannerlordMod | undef if (!prev) { return iter; } - return gte(iter.attributes?.version ?? '0.0.0', prev.attributes?.version ?? '0.0.0') ? iter : prev; + const compareResult = BannerlordModuleManager.compareVersions( + BannerlordModuleManager.parseApplicationVersion(iter.attributes?.version ?? ''), + BannerlordModuleManager.parseApplicationVersion(prev.attributes?.version ?? '') + ); + switch (compareResult) { + case 1: + return iter; + case -1: + return prev; + default: + return iter; + } }, undefined); }; diff --git a/src/vortex/modFinder.ts b/src/vortex/modFinder.ts index 104a6de..63c1151 100644 --- a/src/vortex/modFinder.ts +++ b/src/vortex/modFinder.ts @@ -1,5 +1,5 @@ -import { gte } from 'semver'; -import { selectors, types, util } from 'vortex-api'; +import { selectors, types } from 'vortex-api'; +import { BannerlordModuleManager } from '@butr/vortexextensionnative'; import { GAME_ID } from '../common'; import { hasPersistentBannerlordMods } from '../vortex'; import { IBannerlordMod, IBannerlordModStorage } from '../types'; @@ -22,7 +22,18 @@ export const findMod = (mods: IBannerlordModStorage, moduleId: string): IBannerl if (!prev) { return iter; } - return gte(iter.attributes?.version ?? '0.0.0', prev.attributes?.version ?? '0.0.0') ? iter : prev; + const compareResult = BannerlordModuleManager.compareVersions( + BannerlordModuleManager.parseApplicationVersion(iter.attributes?.version ?? ''), + BannerlordModuleManager.parseApplicationVersion(prev.attributes?.version ?? '') + ); + switch (compareResult) { + case 1: + return iter; + case -1: + return prev; + default: + return iter; + } }, undefined); };