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); } }