graphql-codegen-modules-gen
Advanced tools
Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "graphql-codegen-modules-gen", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "", | ||
"scripts": { | ||
"test": "node ./src/cli /home/jycouet/udev/gh/my-minion-mr/packages/main/src/lib/modules", | ||
"test": "node ./src/cli ../sveltekit-yoga/packages/main/src/lib/modules", | ||
"build": "rollup --config ./rollup.config.js", | ||
@@ -8,0 +8,0 @@ "pack": "yarn pack", |
@@ -69,3 +69,3 @@ # Welcome to graphql-codegen-modules-gen 🔥 | ||
### ▶ Add it at the end of your usual @graphql-codegen | ||
### ▶ (Bonus) Execut it after your usual @graphql-codegen | ||
@@ -80,5 +80,7 @@ At the end of your `codegen.yml` file, add: | ||
or with a post hook. | ||
## ✨ Result | ||
A new folder named `_gen` with `resolvers.ts` and `typedefs.ts` containing everything needed in your `index.ts` file. | ||
In each module, a new folder named `_gen` with `resolvers.ts` and `typedefs.ts` containing everything needed for your `index.ts` file. | ||
@@ -143,2 +145,8 @@ ``` | ||
## Now, enjoy! 🔥 | ||
Now, enjoy! 🔥 | ||
# In Addition | ||
**Merge 1/** Generate your `resolvers.ts` and `typedefs.ts` files per module | ||
**Merge 2/** Generate global `_ctxModules.ts` (merge all `_ctxXXX.ts` of each modules) | ||
**Merge 3/** Generate global `_appModules.ts` (merge all `index.ts` of each modules) |
@@ -161,8 +161,7 @@ import { | ||
console.log( | ||
` ${getGreen("✔")} Merge -`, | ||
` ${getGreen("✔")} Merge 1/ `, | ||
`${getGreen(pad(typedefsFiles.length, 2))} Typedefs`, | ||
`|`, | ||
`${getGreen(pad(resolversFiles.length, 2))} Resolvers`, | ||
`-`, | ||
`Module [${getGreen(moduleName)}]` | ||
`for [${getGreen(moduleName)}]` | ||
); | ||
@@ -185,6 +184,6 @@ | ||
console.log( | ||
` ${getGreen("✔")} Merge done`, | ||
`[${getGreen(moduleNames.length)} modules]` | ||
); | ||
// console.log( | ||
// ` ${getGreen("✔")} Merge done`, | ||
// `[${getGreen(moduleNames.length)} modules]` | ||
// ); | ||
@@ -205,11 +204,6 @@ /******************* */ | ||
dataCtxModules.push(``); | ||
dataCtxModules.push( | ||
`// Do not type contextSoFar as it will to a circular reference` | ||
); | ||
dataCtxModules.push(`export function getCtxModules(contextSoFar: any) {`); | ||
dataCtxModules.push(`export function getCtxModules(prisma: any) {`); | ||
dataCtxModules.push(` return {`); | ||
ctxModules.forEach((ctx) => { | ||
dataCtxModules.push( | ||
` ...getCtx${toPascalCase(ctx.ctxName)}(contextSoFar.prisma),` | ||
); | ||
dataCtxModules.push(` ...getCtx${toPascalCase(ctx.ctxName)}(prisma),`); | ||
}); | ||
@@ -228,3 +222,5 @@ dataCtxModules.push(` };`); | ||
console.log( | ||
` ${getGreen("✔")} Merge contexts for`, | ||
` ${getGreen("✔")} Merge 2/ ${getGreen( | ||
pad(ctxModules.length, 2) | ||
)} contexts in ${getGreen("_gen/_ctxModules.ts")} for`, | ||
`[${ctxModules | ||
@@ -258,2 +254,9 @@ .map((c) => getGreen(c.moduleName + "#" + c.ctxName)) | ||
); | ||
console.log( | ||
` ${getGreen("✔")} Merge 3/ ${getGreen( | ||
pad(moduleNames.length, 2) | ||
)} modules in ${getGreen("_gen/_appModules.ts")} for`, | ||
`[${moduleNames.map((c) => getGreen(c)).join(",")}]` | ||
); | ||
} else { | ||
@@ -260,0 +263,0 @@ console.error(`❌ '${modulePath}' is not a valid folder path`); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21200
502
150