From 1c6731897b8d8c2a9d8b56d08a8dbfe3f6441f8e Mon Sep 17 00:00:00 2001 From: Scott Tolinski Date: Mon, 15 Nov 2021 16:10:40 -0700 Subject: [PATCH] changes gGenerated to gq --- README.md | 12 ++++++------ codegen/plugin.js | 10 +++++----- codegen/plugin.js.map | 2 +- codegen/plugin.ts | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 6c715a5..1c28255 100644 --- a/README.md +++ b/README.md @@ -52,14 +52,14 @@ query user { ### 4. Use that thang -The code gen will find the file and spit out a file next to it. Named `FileName.gGenerated.ts` -Using the above code, it would output `UserQueries.gGenerated.ts` +The code gen will find the file and spit out a file next to it. Named `FileName.gq.ts` +Using the above code, it would output `UserQueries.gq.ts` This also gives us a `get` function for queries based on the query name. ie `getUser` for the above. ```svelte @@ -87,7 +87,7 @@ This also gives us a `get` function for queries based on the query name. ie `get It's a Svelte Writable Store. So after a mutation you can quickly and easily manually update the cache. ```javascript -import { user, someMutation } from "./UserQueries.gGenerated.graphql"; +import { user, someMutation } from "./UserQueries.gq.graphql"; $user.user = null; // clears the cache @@ -99,7 +99,7 @@ $user.user = await someMutation({ variables }); // if this returns the correct d Maybe? If you want to be in charge of writing that bit, the door is open 😼. My idea for the api would look something like this. ```javascript -import { user, someMutation } from "./UserQueries.gGenerated.graphql"; +import { user, someMutation } from "./UserQueries.gq.graphql"; await someMutation({ variables, store: user }); ``` diff --git a/codegen/plugin.js b/codegen/plugin.js index d4fa73e..ff915b2 100644 --- a/codegen/plugin.js +++ b/codegen/plugin.js @@ -16,15 +16,15 @@ export default function levelupViteCodegen(options) { name: "g-query-codegen", async buildStart() { try { - // *1. Remove all .gGenerated files - // TODO: Find and remove all .gGenerated files + // *1. Remove all .gq files + // TODO: Find and remove all .gq files // *2. Generate await generate({ schema, documents: "./src/**/*.graphql", generates: { // * Generates the types for your schema - [`${process.cwd()}/${output}/types.gGenerated.ts`]: { + [`${process.cwd()}/${output}/types.gq.ts`]: { plugins: ["typescript"], }, // * Generates near file .ts files for your fetch functions @@ -37,9 +37,9 @@ export default function levelupViteCodegen(options) { }, preset: "near-operation-file", presetConfig: { - extension: ".gGenerated.ts", + extension: ".gq.ts", folder: "./", - baseTypesPath: `types.gGenerated.ts`, + baseTypesPath: `types.gq.ts`, }, plugins: [ "typescript-operations", diff --git a/codegen/plugin.js.map b/codegen/plugin.js.map index dcadc06..fce0aa5 100644 --- a/codegen/plugin.js.map +++ b/codegen/plugin.js.map @@ -1 +1 @@ -{"version":3,"file":"plugin.js","sourceRoot":"","sources":["plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,uCAAuC;AAEzE,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,OAAO;IAChD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KACvC;IACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAClB,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;KACH;IAED,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE1C,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC9B,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,KAAK,CAAC,UAAU;YACd,IAAI;gBACF,qCAAqC;gBACrC,8CAA8C;gBAC9C,iBAAiB;gBAEjB,MAAM,QAAQ,CACZ;oBACE,MAAM;oBACN,SAAS,EAAE,oBAAoB;oBAC/B,SAAS,EAAE;wBACT,wCAAwC;wBACxC,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,MAAM,sBAAsB,CAAC,EAAE;4BAClD,OAAO,EAAE,CAAC,YAAY,CAAC;yBACxB;wBACD,2DAA2D;wBAC3D,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,MAAM,EAAE,CAAC,EAAE;4BAC9B,MAAM,EAAE;gCACN,cAAc,EAAE,IAAI;gCACpB,KAAK;gCACL,gCAAgC,EAAE,qBAAqB;gCACvD,mBAAmB,EAAE,SAAS;6BAC/B;4BACD,MAAM,EAAE,qBAAqB;4BAC7B,YAAY,EAAE;gCACZ,SAAS,EAAE,gBAAgB;gCAC3B,MAAM,EAAE,IAAI;gCACZ,aAAa,EAAE,qBAAqB;6BACrC;4BACD,OAAO,EAAE;gCACP,uBAAuB;gCACvB,qCAAqC,EAAE,0BAA0B;6BAClE;yBACF;qBACF;iBACF,EACD,IAAI,CACL,CAAC;aACH;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;gBAC7D,OAAO,CAAC,GAAG,CACT,0FAA0F,CAC3F,CAAC;gBACF,OAAO,CAAC,GAAG,CACT,uFAAuF,CACxF,CAAC;aACH;YACD,OAAO;QACT,CAAC;QAED,SAAS,CAAC,GAAG,EAAE,EAAE,IAAG,CAAC;KACtB,CAAC;AACJ,CAAC"} \ No newline at end of file +{"version":3,"file":"plugin.js","sourceRoot":"","sources":["plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,uCAAuC;AAEzE,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,OAAO;IAChD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KACvC;IACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,IAAI,CAAC,OAA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E,IAAG,CAAC;KACtB,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/codegen/plugin.ts b/codegen/plugin.ts index 41afbd4..d769dc4 100644 --- a/codegen/plugin.ts +++ b/codegen/plugin.ts @@ -21,8 +21,8 @@ export default function levelupViteCodegen(options) { name: "g-query-codegen", async buildStart() { try { - // *1. Remove all .gGenerated files - // TODO: Find and remove all .gGenerated files + // *1. Remove all .gq files + // TODO: Find and remove all .gq files // *2. Generate await generate( @@ -31,7 +31,7 @@ export default function levelupViteCodegen(options) { documents: "./src/**/*.graphql", generates: { // * Generates the types for your schema - [`${process.cwd()}/${output}/types.gGenerated.ts`]: { + [`${process.cwd()}/${output}/types.gq.ts`]: { plugins: ["typescript"], }, // * Generates near file .ts files for your fetch functions @@ -44,9 +44,9 @@ export default function levelupViteCodegen(options) { }, preset: "near-operation-file", presetConfig: { - extension: ".gGenerated.ts", + extension: ".gq.ts", folder: "./", - baseTypesPath: `types.gGenerated.ts`, + baseTypesPath: `types.gq.ts`, }, plugins: [ "typescript-operations", // operations, gets you types for operations (queries and mutations)