diff --git a/docs/development.md b/docs/development.md index 0d4180dc83..109fc3909d 100644 --- a/docs/development.md +++ b/docs/development.md @@ -38,6 +38,11 @@ This will compile the TypeScript files in the project to JavaScript files. Invoke-Build Build ``` +As a developer, you may want to use `Invoke-Build LinkEditorServices` to setup a symbolic +link to its modules instead of copying the files. This will mean the built extension will +always have the latest version of your PowerShell Editor Services build, but this cannot +be used to package the extension into a VSIX. So it is a manual step. + ### Launching the extension #### From Visual Studio Code diff --git a/modules/README.md b/modules/README.md deleted file mode 100644 index 2d6e243249..0000000000 --- a/modules/README.md +++ /dev/null @@ -1,8 +0,0 @@ -## `modules` folder README - -This folder contains modules that are bundled with the vscode-powershell extension. -All subfolders are not included in our GitHub repository, they are added here just -before the module is published to the Visual Studio Marketplace. - -This file serves as a placeholder so that the `modules` folder will be included -in our Git repository. \ No newline at end of file diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index 33231e3ec0..61f9b99bf8 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -39,7 +39,7 @@ task Restore -If { !(Test-Path "$PSScriptRoot/node_modules") } { task Clean { Write-Host "`n### Cleaning vscode-powershell`n" -ForegroundColor Green - Remove-Item ./modules -Exclude "README.md" -Recurse -Force -ErrorAction Ignore + Remove-Item ./modules -Recurse -Force -ErrorAction Ignore Remove-Item ./out -Recurse -Force -ErrorAction Ignore Remove-Item ./node_modules -Recurse -Force -ErrorAction Ignore } @@ -57,9 +57,15 @@ task BuildEditorServices -If (Get-EditorServicesPath) { Invoke-Build Build (Get-EditorServicesPath) } -task CopyEditorServices -If { !(Test-Path ./modules/PowerShellEditorServices) -and (Get-EditorServicesPath) } BuildEditorServices, { - Write-Host "`n### Copying PowerShellEditorServices module files" -ForegroundColor Green - Copy-Item -Recurse -Force "$(Split-Path (Get-EditorServicesPath))/module/*" ./modules +task LinkEditorServices -If (Get-EditorServicesPath) BuildEditorServices, { + Write-Host "`n### For developer use only! Creating symbolic link to PSES" -ForegroundColor Green + Remove-Item ./modules -Recurse -Force -ErrorAction Ignore + New-Item -ItemType SymbolicLink -Path ./modules -Target "$(Split-Path (Get-EditorServicesPath))/module" +} + +task CopyEditorServices -If { !(Test-Path ./modules) -and (Get-EditorServicesPath) } BuildEditorServices, { + Write-Host "`n### Copying PSES" -ForegroundColor Green + Copy-Item -Recurse -Force "$(Split-Path (Get-EditorServicesPath))/module" ./modules } task Build CopyEditorServices, Restore, { @@ -111,7 +117,9 @@ task UpdateReadme -If { $script:IsPreviewExtension } { } task Package UpdateReadme, Build, { - assert { Test-Path ./modules/PowerShellEditorServices } + assert (Test-Path ./modules/PowerShellEditorServices) + assert ((Get-Item ./modules).LinkType -ne "SymbolicLink") "Packaging requires a copy of PSES, not a symlink!" + Write-Host "`n### Packaging $($script:PackageJson.name)-$($script:PackageJson.version).vsix`n" -ForegroundColor Green exec { & npm run package } }