matthewjberger / scoop-nerd-fonts

A scoop bucket for installing nerd fonts
The Unlicense
353 stars 34 forks source link

Repalce manually escaped JSON template in generate-manifests.ps1 with ConvertTo-Json #152

Closed jantari closed 2 years ago

jantari commented 2 years ago

Hi,

I found this repository when sorting by recently updated - I use both scoop and nerd-fonts so I took a look, thanks for the bucket!

By using a PowerShell hashtable and ConvertTo-Json we can avoid the error-prone manual escaping of JSONs special characters inside the templateString.

ConvertTo-Json automatically correctly escapes everything and it makes the manifest template data easier to read and maintain.

I tested exporting some templates and running them through checkver -u and the JSON was still read and updated correctly. Installing and uninstalling from the manifests also still worked like before because I didn't change any of the contents, just the way the JSON file is produced.