fix: sync configuration version from assembly
This commit is contained in:
@@ -62,6 +62,25 @@ $packageJson = [regex]::Replace($packageJson, '"Version"\s*:\s*"[^"]+"', "`"Vers
|
||||
$packageJson = [regex]::Replace($packageJson, '"LastUpdatedDate"\s*:\s*"[^"]+"', "`"LastUpdatedDate`": `"$(Get-Date -Format 'yyyy-MM-ddTHH:mm:ss')`"")
|
||||
[System.IO.File]::WriteAllText($packageJsonPath, $packageJson, [System.Text.UTF8Encoding]::new($true))
|
||||
|
||||
$configDataPath = Join-Path $packageDir 'install\1010_Config_Data\02-01-0080 C4IT_F4SDConfigurationType.dat'
|
||||
if (-not (Test-Path -LiteralPath $configDataPath)) {
|
||||
throw "Configuration data file not found: $configDataPath"
|
||||
}
|
||||
|
||||
$configData = [System.IO.File]::ReadAllText($configDataPath)
|
||||
$configData = [regex]::Replace(
|
||||
$configData,
|
||||
'(<C4IT_AddonConfigClassBase>[\s\S]*?<Version>)[^<]*(</Version>)',
|
||||
"`${1}$PackageVersion`${2}",
|
||||
[System.Text.RegularExpressions.RegexOptions]::Singleline
|
||||
)
|
||||
|
||||
if ($configData -notmatch "<Version>$([regex]::Escape($PackageVersion))</Version>") {
|
||||
throw "Could not update C4IT_F4SDConfigurationType Version to $PackageVersion in $configDataPath"
|
||||
}
|
||||
|
||||
[System.IO.File]::WriteAllText($configDataPath, $configData, [System.Text.UTF8Encoding]::new($true))
|
||||
|
||||
$textFileExtensions = @('.json', '.xml', '.dat', '.type', '.class', '.config', '.host')
|
||||
Get-ChildItem -LiteralPath $packageDir -Recurse -File |
|
||||
Where-Object { $textFileExtensions -contains $_.Extension.ToLowerInvariant() } |
|
||||
|
||||
Reference in New Issue
Block a user