diff --git a/.all-contributorsrc b/.all-contributorsrc index 5157058..687bc06 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -136,6 +136,15 @@ "contributions": [ "code" ] + }, + { + "login": "shakyShane", + "name": "Shane Osbourne", + "avatar_url": "https://avatars3.githubusercontent.com/u/1643522?v=4", + "profile": "https://medium.com/@shakyShane", + "contributions": [ + "code" + ] } ] } diff --git a/package.json b/package.json index 9e81a60..2ebbc54 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "is-svg": "^2.1.0", "json-schema-faker": "^0.5.0-rc11", "json-schema-to-typescript": "^4.6.5", + "json-ts": "^1.6.4", "lodash": "^4.17.4", "next": "4.2.3", "nprogress": "^0.2.0", diff --git a/pages/json-to-flow-types.js b/pages/json-to-flow-types.js index 311b530..da4c5ee 100644 --- a/pages/json-to-flow-types.js +++ b/pages/json-to-flow-types.js @@ -3,10 +3,11 @@ import dynamic from "next/dynamic"; import Layout from "../components/Layout"; import ConversionPanel from "../components/ConversionPanel"; import defaultText from "../utils/dummy-json"; -import transform from "transform-json-types"; +import { json2ts } from "json-ts"; +import PoweredBy from "../components/PoweredBy"; export default class Json2Ts extends PureComponent { - getTransformedValue = code => transform(code); + getTransformedValue = code => json2ts(code, { flow: true }); render() { return ( @@ -22,6 +23,7 @@ export default class Json2Ts extends PureComponent { url={this.props.url} prettifyRightPanel={false} /> + ); } diff --git a/pages/json-to-ts-interface.js b/pages/json-to-ts-interface.js index f14a220..6b50147 100644 --- a/pages/json-to-ts-interface.js +++ b/pages/json-to-ts-interface.js @@ -3,13 +3,11 @@ import dynamic from "next/dynamic"; import Layout from "../components/Layout"; import ConversionPanel from "../components/ConversionPanel"; import defaultText from "../utils/dummy-json"; -import transform from "transform-json-types"; +import { json2ts } from "json-ts"; +import PoweredBy from "../components/PoweredBy"; export default class Json2Ts extends PureComponent { - getTransformedValue = code => - transform(code, { - lang: "typescript" - }); + getTransformedValue = code => json2ts(code); render() { return ( @@ -25,6 +23,7 @@ export default class Json2Ts extends PureComponent { url={this.props.url} prettifyRightPanel={false} /> + ); } diff --git a/readme.md b/readme.md index db642bf..e5e9b33 100644 --- a/readme.md +++ b/readme.md @@ -50,6 +50,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds | [
Ritesh Kumar](http://riteshkr.com)
[📖](https://github.com/ritz078/transform-www/commits?author=ritz078 "Documentation") [💻](https://github.com/ritz078/transform-www/commits?author=ritz078 "Code") [🤔](#ideas-ritz078 "Ideas, Planning, & Feedback") [👀](#review-ritz078 "Reviewed Pull Requests") | [
Florian Gilcher](http://asquera.de)
[💻](https://github.com/ritz078/transform-www/commits?author=skade "Code") | [
Pascal Hertleif](http://pascalhertleif.de/)
[💻](https://github.com/ritz078/transform-www/commits?author=killercup "Code") | [
Lado Lomidze](http://landish.github.io)
[💻](https://github.com/ritz078/transform-www/commits?author=Landish "Code") | [
Mattia Manzati](https://github.com/mattiamanzati)
[💻](https://github.com/ritz078/transform-www/commits?author=mattiamanzati "Code") | [
Mohammad Rajabifard](https://tarino.ir)
[🤔](#ideas-morajabi "Ideas, Planning, & Feedback") [💻](https://github.com/ritz078/transform-www/commits?author=morajabi "Code") | [
Raathigeshan Kugarajan](http://raathigesh.com/)
[💻](https://github.com/ritz078/transform-www/commits?author=Raathigesh "Code") | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | [
Gyandeep Singh](https://gyandeeps.com)
[💻](https://github.com/ritz078/transform-www/commits?author=gyandeeps "Code") | [
Matt Holt](https://matt.life)
[💻](https://github.com/ritz078/transform-www/commits?author=mholt "Code") | [
sreenivas alapati](https://medium.com/@sreenivas)
[💻](https://github.com/ritz078/transform-www/commits?author=cg-cnu "Code") | [
Boris Cherny](https://performancejs.com)
[💻](https://github.com/ritz078/transform-www/commits?author=bcherny "Code") | [
Mark Lussier](http://www.twitter.com/intabulas)
[💻](https://github.com/ritz078/transform-www/commits?author=intabulas "Code") | [
Brice BERNARD](https://github.com/brikou)
[💻](https://github.com/ritz078/transform-www/commits?author=brikou "Code") | [
Satyajit Sahoo](https://twitter.com/@satya164)
[💻](https://github.com/ritz078/transform-www/commits?author=satya164 "Code") | +| [
Shane Osbourne](https://medium.com/@shakyShane)
[💻](https://github.com/ritz078/transform-www/commits?author=shakyShane "Code") | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/utils/routes.js b/utils/routes.js index c2cad11..bc10893 100644 --- a/utils/routes.js +++ b/utils/routes.js @@ -90,13 +90,17 @@ export const categorizedRoutes = [ { label: "JSON to Flow Types", path: "/json-to-flow-types", - desc: "An online REPL for converting JSON to generate Flow Types." + desc: "An online REPL for converting JSON to generate Flow Types.", + packageName: "json-ts", + packageUrl: "https://github.com/shakyShane/json-ts" }, { label: "JSON to Typescript Interface", path: "/json-to-ts-interface", desc: - "An online REPL for converting JSON to generate TypeScript Interface." + "An online REPL for converting JSON to generate TypeScript Interface.", + packageName: "json-ts", + packageUrl: "https://github.com/shakyShane/json-ts" }, { label: "JSON to MobX-State-Tree Model", diff --git a/yarn.lock b/yarn.lock index 344dfea..4ace141 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3010,6 +3010,10 @@ get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" +get-stdin@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" @@ -3493,6 +3497,10 @@ immediate@~3.0.5: version "3.0.6" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" +immutable@^3.8.1: + version "3.8.2" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" + import-from@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1" @@ -3976,6 +3984,17 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" +json-ts@^1.6.4: + version "1.6.4" + resolved "https://registry.yarnpkg.com/json-ts/-/json-ts-1.6.4.tgz#e4423b8ccdb3069306f4727d6a579790675abbd0" + dependencies: + get-stdin "^5.0.1" + immutable "^3.8.1" + minimist "^1.2.0" + needsquotes "^1.0.0" + transducers-js "^0.4.174" + typescript "^2.3.2" + json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" @@ -4582,6 +4601,10 @@ ncp@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" +needsquotes@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/needsquotes/-/needsquotes-1.0.0.tgz#f54f90ff2ad3f5c1fc90236804639f849b924fad" + negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" @@ -6796,6 +6819,10 @@ tough-cookie@~2.3.0, tough-cookie@~2.3.3: dependencies: punycode "^1.4.1" +transducers-js@^0.4.174: + version "0.4.174" + resolved "https://registry.yarnpkg.com/transducers-js/-/transducers-js-0.4.174.tgz#d5862c10eff4be3d3322abf6bb742e30f1bb6fc4" + transform-css-to-js@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/transform-css-to-js/-/transform-css-to-js-0.1.1.tgz#20fd40b137849555c063aa55f168680ad00724bb" @@ -6906,6 +6933,10 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +typescript@^2.3.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" + ua-parser-js@^0.7.9: version "0.7.17" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac"