feat: support parallel legacy and sandbox extensions
This commit is contained in:
@@ -40,7 +40,7 @@ if (-not (Test-Path -LiteralPath (Join-Path $templateDirFull 'package.json'))) {
|
||||
throw "Package template not found: $templateDirFull"
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $assembliesDirFull 'C4ITF4SDM42WebApi.dll'))) {
|
||||
if (-not (Get-ChildItem -LiteralPath $assembliesDirFull -Filter 'C4ITF4SDM42WebApi.dll' -File -Recurse | Select-Object -First 1)) {
|
||||
throw "Package assemblies not found: $assembliesDirFull"
|
||||
}
|
||||
|
||||
@@ -53,8 +53,12 @@ if (Test-Path -LiteralPath $zipPath) {
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $packageDir -Force | Out-Null
|
||||
Copy-Item -Path (Join-Path $templateDirFull '*') -Destination $packageDir -Recurse -Force
|
||||
Copy-Item -Path $assembliesDirFull -Destination (Join-Path $packageDir 'Assemblies') -Recurse -Force
|
||||
Copy-Item -Path (Join-Path $templateDirFull '*') -Destination $packageDir -Recurse -Force
|
||||
$packageAssembliesPath = Join-Path $packageDir 'Assemblies'
|
||||
if (Test-Path -LiteralPath $packageAssembliesPath) {
|
||||
Remove-Item -LiteralPath $packageAssembliesPath -Recurse -Force
|
||||
}
|
||||
Copy-Item -Path $assembliesDirFull -Destination $packageAssembliesPath -Recurse -Force
|
||||
|
||||
$packageJsonPath = Join-Path $packageDir 'package.json'
|
||||
$packageJson = [System.IO.File]::ReadAllText($packageJsonPath)
|
||||
@@ -62,24 +66,22 @@ $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))
|
||||
$configDataPath = Join-Path $packageDir 'install\1010_Config_Data\02-01-0080 C4IT_F4SDConfigurationType.dat'
|
||||
if (Test-Path -LiteralPath $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 |
|
||||
|
||||
Reference in New Issue
Block a user