gerane / VSCodeThemes

Themes for Visual Studio Code
200 stars 77 forks source link

Fixed package.json contributes.themes by converting the PowerShell ob… #79

Closed cjones26 closed 4 years ago

cjones26 commented 4 years ago

…ject back into proper JSON format.

I put together this hacky little script to fix these themes:

Get-ChildItem -Recurse . -Filter package.json | % { $jsonBody = (gc $_.FullName | out-string | convertfrom-json)
$label = ($jsonBody.contributes.themes | ConvertFrom-String).p1 -replace "@{label=","" -replace ";",""
$uiTheme = ($jsonBody.contributes.themes | ConvertFrom-String).p2 -replace "uiTheme=","" -replace ";",""
$path = ($jsonBody.contributes.themes | ConvertFrom-String).p3 -replace "path=","" -replace "}",""
$theme = @{label=$label;uiTheme=$uiTheme;path=$path}
$jsonBody.contributes.themes = @($theme)
$jsonBody | ConvertTo-JSON -Depth 100 | Set-Content $_.FullName
}