gerane / VSCodeThemes

Themes for Visual Studio Code
200 stars 77 forks source link

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

Closed cjones26 closed 4 years ago

cjones26 commented 4 years ago

…ject back into proper JSON format.

Utilized the following hacky script to do so, which seemed to do the trick:

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
}
gerane commented 4 years ago

I will look at this as soon as I get back to my computer.

On Wed, Oct 16, 2019, 9:59 AM C. L. Jones notifications@github.com wrote:

…ject back into proper JSON format.

Utilized the following hacky script to do so, which seemed to do the trick:

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

}


You can view, comment on, or merge this pull request online at:

https://github.com/gerane/VSCodeThemes/pull/80 Commit Summary

  • Fixed package.json contributes.themes by converting the PowerShell object back into proper JSON format.

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gerane/VSCodeThemes/pull/80?email_source=notifications&email_token=ABS2QQEAKT7HXM4LBATKU53QO4T6DA5CNFSM4JBM2GBKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HSGCXQQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABS2QQE6GPIUTPT6WB6JF3LQO4T6DANCNFSM4JBM2GBA .

gerane commented 4 years ago

@cjones26 I overlooked the depth the json went and left off the -dept param when converting to json. Publishing the changes to the marketplace now.