-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-version.ps1
26 lines (18 loc) · 965 Bytes
/
update-version.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
param([String] $VERSION_MODE)
function Update-Version([String] $filename, [String] $mode) {
"Updating version in $filename with a $mode update."
# get contents of file
$json = Get-Content $filename | ConvertFrom-Json
$version = [version] $json.version
if ($mode -eq "major") { $newMajor = $version.Major + 1 } else { $newMajor = $version.Major }
if ($mode -eq "minor") { $newMinor = $version.Minor + 1 } else { $newMinor = $version.Minor }
if ($mode -eq "patch") { $newPatch = $version.Build + 1 } else { $newPatch = $version.Build }
$newVersion = "$newMajor.$newMinor.$newPatch"
$json.version = $newVersion
"Updating version to $newVersion"
Set-Content -Path $filename -Value ($json | ConvertTo-Json)
}
Update-Version "packages\Server\package.json" $VERSION_MODE
Update-Version "packages\Client\package.json" $VERSION_MODE
Update-Version "package.json" $VERSION_MODE
Update-Version "lerna.json" $VERSION_MODE