mirror of
https://github.com/ritz078/transform.git
synced 2026-12-04 22:04:31 +03:00
feat(graphql): added json to graphql transform (#111)
* feat(graphql): added json to graphql transform * added package url
This commit is contained in:
1 parent
655761ee31
commit
88f8bab8c6
24 files changed
+142
-162
No files matched your search
@@ -20,9 +20,24 @@ const plugins = [
|
||||
require("prettier/parser-typescript")
|
||||
];
|
||||
|
||||
const supportedLanguages = [
|
||||
"json",
|
||||
"babylon",
|
||||
"html",
|
||||
"postcss",
|
||||
"graphql",
|
||||
"markdown",
|
||||
"yaml",
|
||||
"typescript",
|
||||
"flow",
|
||||
...Object.keys(prettierParsers)
|
||||
];
|
||||
|
||||
export async function prettify(language: string, value: string) {
|
||||
let result;
|
||||
|
||||
if (!supportedLanguages.includes(language)) return value;
|
||||
|
||||
if (language === "json") {
|
||||
result = JSON.stringify(JSON.parse(value), null, 2);
|
||||
} else {
|
||||
|
||||
+12
-5
@@ -42,6 +42,13 @@ export const categorizedRoutes = [
|
||||
label: "to Flow",
|
||||
path: "/json-to-flow"
|
||||
},
|
||||
{
|
||||
label: "to GraphQL",
|
||||
path: "/json-to-graphql",
|
||||
packageName: "@walmartlabs/json-to-simple-graphql-schema",
|
||||
packageUrl:
|
||||
"https://github.com/walmartlabs/json-to-simple-graphql-schema"
|
||||
},
|
||||
{
|
||||
label: "to TypeScript",
|
||||
path: "/json-to-typescript"
|
||||
@@ -200,23 +207,23 @@ export const categorizedRoutes = [
|
||||
content: [
|
||||
{
|
||||
label: "to N-Quads",
|
||||
path: "jsonld-to-nquads"
|
||||
path: "/jsonld-to-nquads"
|
||||
},
|
||||
{
|
||||
label: "to Expanded",
|
||||
path: "jsonld-to-expanded"
|
||||
path: "/jsonld-to-expanded"
|
||||
},
|
||||
{
|
||||
label: "to Compacted",
|
||||
path: "jsonld-to-compacted"
|
||||
path: "/jsonld-to-compacted"
|
||||
},
|
||||
{
|
||||
label: "to Flattened",
|
||||
path: "jsonld-to-flattened"
|
||||
path: "/jsonld-to-flattened"
|
||||
},
|
||||
{
|
||||
label: "to Framed",
|
||||
path: "jsonld-to-framed"
|
||||
path: "/jsonld-to-framed"
|
||||
},
|
||||
{
|
||||
label: "to Normalized",
|
||||
|
||||
Reference in new issue
Block a user