|
| 1 | +# Get latest vscode repo |
| 2 | +if (Test-Path -Path "src/vs/temp") { |
| 3 | + Write-Host "`e[32m> Fetching latest`e[0m" |
| 4 | + git -C src/vs/temp checkout |
| 5 | + git -C src/vs/temp pull |
| 6 | +} else { |
| 7 | + Write-Host "`e[32m> Cloning microsoft/vscode`e[0m" |
| 8 | + $null = New-Item -ItemType Directory -Path "src/vs/temp" -Force |
| 9 | + git clone https://github.com/microsoft/vscode src/vs/temp |
| 10 | +} |
| 11 | + |
| 12 | +# Delete old base |
| 13 | +Write-Host "`e[32m> Deleting old base`e[0m" |
| 14 | +$null = Remove-Item -Recurse -Force "src/vs/base" |
| 15 | + |
| 16 | +# Copy base |
| 17 | +Write-Host "`e[32m> Copying base`e[0m" |
| 18 | +Copy-Item -Path "src/vs/temp/src/vs/base" -Destination "src/vs/base" -Recurse |
| 19 | + |
| 20 | +# Comment out any CSS imports |
| 21 | +Write-Host "`e[32m> Commenting out CSS imports" -NoNewline |
| 22 | +$baseFiles = Get-ChildItem -Path "src/vs/base" -Recurse -File |
| 23 | +$count = 0 |
| 24 | +foreach ($file in $baseFiles) { |
| 25 | + $content = Get-Content -Path $file.FullName |
| 26 | + $updatedContent = $content | ForEach-Object { |
| 27 | + if ($_ -match "^import 'vs/css!") { |
| 28 | + Write-Host "`e[32m." -NoNewline |
| 29 | + $count++ |
| 30 | + "// $_" |
| 31 | + } else { |
| 32 | + $_ |
| 33 | + } |
| 34 | + } |
| 35 | + $updatedContent | Set-Content -Path $file.FullName |
| 36 | +} |
| 37 | +Write-Host " $count files patched`e[0m" |
| 38 | + |
| 39 | +# Replace `monaco-*` with `xterm-*`, this will help avoid any styling conflicts when monaco and |
| 40 | +# xterm.js are used in the same project. |
| 41 | +Write-Host "`e[32m> Replacing monaco-* class names with xterm-* `e[0m" -NoNewline |
| 42 | +$baseFiles = Get-ChildItem -Path "src/vs/base" -Recurse -File |
| 43 | +$count = 0 |
| 44 | +foreach ($file in $baseFiles) { |
| 45 | + $content = Get-Content -Path $file.FullName |
| 46 | + if ($content -match "monaco-([a-zA-Z\-]+)") { |
| 47 | + $updatedContent = $content -replace "monaco-([a-zA-Z\-]+)", 'xterm-$1' |
| 48 | + Write-Host "`e[32m." -NoNewline |
| 49 | + $count++ |
| 50 | + $updatedContent | Set-Content -Path $file.FullName |
| 51 | + } |
| 52 | +} |
| 53 | +Write-Host " $count files patched`e[0m" |
| 54 | + |
| 55 | +# Copy typings |
| 56 | +Write-Host "`e[32m> Copying typings`e[0m" |
| 57 | +Copy-Item -Path "src/vs/temp/src/typings" -Destination "src/vs" -Recurse -Force |
| 58 | + |
| 59 | +# Deleting unwanted typings |
| 60 | +Write-Host "`e[32m> Deleting unwanted typings`e[0m" |
| 61 | +$null = Remove-Item -Path "src/vs/typings/vscode-globals-modules.d.ts" -Force |
0 commit comments