Update Set-AppVersion.ps1

Former-commit-id: 22ddf410543089d9c0ee21de98fc54f5c543e8a8 [formerly b3f9e74493f9bf60a204c42de436959b6118b60b [formerly b22f5157954f2018470fad16050a70e987cf52e2]]
Former-commit-id: 7905c7b5cdd71ba97c879d7f687a2ec9eb7609e5 [formerly 2611e70469e6bdc34396741e1244717d07a0a8e4]
Former-commit-id: e45cf6d74f0d40d1406a4a18a1247dd27c580acd
This commit is contained in:
Jaifroid 2022-06-05 21:00:57 +01:00
parent 2d9618acb3
commit 1c5dbb4cfa

View File

@ -28,12 +28,15 @@ if ($VERSION -match '^v?[\d.]') {
$CustomVersion = $VERSION -replace '^([^-]+).*', '$1-E'
"Setting App Version to $CustomVersion in package.json ...`n"
$PackageJson = $PackageJson -replace '("version":\s+")[^"]+', "`${1}$CustomVersion"
# Remove extra whitespace
$PackageJson = $PackageJson -replace '\s+$', ''
# DEV: don't set BOM, as Linux tools crash with it
Set-Content ./package.json $PackageJson
if ($nwVersion) {
$CustomVersion = $CustomVersion -creplace '-E', '-N'
"Setting package.json.nwjs to $CustomVersion ..."
$PackageJsonNW = $PackageJsonNW -replace '("version":\s+")[^"]+', "`${1}$CustomVersion"
$PackageJsonNW = $PackageJsonNW -replace '\s+$', ''
# DEV: don't set BOM, as Linux tools crash with it
Set-Content ./package.json.nwjs $PackageJsonNW
$BuildNWJSScript = Get-Content -Raw ./scripts/Build-NWJS.ps1
@ -41,6 +44,7 @@ if ($VERSION -match '^v?[\d.]') {
$BuildNWJSScript = $BuildNWJSScript -replace '(appBuild\s*=\s*["''])[^"'']+', ("`${1}$CustomVersion")
"Setting NWJS build to $nwVersion in Build-NWJS.ps1 ..."
$BuildNWJSScript = $BuildNWJSScript -replace '(version10\s*=\s*["''])[^"'']+', "`${1}$nwVersion"
$BuildNWJSScript = $BuildNWJSScript -replace '\s+$', ''
Set-Content -encoding "utf8BOM" ./scripts/Build-NWJS.ps1 $BuildNWJSScript
}
} else {