@@ -301,10 +301,7 @@ function Update-Changelog {
301301 - package.json:
302302 - `version` field with `"X.Y.Z"` and no prefix or suffix
303303 - `preview` field set to `true` or `false` if version is a preview
304- - `name` field has `-preview` appended similarly
305- - `displayName` field has ` Preview` appended similarly
306- - `description` field has `(Preview) ` prepended similarly
307- - `icon` field has `_Preview ` inserted similarly
304+ - `icon` field has `_Preview ` inserted if preview
308305#>
309306function Update-Version {
310307 [CmdletBinding (SupportsShouldProcess )]
@@ -318,34 +315,23 @@ function Update-Version {
318315
319316 Update-Branch - RepositoryName $RepositoryName
320317
321- # TODO: Maybe cleanup the replacement logic.
322318 Use-Repository - RepositoryName $RepositoryName - Script {
323319 switch ($RepositoryName ) {
324320 " vscode-powershell" {
325- $d = " Develop PowerShell modules, commands and scripts in Visual Studio Code!"
326321 if ($Version.PreReleaseLabel ) {
327- $name = " powershell-preview"
328- $displayName = " PowerShell Preview"
329322 $preview = " true"
330- $description = " (Preview) $d "
331323 $icon = " media/PowerShell_Preview_Icon.png"
332324 } else {
333- $name = " powershell"
334- $displayName = " PowerShell"
335325 $preview = " false"
336- $description = $d
337326 $icon = " media/PowerShell_Icon.png"
338327 }
339328
340329 $path = " package.json"
341330 $f = Get-Content - Path $path
342331 # NOTE: The prefix regex match two spaces exactly to avoid matching
343332 # nested objects in the file.
344- $f = $f -replace ' ^(?<prefix> "name":\s+")(.+)(?<suffix>",)$' , " `$ {prefix}${name} `$ {suffix}"
345- $f = $f -replace ' ^(?<prefix> "displayName":\s+")(.+)(?<suffix>",)$' , " `$ {prefix}${displayName} `$ {suffix}"
346333 $f = $f -replace ' ^(?<prefix> "version":\s+")(.+)(?<suffix>",)$' , " `$ {prefix}${v} `$ {suffix}"
347334 $f = $f -replace ' ^(?<prefix> "preview":\s+)(.+)(?<suffix>,)$' , " `$ {prefix}${preview} `$ {suffix}"
348- $f = $f -replace ' ^(?<prefix> "description":\s+")(.+)(?<suffix>",)$' , " `$ {prefix}${description} `$ {suffix}"
349335 $f = $f -replace ' ^(?<prefix> "icon":\s+")(.+)(?<suffix>",)$' , " `$ {prefix}${icon} `$ {suffix}"
350336 $f | Set-Content - Path $path
351337 git add $path
0 commit comments