appvision-gmbh / json2typescript

Map JSON to a TypeScript class with secure type checking!
https://www.npmjs.com/package/json2typescript
MIT License
278 stars 55 forks source link

Script for upgrading to 1.4.0+ #163

Closed tlmurphy closed 3 years ago

tlmurphy commented 3 years ago

At my work, we noticed our version of json2typescript was behind. When I noticed the requirement to have a parameter for JsonObject in 1.4.0+, I began manually replacing things in our code. We use this library quite heavily so I made a script to help with this: https://gist.github.com/tlmurphy/71b58c71e594899120da365159d7d40d

I did this as quickly as I could since I didn't want to spend too much time on it so it is possible it might not work 100% but I've tested it in at least one of our projects and it seems to work. It assumes that all the files to be replaced are under src and we use single quotes but I added a global var at the top to change that to double quotes if people use that.

I wasn't sure what the best way to share this was so I just made an issue, but if you want @andreas-aeschlimann, you could share it in the readme or something so that people can use it. Or copy it and make modifications to it to make it better doesn't matter to me :)

andreas-aeschlimann commented 3 years ago

Very cool, thank you for your input. I will mention it in the ReadMe!

andreas-aeschlimann commented 3 years ago

The script is now mentioned in the ReadMe. I will close this issue but you can keep commenting if you like to add some more information.

tlmurphy commented 3 years ago

Awesome, thanks!