Skip to content

Commit 1f84612

Browse files
committed
Setup Release task in Invoke-Build
This splits up the npm tasks so that we only generate a sourcemap when developing, and only minify when building a release.
1 parent 709376e commit 1f84612

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@
7878
"main": "./out/main.js",
7979
"scripts": {
8080
"lint": "tslint --project tsconfig.json",
81-
"build": "tsc --project tsconfig.json && esbuild ./src/main.ts --outdir=out --sourcemap --bundle --minify --external:vscode --platform=node",
81+
"compile": "tsc --project tsconfig.json && esbuild ./src/main.ts --outdir=out --bundle --external:vscode --platform=node",
82+
"build": "npm run compile -- --sourcemap",
83+
"release": "npm run compile -- --minify",
8284
"test": "node ./out/test/runTests.js",
8385
"package": "vsce package --no-gitHubIssueLinking",
8486
"publish": "vsce publish"

vscode-powershell.build.ps1

+12-4
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,18 @@ task CleanEditorServices -If (Get-EditorServicesPath) {
5252
#endregion
5353
#region Build tasks
5454

55+
task DeleteEditorServices -If (Get-EditorServicesPath) {
56+
Write-Host "`n### Deleting Copy of PowerShellEditorServices`n" -ForegroundColor Green
57+
Remove-Item ./modules -Recurse -Force -ErrorAction Ignore
58+
}
59+
5560
task BuildEditorServices -If (Get-EditorServicesPath) {
5661
Write-Host "`n### Building PowerShellEditorServices`n" -ForegroundColor Green
5762
Invoke-Build Build (Get-EditorServicesPath)
5863
}
5964

60-
task LinkEditorServices -If (Get-EditorServicesPath) BuildEditorServices, {
65+
task LinkEditorServices -If (Get-EditorServicesPath) DeleteEditorServices, BuildEditorServices, {
6166
Write-Host "`n### For developer use only! Creating symbolic link to PSES" -ForegroundColor Green
62-
Remove-Item ./modules -Recurse -Force -ErrorAction Ignore
6367
New-Item -ItemType SymbolicLink -Path ./modules -Target "$(Split-Path (Get-EditorServicesPath))/module"
6468
}
6569

@@ -97,7 +101,6 @@ task TestEditorServices -If (Get-EditorServicesPath) {
97101
}
98102

99103
#endregion
100-
101104
#region Package tasks
102105

103106
task UpdateReadme -If { $script:IsPreviewExtension } {
@@ -116,7 +119,12 @@ task UpdateReadme -If { $script:IsPreviewExtension } {
116119
}
117120
}
118121

119-
task Package UpdateReadme, Build, {
122+
task Release UpdateReadme, DeleteEditorServices, CopyEditorServices, Restore, {
123+
Write-Host "`n### Building release of vscode-powershell" -ForegroundColor Green
124+
exec { & npm run release }
125+
}
126+
127+
task Package Release, {
120128
assert (Test-Path ./modules/PowerShellEditorServices)
121129
assert ((Get-Item ./modules).LinkType -ne "SymbolicLink") "Packaging requires a copy of PSES, not a symlink!"
122130

0 commit comments

Comments
 (0)