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