Skip to content

Commit c116a6f

Browse files
committed
Replace folder name when updating libraries
1 parent f9bc529 commit c116a6f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

JsLibraryPackaging.psm1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,16 @@ function Update-JavaScriptLibrary ($name, $newVersion) {
152152
mv $oldVersionFolder.Name $newVersionFolder
153153

154154
$licenseFile = Get-Item "$newVersionFolder\LICENSE.htm"
155-
(Get-Content $licenseFile) | % { $_ -replace $oldVersion, $newVersion } | Set-Content $licenseFile
155+
(Get-Content $licenseFile) | % { $_ -replace $oldVersion.Replace('.', '\.'), $newVersion } | Set-Content $licenseFile
156156

157157
$dnnFile = Get-Item "$newVersionFolder\*.dnn"
158-
(Get-Content $dnnFile) | % { $_ -replace $oldVersion, $newVersion } | Set-Content $dnnFile
158+
(Get-Content $dnnFile) | % { $_ -replace $oldVersion.Replace('.', '\.'), $newVersion } | Set-Content $dnnFile
159+
160+
$oldParsedVersion = [System.Version]::Parse($oldVersion)
161+
$newParsedVersion = [System.Version]::Parse($newVersion)
162+
$oldParsedFolder = "$($oldParsedVersion.Major.ToString('0#'))_$($oldParsedVersion.Minor.ToString('0#'))_$($oldParsedVersion.Build.ToString('0#'))"
163+
$newParsedFolder = "$($newParsedVersion.Major.ToString('0#'))_$($newParsedVersion.Minor.ToString('0#'))_$($newParsedVersion.Build.ToString('0#'))"
164+
(Get-Content $dnnFile) | % { $_ -replace $oldParsedFolder, $newParsedFolder } | Set-Content $dnnFile
159165

160166
git add -A
161167
git --no-pager diff --cached --find-renames=10%

0 commit comments

Comments
 (0)