also looking at this
fix: synchronize drifted native versions in recursive releases
#2015
2 files
+26
-2
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -413,8 +413,11 @@ export function updateVersionInFile(filePath: string, oldVersion: string, newVer | ||
| 413 | 413 | if (isZigZon) { |
| 414 | 414 | // Handle Zig build.zig.zon files |
| 415 | 415 | // Format: .version = "0.0.0", |
| 416 | const declaredVersion = forceUpdate | |
| 417 | ? content.match(/\.version\s*=\s*"([^"]+)"/)?.[1] ?? oldVersion | |
| 418 | : oldVersion | |
| 416 | 419 | const versionRegex = new RegExp( |
| 417 | `(\\.version\\s*=\\s*")${oldVersion.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}("\\s*,)`, | |
| 420 | `(\\.version\\s*=\\s*")${declaredVersion.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}("\\s*,)`, | |
| 418 | 421 | 'g', |
| 419 | 422 | ) |
| 420 | 423 | if (content.match(versionRegex) || forceUpdate) { |
| @@ -439,8 +442,9 @@ export function updateVersionInFile(filePath: string, oldVersion: string, newVer | ||
| 439 | 442 | // For JSONC files, preserve the original formatting with comments |
| 440 | 443 | if (isJsonc) { |
| 441 | 444 | // Replace the version value while preserving comments and formatting |
| 445 | const declaredVersion = forceUpdate ? String(packageJson.version) : oldVersion | |
| 442 | 446 | const versionRegex = new RegExp( |
| 443 | `(["']version["']\\s*:\\s*)["']${oldVersion.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}["']`, | |
| 447 | `(["']version["']\\s*:\\s*)["']${declaredVersion.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}["']`, | |
| 444 | 448 | 'g', |
| 445 | 449 | ) |
| 446 | 450 | newContent = content.replace(versionRegex, `$1"${newVersion}"`) |