|
11 | 11 |
|
12 | 12 | # Grab package.json data which is used throughout the build. |
13 | 13 | $script:PackageJson = Get-Content -Raw $PSScriptRoot/package.json | ConvertFrom-Json |
14 | | -$script:IsPreviewExtension = $script:PackageJson.name -like "*preview*" -or $script:PackageJson.displayName -like "*preview*" |
15 | 14 | Write-Host "`n### Extension: $($script:PackageJson.name)-$($script:PackageJson.version)`n" -ForegroundColor Green |
16 | 15 |
|
17 | 16 | function Get-EditorServicesPath { |
@@ -128,26 +127,14 @@ task TestEditorServices -If (Get-EditorServicesPath) { |
128 | 127 | #endregion |
129 | 128 | #region Package tasks |
130 | 129 |
|
131 | | -task UpdateReadme -If { $script:IsPreviewExtension } { |
132 | | - # Add the preview text |
133 | | - $newReadmeTop = '# PowerShell Language Support for Visual Studio Code |
134 | | -
|
135 | | -> ## ATTENTION: This is the PREVIEW version of the PowerShell extension for VSCode which contains features that are being evaluated for stable. It works with PowerShell 5.1 and up. |
136 | | -> ### If you are looking for the stable version, please [go here](https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell) or install the extension called "PowerShell" (not "PowerShell Preview") |
137 | | -> ## NOTE: If you have both stable (aka "PowerShell") and preview (aka "PowerShell Preview") installed, you MUST [DISABLE](https://code.visualstudio.com/docs/editor/extension-gallery#_disable-an-extension) one of them for the best performance. Docs on how to disable an extension can be found [here](https://code.visualstudio.com/docs/editor/extension-gallery#_disable-an-extension)' |
138 | | - $readmePath = (Join-Path $PSScriptRoot README.md) |
139 | | - |
140 | | - $readmeContent = Get-Content -Path $readmePath |
141 | | - if (!($readmeContent -match "This is the PREVIEW version of the PowerShell extension")) { |
142 | | - $readmeContent[0] = $newReadmeTop |
143 | | - $readmeContent | Set-Content $readmePath -Encoding utf8 |
144 | | - } |
145 | | -} |
146 | | - |
147 | | -task Package UpdateReadme, Build, { |
| 130 | +task Package Build, { |
148 | 131 | Write-Host "`n### Packaging $($script:PackageJson.name)-$($script:PackageJson.version).vsix`n" -ForegroundColor Green |
149 | 132 | assert ((Get-Item ./modules).LinkType -ne "SymbolicLink") "Packaging requires a copy of PSES, not a symlink!" |
150 | | - exec { & npm run package } |
| 133 | + if ($script:PackageJson.preview) { |
| 134 | + exec { & npm run package -- --pre-release } |
| 135 | + } else { |
| 136 | + exec { & npm run package } |
| 137 | + } |
151 | 138 | } |
152 | 139 |
|
153 | 140 | #endregion |
|
0 commit comments