@@ -209,6 +209,28 @@ function Get-Version {
209
209
}
210
210
}
211
211
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
+
212
234
<#
213
235
. SYNOPSIS
214
236
Validates the given version string.
@@ -341,8 +363,8 @@ function Update-Changelog {
341
363
342
364
- package.json:
343
365
- `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
346
368
#>
347
369
function Update-Version {
348
370
[CmdletBinding (SupportsShouldProcess )]
@@ -352,28 +374,26 @@ function Update-Version {
352
374
[string ]$RepositoryName
353
375
)
354
376
$Version = Get-Version - RepositoryName $RepositoryName
355
- $v = " $ ( $ Version.Major ) . $ ( $ Version.Minor ) . $ ( $Version .Patch ) "
377
+ $v = Get-MajorMinorPatch - Version $ Version
356
378
357
379
Update-Branch - RepositoryName $RepositoryName
358
380
359
381
Use-Repository - RepositoryName $RepositoryName - Script {
360
382
switch ($RepositoryName ) {
361
383
" 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
+ # }
369
390
370
391
$path = " package.json"
371
392
$f = Get-Content - Path $path
372
393
# NOTE: The prefix regex match two spaces exactly to avoid matching
373
394
# nested objects in the file.
374
395
$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}"
377
397
$f | Set-Content - Path $path
378
398
git add $path
379
399
}
0 commit comments