From 4c3d970f5c1fc40568c637b05f5fe77df55098bb Mon Sep 17 00:00:00 2001
From: Josiah Dahl <105243742+pdm-jd@users.noreply.github.com>
Date: Tue, 11 Jun 2024 21:47:29 -0700
Subject: [PATCH] feat(hex): support update-lockfile strategy (#27915)

---
 lib/modules/versioning/hex/index.spec.ts | 38 +++++++++++++-----------
 lib/modules/versioning/hex/index.ts      |  1 +
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/lib/modules/versioning/hex/index.spec.ts b/lib/modules/versioning/hex/index.spec.ts
index 6ec94685bf..11a70b073c 100644
--- a/lib/modules/versioning/hex/index.spec.ts
+++ b/lib/modules/versioning/hex/index.spec.ts
@@ -63,24 +63,26 @@ describe('modules/versioning/hex/index', () => {
   );
 
   it.each`
-    currentValue               | rangeStrategy | currentVersion | newVersion | expected
-    ${'== 1.2.3'}              | ${'pin'}      | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
-    ${'== 3.6.1'}              | ${'bump'}     | ${'3.6.1'}     | ${'3.6.2'} | ${'== 3.6.2'}
-    ${'== 3.6.1'}              | ${'replace'}  | ${'3.6.1'}     | ${'3.6.2'} | ${'== 3.6.2'}
-    ${'~> 1.2'}                | ${'replace'}  | ${'1.2.3'}     | ${'2.0.7'} | ${'~> 2.0'}
-    ${'~> 1.2'}                | ${'pin'}      | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
-    ${'~> 1.2'}                | ${'bump'}     | ${'1.2.3'}     | ${'2.0.7'} | ${'~> 2.0'}
-    ${'~> 1.2'}                | ${'bump'}     | ${'1.2.3'}     | ${'1.3.1'} | ${'~> 1.3'}
-    ${'~> 1.2.0'}              | ${'replace'}  | ${'1.2.3'}     | ${'2.0.7'} | ${'~> 2.0.0'}
-    ${'~> 1.2.0'}              | ${'pin'}      | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
-    ${'~> 1.2.0'}              | ${'bump'}     | ${'1.2.3'}     | ${'2.0.7'} | ${'~> 2.0.7'}
-    ${'>= 1.0.0 and <= 2.0.0'} | ${'widen'}    | ${'1.2.3'}     | ${'2.0.7'} | ${'>= 1.0.0 and <= 2.0.7'}
-    ${'>= 1.0.0 and <= 2.0.0'} | ${'replace'}  | ${'1.2.3'}     | ${'2.0.7'} | ${'<= 2.0.7'}
-    ${'>= 1.0.0 and <= 2.0.0'} | ${'pin'}      | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
-    ${'>= 1.0.0 or <= 2.0.0'}  | ${'widen'}    | ${'1.2.3'}     | ${'2.0.7'} | ${'>= 1.0.0 or <= 2.0.0'}
-    ${'>= 1.0.0 or <= 2.0.0'}  | ${'replace'}  | ${'1.2.3'}     | ${'2.0.7'} | ${'<= 2.0.7'}
-    ${'>= 1.0.0 or <= 2.0.0'}  | ${'pin'}      | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
-    ${'~> 0.4'}                | ${'replace'}  | ${'0.4.2'}     | ${'0.6.0'} | ${'~> 0.6'}
+    currentValue               | rangeStrategy        | currentVersion | newVersion | expected
+    ${'== 1.2.3'}              | ${'pin'}             | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
+    ${'== 3.6.1'}              | ${'bump'}            | ${'3.6.1'}     | ${'3.6.2'} | ${'== 3.6.2'}
+    ${'== 3.6.1'}              | ${'replace'}         | ${'3.6.1'}     | ${'3.6.2'} | ${'== 3.6.2'}
+    ${'~> 1.2'}                | ${'replace'}         | ${'1.2.3'}     | ${'2.0.7'} | ${'~> 2.0'}
+    ${'~> 1.2'}                | ${'pin'}             | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
+    ${'~> 1.2'}                | ${'bump'}            | ${'1.2.3'}     | ${'2.0.7'} | ${'~> 2.0'}
+    ${'~> 1.2'}                | ${'bump'}            | ${'1.2.3'}     | ${'1.3.1'} | ${'~> 1.3'}
+    ${'~> 1.1'}                | ${'update-lockfile'} | ${'1.2.0'}     | ${'1.3.0'} | ${'~> 1.1'}
+    ${'~> 1.1'}                | ${'update-lockfile'} | ${'1.2.0'}     | ${'2.0.0'} | ${'~> 2.0'}
+    ${'~> 1.2.0'}              | ${'replace'}         | ${'1.2.3'}     | ${'2.0.7'} | ${'~> 2.0.0'}
+    ${'~> 1.2.0'}              | ${'pin'}             | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
+    ${'~> 1.2.0'}              | ${'bump'}            | ${'1.2.3'}     | ${'2.0.7'} | ${'~> 2.0.7'}
+    ${'>= 1.0.0 and <= 2.0.0'} | ${'widen'}           | ${'1.2.3'}     | ${'2.0.7'} | ${'>= 1.0.0 and <= 2.0.7'}
+    ${'>= 1.0.0 and <= 2.0.0'} | ${'replace'}         | ${'1.2.3'}     | ${'2.0.7'} | ${'<= 2.0.7'}
+    ${'>= 1.0.0 and <= 2.0.0'} | ${'pin'}             | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
+    ${'>= 1.0.0 or <= 2.0.0'}  | ${'widen'}           | ${'1.2.3'}     | ${'2.0.7'} | ${'>= 1.0.0 or <= 2.0.0'}
+    ${'>= 1.0.0 or <= 2.0.0'}  | ${'replace'}         | ${'1.2.3'}     | ${'2.0.7'} | ${'<= 2.0.7'}
+    ${'>= 1.0.0 or <= 2.0.0'}  | ${'pin'}             | ${'1.2.3'}     | ${'2.0.7'} | ${'== 2.0.7'}
+    ${'~> 0.4'}                | ${'replace'}         | ${'0.4.2'}     | ${'0.6.0'} | ${'~> 0.6'}
   `(
     'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"',
     ({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => {
diff --git a/lib/modules/versioning/hex/index.ts b/lib/modules/versioning/hex/index.ts
index b84ff6189f..f82d9f9b1b 100644
--- a/lib/modules/versioning/hex/index.ts
+++ b/lib/modules/versioning/hex/index.ts
@@ -12,6 +12,7 @@ export const supportedRangeStrategies: RangeStrategy[] = [
   'widen',
   'pin',
   'replace',
+  'update-lockfile',
 ];
 
 function hex2npm(input: string): string {
-- 
GitLab