From cc18923d3a333268d8d7faae41fba626190ea0e2 Mon Sep 17 00:00:00 2001 From: Charly POLY <1252066+charlypoly@users.noreply.github.com> Date: Tue, 26 Jul 2022 16:57:23 +0200 Subject: [PATCH] feat(hooks): forward hooks logs to debug logs (#8142) * feat(hooks): forward hooks logs to debug logs * fix(cli): restore debug logs * Create weak-plants-hang.md --- .changeset/weak-plants-hang.md | 5 +++++ packages/graphql-codegen-cli/src/codegen.ts | 4 +++- packages/graphql-codegen-cli/src/hooks.ts | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/weak-plants-hang.md diff --git a/.changeset/weak-plants-hang.md b/.changeset/weak-plants-hang.md new file mode 100644 index 00000000000..c81faf21c50 --- /dev/null +++ b/.changeset/weak-plants-hang.md @@ -0,0 +1,5 @@ +--- +"@graphql-codegen/cli": patch +--- + +feat(hooks): forward hooks logs to debug logs diff --git a/packages/graphql-codegen-cli/src/codegen.ts b/packages/graphql-codegen-cli/src/codegen.ts index 75b4f5d55bd..fe57cca988e 100644 --- a/packages/graphql-codegen-cli/src/codegen.ts +++ b/packages/graphql-codegen-cli/src/codegen.ts @@ -15,7 +15,7 @@ import { AggregateError } from '@graphql-tools/utils'; import { GraphQLError, GraphQLSchema, DocumentNode } from 'graphql'; import { getPluginByName } from './plugins.js'; import { getPresetByName } from './presets.js'; -import { debugLog } from './utils/debugging.js'; +import { debugLog, printLogs } from './utils/debugging.js'; import { CodegenContext, ensureContext, shouldEmitLegacyCommonJSImports } from './config.js'; import fs from 'fs'; import path from 'path'; @@ -415,5 +415,7 @@ export async function executeCodegen(input: CodegenContext | Types.Config): Prom throw newErr; } + printLogs(); + return result; } diff --git a/packages/graphql-codegen-cli/src/hooks.ts b/packages/graphql-codegen-cli/src/hooks.ts index ee641525366..8bdc2922d46 100644 --- a/packages/graphql-codegen-cli/src/hooks.ts +++ b/packages/graphql-codegen-cli/src/hooks.ts @@ -59,6 +59,7 @@ function execShellCommand(cmd: string): Promise { if (error) { reject(error); } else { + debugLog(stdout || stderr); resolve(stdout || stderr); } }