@@ -209,6 +209,28 @@ function Get-Version {
209209 }
210210}
211211
212+ <#
213+ . SYNOPSIS
214+ Gets the version as a semantic version string without the 'v' prefix or
215+ pre-release suffix.
216+ #>
217+ function Get-MajorMinorPatch {
218+ param (
219+ [Parameter (Mandatory )]
220+ [semver ]$Version
221+ )
222+ return " $ ( $Version.Major ) .$ ( $Version.Minor ) .$ ( $Version.Patch ) "
223+ }
224+
225+ <#
226+ . SYNOPSIS
227+ Tests if this is a pre-release (specifically for the extension).
228+ #>
229+ function Test-IsPreRelease {
230+ $Version = Get-Version - RepositoryName vscode- powershell
231+ return [bool ]$Version.PreReleaseLabel
232+ }
233+
212234<#
213235. SYNOPSIS
214236 Validates the given version string.
@@ -341,8 +363,8 @@ function Update-Changelog {
341363
342364 - package.json:
343365 - `version` field with `"X.Y.Z"` and no prefix or suffix
344- - `preview` field set to `true` or ` false` if version is a preview
345- - `icon` field has `_Preview ` inserted if preview
366+ - `preview` field is always ` false` because now we do "pre-releases"
367+ - TODO: `icon` field has `_Preview ` inserted if preview
346368#>
347369function Update-Version {
348370 [CmdletBinding (SupportsShouldProcess )]
@@ -352,28 +374,26 @@ function Update-Version {
352374 [string ]$RepositoryName
353375 )
354376 $Version = Get-Version - RepositoryName $RepositoryName
355- $v = " $ ( $ Version.Major ) . $ ( $ Version.Minor ) . $ ( $Version .Patch ) "
377+ $v = Get-MajorMinorPatch - Version $ Version
356378
357379 Update-Branch - RepositoryName $RepositoryName
358380
359381 Use-Repository - RepositoryName $RepositoryName - Script {
360382 switch ($RepositoryName ) {
361383 " vscode-powershell" {
362- if ($Version.PreReleaseLabel ) {
363- $preview = " true"
364- $icon = " media/PowerShell_Preview_Icon.png"
365- } else {
366- $preview = " false"
367- $icon = " media/PowerShell_Icon.png"
368- }
384+ # TODO: Bring this back when the marketplace supports it.
385+ # if ($Version.PreReleaseLabel) {
386+ # $icon = "media/PowerShell_Preview_Icon.png"
387+ # } else {
388+ # $icon = "media/PowerShell_Icon.png"
389+ # }
369390
370391 $path = " package.json"
371392 $f = Get-Content - Path $path
372393 # NOTE: The prefix regex match two spaces exactly to avoid matching
373394 # nested objects in the file.
374395 $f = $f -replace ' ^(?<prefix> "version":\s+")(.+)(?<suffix>",)$' , " `$ {prefix}${v} `$ {suffix}"
375- $f = $f -replace ' ^(?<prefix> "preview":\s+)(.+)(?<suffix>,)$' , " `$ {prefix}${preview} `$ {suffix}"
376- $f = $f -replace ' ^(?<prefix> "icon":\s+")(.+)(?<suffix>",)$' , " `$ {prefix}${icon} `$ {suffix}"
396+ # TODO: $f = $f -replace '^(?<prefix> "icon":\s+")(.+)(?<suffix>",)$', "`${prefix}${icon}`${suffix}"
377397 $f | Set-Content - Path $path
378398 git add $path
379399 }
0 commit comments