@@ -37,42 +37,51 @@ jobs:
37
37
# Runs a set of commands using the runners shell
38
38
- name : Generate new dts and compare it with the old one
39
39
run : |
40
+ # This will contain the content of our new file
40
41
$fullFile = [System.Collections.Generic.List[string]]@()
41
42
$dts = Get-Content ./vscode.proposed.d.ts
42
43
44
+ # First add everything up to the declare statement
43
45
$index = 0
44
46
while ($dts[$index] -notmatch "declare module 'vscode' {") {
45
47
$fullFile += $dts[$index]
46
48
$index++
47
49
}
48
50
51
+ # Add the declare statement
49
52
$fullFile += $dts[$index]
50
53
54
+ # Find the Notebook region start index
51
55
for ( $i = $index; $i -lt $dts.Length; $i++) {
52
56
if($dts[$i] -match '//#region @rebornix: Notebook') {
53
57
$index = $i
54
58
break
55
59
}
56
60
}
57
61
62
+ # Add everything until the endregion to the new file
58
63
while ($dts[$index] -notmatch "//#endregion") {
59
64
$fullFile += $dts[$index]
60
65
$index++
61
66
}
62
67
68
+ # Add the endregion line and ending brace line
63
69
$fullFile += $dts[$index]
64
70
$fullFile += '}'
65
71
72
+ # Overwrite the file with the new content
66
73
$fullFile | Set-Content ./vscode.proposed.d.ts
67
74
75
+ # Get the old and new files' raw text
68
76
$oldFile = Get-Content ./old.vscode.proposed.d.ts -Raw
69
77
$newFile = Get-Content ./vscode.proposed.d.ts -Raw
70
78
79
+ # Compare them and log if they are different
71
80
if($oldFile -ne $newFile) {
72
81
Write-Host "New changes detected!"
73
82
}
74
83
75
- # Or else tsc will complain.
84
+ # Remove the old file so it doesn't get picked up by tsc
76
85
Remove-Item ./old.vscode.proposed.d.ts -Force
77
86
78
87
- name : Compile the TypeScript to check for errors
0 commit comments