Skip to content

Commit f5516b0

Browse files
Merge pull request #4464 from PowerShell/andschwa/no-preview
Remove `preview` label from marketplace
2 parents ecc48dc + 619dc1f commit f5516b0

10 files changed

+218
-142
lines changed

.vsts-ci/templates/ci-general.yml

+18-12
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ parameters:
77
default: false
88

99
steps:
10-
- task: PowerShell@2
11-
displayName: PowerShell version
12-
inputs:
13-
targetType: inline
14-
script: $PSVersionTable
15-
pwsh: ${{ parameters.pwsh }}
16-
1710
- checkout: self
1811

1912
# NOTE: We either checkout the Git repo for PowerShellEditorServices, or we
@@ -62,19 +55,32 @@ steps:
6255
version: 6.0.x
6356
performMultiLevelLookup: true
6457

58+
# The build script is always run with PowerShell Core
6559
- task: PowerShell@2
66-
displayName: Build and test
60+
displayName: Build and package
6761
inputs:
6862
targetType: inline
6963
script: |
70-
Get-ChildItem env:
71-
Get-Module -ListAvailable Pester
7264
Install-Module InvokeBuild -Scope CurrentUser -Force
7365
Install-Module platyPS -Scope CurrentUser -Force
74-
Invoke-Build -Configuration Release
66+
Invoke-Build -Configuration Release Package
7567
$PackageJson = Get-Content -Raw package.json | ConvertFrom-Json
7668
Write-Host "##vso[task.setvariable variable=vsixPath]$(Resolve-Path powershell-$($PackageJson.version).vsix)"
7769
workingDirectory: $(Build.SourcesDirectory)/vscode-powershell
70+
pwsh: true
71+
72+
# Tests in particular are run with either PowerShell Core or Windows PowerShell
73+
- task: PowerShell@2
74+
displayName: Run unit tests
75+
inputs:
76+
targetType: inline
77+
script: |
78+
$PSVersionTable
79+
Get-ChildItem env:
80+
Get-Module -ListAvailable Pester
81+
Install-Module InvokeBuild -Scope CurrentUser -Force
82+
Invoke-Build -Configuration Release Test
83+
workingDirectory: $(Build.SourcesDirectory)/vscode-powershell
7884
pwsh: ${{ parameters.pwsh }}
7985

8086
- task: PowerShell@2
@@ -87,7 +93,7 @@ steps:
8793
Write-Host '##vso[task.LogIssue type=error;]PowerShell Editor Services bits were not built in release configuration!'
8894
exit 1
8995
}
90-
pwsh: ${{ parameters.pwsh }}
96+
pwsh: true
9197

9298
- publish: $(vsixPath)
9399
artifact: vscode-powershell-vsix-$(System.JobId)

.vsts-ci/templates/publish-markets.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ steps:
77

88
- pwsh: |
99
npm ci --loglevel=error
10-
$PackageJson = Get-Content -Raw $(Build.SourcesDirectory)/package.json | ConvertFrom-Json
10+
Import-Module $(Build.SourcesDirectory)/tools/VersionTools.psm1
11+
$Version = Get-Version -RepositoryName vscode-powershell
12+
$PackageVersion = Get-MajorMinorPatch -Version $Version
1113
$PublishArgs = @(
12-
if ($PackageJson.preview) { '--pre-release' }
14+
if (Test-IsPreRelease) { '--pre-release' }
1315
'--packagePath'
14-
"$(Pipeline.Workspace)/vscode-powershell/powershell-$($PackageJson.version).vsix"
16+
"$(Pipeline.Workspace)/vscode-powershell/powershell-$PackageVersion.vsix"
1517
'--pat'
1618
'$(VsceToken)'
1719
)

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ major update.
854854

855855
These major updates have also been tested over the last 6 months, in 13 releases of our
856856
[PowerShell Preview extension for Visual Studio
857-
Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell-preview). A
857+
Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.powershell). A
858858
huge thank you to all of the community members who have tested these changes to the
859859
extension and have worked with us to polish the extension before releasing it through our
860860
stable channel.
@@ -1079,7 +1079,7 @@ are updating the stable extension to bring some bug fixes forward. Please try ou
10791079
[PowerShell Preview extension][] for the latest and hopefully greatest experience, and
10801080
help us squash those bugs!
10811081

1082-
[PowerShell Preview extension]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell-Preview
1082+
[PowerShell Preview extension]: https://marketplace.visualstudio.com/items?itemName=ms-vscode.powershell
10831083

10841084
#### [PowerShellEditorServices](https://github.com/PowerShell/PowerShellEditorServices)
10851085

extension-dev.code-workspace

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"josefpihrt-vscode.roslynator",
1818
"ms-azure-devops.azure-pipelines",
1919
"ms-dotnettools.csharp",
20-
"ms-vscode.powershell-preview"
20+
"ms-vscode.powershell"
2121
]
2222
},
2323
"settings": {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "powershell",
33
"displayName": "PowerShell",
44
"version": "2023.3.1",
5-
"preview": true,
5+
"preview": false,
66
"publisher": "ms-vscode",
77
"description": "Develop PowerShell modules, commands and scripts in Visual Studio Code!",
88
"engines": {
@@ -23,7 +23,7 @@
2323
"PowerShell",
2424
"pwsh"
2525
],
26-
"icon": "media/PowerShell_Preview_Icon.png",
26+
"icon": "media/PowerShell_Icon.png",
2727
"galleryBanner": {
2828
"color": "#ACD1EC",
2929
"theme": "light"

src/features/ExternalApi.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ export class ExternalApiFeature extends LanguageClientConsumer implements IPower
7272
throw new Error(`No extension installed with id '${id}'. You must use a valid extension id.`);
7373
}
7474

75-
// These are only allowed to be used in our unit tests.
76-
if ((id === "ms-vscode.powershell" || id === "ms-vscode.powershell-preview")
77-
&& !(this.extensionContext.extensionMode === vscode.ExtensionMode.Test)) {
75+
// Our ID is only only allowed to be used in our unit tests.
76+
if (id === "ms-vscode.powershell" && !(this.extensionContext.extensionMode === vscode.ExtensionMode.Test)) {
7877
throw new Error("You can't use the PowerShell extension's id in this registration.");
7978
}
8079

src/main.ts

-8
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<IPower
5656

5757
telemetryReporter = new TelemetryReporter(PackageJSON.name, PackageJSON.version, AI_KEY);
5858

59-
// If both extensions are enabled, this will cause unexpected behavior since both register the same commands.
60-
// TODO: Merge extensions and use preview channel in marketplace instead.
61-
if (PackageJSON.name.toLowerCase() === "powershell-preview"
62-
&& vscode.extensions.getExtension("ms-vscode.powershell")) {
63-
void logger.writeAndShowError(
64-
"'PowerShell' and 'PowerShell Preview' are both enabled. Please disable one for best performance.");
65-
}
66-
6759
// Load and validate settings (will prompt for 'cwd' if necessary).
6860
await validateCwdSetting(logger);
6961
const settings = getSettings();

tools/ReleaseTools.psm1

+23-104
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,26 @@
66
using module PowerShellForGitHub
77
using namespace System.Management.Automation
88

9-
class RepoNames: IValidateSetValuesGenerator {
10-
# NOTE: This is super over-engineered, but it was fun.
11-
static [string[]] $Values = "vscode-powershell", "PowerShellEditorServices"
12-
[String[]] GetValidValues() { return [RepoNames]::Values }
13-
}
14-
15-
$ChangelogFile = "CHANGELOG.md"
9+
Import-Module $PSScriptRoot/VersionTools.psm1
1610

1711
<#
1812
.SYNOPSIS
19-
Given the repository name, execute the script in its directory.
13+
Creates and checks out `release` if not already on it.
2014
#>
21-
function Use-Repository {
22-
[CmdletBinding()]
15+
function Update-Branch {
16+
[CmdletBinding(SupportsShouldProcess)]
2317
param(
2418
[Parameter(Mandatory)]
2519
[ValidateSet([RepoNames])]
26-
[string]$RepositoryName,
27-
28-
[Parameter(Mandatory)]
29-
[scriptblock]$Script
20+
[string]$RepositoryName
3021
)
31-
try {
32-
switch ($RepositoryName) {
33-
"vscode-powershell" {
34-
Push-Location -Path "$PSScriptRoot/../"
35-
}
36-
"PowerShellEditorServices" {
37-
Push-Location -Path "$PSScriptRoot/../../PowerShellEditorServices"
22+
Use-Repository -RepositoryName $RepositoryName -Script {
23+
$Branch = git branch --show-current
24+
if ($Branch -ne "release") {
25+
if ($PSCmdlet.ShouldProcess("release", "git checkout -B")) {
26+
git checkout -B "release"
3827
}
3928
}
40-
& $Script
41-
} finally {
42-
Pop-Location
4329
}
4430
}
4531

@@ -143,72 +129,6 @@ function Get-Bullets {
143129
}
144130
}
145131

146-
<#
147-
.SYNOPSIS
148-
Gets the unpublished content from the changelog.
149-
.DESCRIPTION
150-
This is used so that we can manually touch-up the automatically updated
151-
changelog, and then bring its contents into the extension's changelog or
152-
the GitHub release. It just gets the first header's contents.
153-
#>
154-
function Get-FirstChangelog {
155-
param(
156-
[Parameter(Mandatory)]
157-
[ValidateSet([RepoNames])]
158-
[string]$RepositoryName
159-
)
160-
$Changelog = Use-Repository -RepositoryName $RepositoryName -Script {
161-
Get-Content -Path $ChangelogFile
162-
}
163-
# NOTE: The space after the header marker is important! Otherwise ### matches.
164-
$Header = $Changelog.Where({$_.StartsWith("## ")}, "First")
165-
$Changelog.Where(
166-
{ $_ -eq $Header }, "SkipUntil"
167-
).Where(
168-
{ $_.StartsWith("## ") -and $_ -ne $Header }, "Until"
169-
)
170-
}
171-
172-
<#
173-
.SYNOPSIS
174-
Creates and checks out `release` if not already on it.
175-
#>
176-
function Update-Branch {
177-
[CmdletBinding(SupportsShouldProcess)]
178-
param(
179-
[Parameter(Mandatory)]
180-
[ValidateSet([RepoNames])]
181-
[string]$RepositoryName
182-
)
183-
Use-Repository -RepositoryName $RepositoryName -Script {
184-
$Branch = git branch --show-current
185-
if ($Branch -ne "release") {
186-
if ($PSCmdlet.ShouldProcess("release", "git checkout -B")) {
187-
git checkout -B "release"
188-
}
189-
}
190-
}
191-
}
192-
193-
<#
194-
.SYNOPSIS
195-
Gets current version from changelog as `[semver]`.
196-
#>
197-
function Get-Version {
198-
param(
199-
[Parameter(Mandatory)]
200-
[ValidateSet([RepoNames])]
201-
[string]$RepositoryName
202-
)
203-
# NOTE: The first line should always be the header.
204-
$Changelog = (Get-FirstChangelog -RepositoryName $RepositoryName)[0]
205-
if ($Changelog -match '## v(?<version>\d+\.\d+\.\d+(-preview\.?\d*)?)') {
206-
return [semver]$Matches.version
207-
} else {
208-
Write-Error "Couldn't find version from changelog!"
209-
}
210-
}
211-
212132
<#
213133
.SYNOPSIS
214134
Updates the CHANGELOG file with PRs merged since the last release.
@@ -224,12 +144,13 @@ function Update-Changelog {
224144
[ValidateSet([RepoNames])]
225145
[string]$RepositoryName,
226146

227-
# TODO: Validate version style for each repo.
228147
[Parameter(Mandatory)]
229-
[ValidateScript({ $_.StartsWith("v") })]
230148
[string]$Version
231149
)
232150

151+
# Since we depend on both parameters, we can't do this with `ValidateScript`.
152+
Test-VersionIsValid -RepositoryName $RepositoryName -Version $Version
153+
233154
# Get the repo object, latest release, and commits since its tag.
234155
$Repo = Get-GitHubRepository -OwnerName PowerShell -RepositoryName $RepositoryName
235156
$Commits = Use-Repository -RepositoryName $RepositoryName -Script {
@@ -300,8 +221,8 @@ function Update-Changelog {
300221
301222
- package.json:
302223
- `version` field with `"X.Y.Z"` and no prefix or suffix
303-
- `preview` field set to `true` or `false` if version is a preview
304-
- `icon` field has `_Preview ` inserted if preview
224+
- `preview` field is always `false` because now we do "pre-releases"
225+
- TODO: `icon` field has `_Preview ` inserted if preview
305226
#>
306227
function Update-Version {
307228
[CmdletBinding(SupportsShouldProcess)]
@@ -311,28 +232,26 @@ function Update-Version {
311232
[string]$RepositoryName
312233
)
313234
$Version = Get-Version -RepositoryName $RepositoryName
314-
$v = "$($Version.Major).$($Version.Minor).$($Version.Patch)"
235+
$v = Get-MajorMinorPatch -Version $Version
315236

316237
Update-Branch -RepositoryName $RepositoryName
317238

318239
Use-Repository -RepositoryName $RepositoryName -Script {
319240
switch ($RepositoryName) {
320241
"vscode-powershell" {
321-
if ($Version.PreReleaseLabel) {
322-
$preview = "true"
323-
$icon = "media/PowerShell_Preview_Icon.png"
324-
} else {
325-
$preview = "false"
326-
$icon = "media/PowerShell_Icon.png"
327-
}
242+
# TODO: Bring this back when the marketplace supports it.
243+
# if ($Version.PreReleaseLabel) {
244+
# $icon = "media/PowerShell_Preview_Icon.png"
245+
# } else {
246+
# $icon = "media/PowerShell_Icon.png"
247+
# }
328248

329249
$path = "package.json"
330250
$f = Get-Content -Path $path
331251
# NOTE: The prefix regex match two spaces exactly to avoid matching
332252
# nested objects in the file.
333253
$f = $f -replace '^(?<prefix> "version":\s+")(.+)(?<suffix>",)$', "`${prefix}${v}`${suffix}"
334-
$f = $f -replace '^(?<prefix> "preview":\s+)(.+)(?<suffix>,)$', "`${prefix}${preview}`${suffix}"
335-
$f = $f -replace '^(?<prefix> "icon":\s+")(.+)(?<suffix>",)$', "`${prefix}${icon}`${suffix}"
254+
# TODO: $f = $f -replace '^(?<prefix> "icon":\s+")(.+)(?<suffix>",)$', "`${prefix}${icon}`${suffix}"
336255
$f | Set-Content -Path $path
337256
git add $path
338257
}

0 commit comments

Comments
 (0)