@graphql-codegen/cli 2.9.1 → 2.10.1-alpha-ab1d4bbb7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/codegen.js CHANGED
@@ -302,6 +302,7 @@ async function executeCodegen(input) {
302
302
  clearOutput: false,
303
303
  collapse: true,
304
304
  },
305
+ renderer: config.verbose ? 'verbose' : 'default',
305
306
  ctx: { errors: [] },
306
307
  rendererSilent: isTest || config.silent,
307
308
  exitOnError: true,
@@ -318,6 +319,9 @@ async function executeCodegen(input) {
318
319
  newErr.stack = `${newErr.stack}\n\n${executedContext.errors.map(subErr => subErr.stack).join('\n\n')}`;
319
320
  throw newErr;
320
321
  }
322
+ if (config.debug) {
323
+ (0, debugging_js_1.printLogs)();
324
+ }
321
325
  return result;
322
326
  }
323
327
  exports.executeCodegen = executeCodegen;
package/cjs/config.js CHANGED
@@ -155,6 +155,18 @@ function buildOptions() {
155
155
  describe: 'Name of a project in GraphQL Config',
156
156
  type: 'string',
157
157
  },
158
+ v: {
159
+ alias: 'verbose',
160
+ describe: 'output more detailed information about performed tasks',
161
+ type: 'boolean',
162
+ default: false,
163
+ },
164
+ d: {
165
+ alias: 'debug',
166
+ describe: 'Print debug logs to stdout',
167
+ type: 'boolean',
168
+ default: false,
169
+ },
158
170
  };
159
171
  }
160
172
  exports.buildOptions = buildOptions;
package/cjs/hooks.js CHANGED
@@ -53,6 +53,7 @@ function execShellCommand(cmd) {
53
53
  reject(error);
54
54
  }
55
55
  else {
56
+ (0, debugging_js_1.debugLog)(stdout || stderr);
56
57
  resolve(stdout || stderr);
57
58
  }
58
59
  });
@@ -4,21 +4,17 @@ exports.resetLogs = exports.printLogs = exports.debugLog = void 0;
4
4
  const logger_js_1 = require("./logger.js");
5
5
  let queue = [];
6
6
  function debugLog(message, ...meta) {
7
- if (!process.env.GQL_CODEGEN_NODEBUG && process.env.DEBUG !== undefined) {
8
- queue.push({
9
- message,
10
- meta,
11
- });
12
- }
7
+ queue.push({
8
+ message,
9
+ meta,
10
+ });
13
11
  }
14
12
  exports.debugLog = debugLog;
15
13
  function printLogs() {
16
- if (!process.env.GQL_CODEGEN_NODEBUG && process.env.DEBUG !== undefined) {
17
- queue.forEach(log => {
18
- (0, logger_js_1.getLogger)().info(log.message, ...log.meta);
19
- });
20
- resetLogs();
21
- }
14
+ queue.forEach(log => {
15
+ (0, logger_js_1.getLogger)().info(log.message, ...log.meta);
16
+ });
17
+ resetLogs();
22
18
  }
23
19
  exports.printLogs = printLogs;
24
20
  function resetLogs() {
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLatestVersion = void 0;
4
- const cross_undici_fetch_1 = require("cross-undici-fetch");
4
+ const fetch_1 = require("@whatwg-node/fetch");
5
5
  /**
6
6
  * Fetches the version directly from the registry instead of depending on
7
7
  * an ESM only module as latest-version does.
8
8
  * @param packageName
9
9
  */
10
10
  async function getLatestVersion(packageName) {
11
- return (0, cross_undici_fetch_1.fetch)(`https://unpkg.com/${packageName}/package.json`)
11
+ return (0, fetch_1.fetch)(`https://unpkg.com/${packageName}/package.json`)
12
12
  .then(res => res.json())
13
13
  .then(pkg => pkg.version);
14
14
  }
package/esm/codegen.js CHANGED
@@ -4,7 +4,7 @@ import { AggregateError } from '@graphql-tools/utils';
4
4
  import { GraphQLError } from 'graphql';
5
5
  import { getPluginByName } from './plugins.js';
6
6
  import { getPresetByName } from './presets.js';
7
- import { debugLog } from './utils/debugging.js';
7
+ import { debugLog, printLogs } from './utils/debugging.js';
8
8
  import { ensureContext, shouldEmitLegacyCommonJSImports } from './config.js';
9
9
  import fs from 'fs';
10
10
  import path from 'path';
@@ -298,6 +298,7 @@ export async function executeCodegen(input) {
298
298
  clearOutput: false,
299
299
  collapse: true,
300
300
  },
301
+ renderer: config.verbose ? 'verbose' : 'default',
301
302
  ctx: { errors: [] },
302
303
  rendererSilent: isTest || config.silent,
303
304
  exitOnError: true,
@@ -314,5 +315,8 @@ export async function executeCodegen(input) {
314
315
  newErr.stack = `${newErr.stack}\n\n${executedContext.errors.map(subErr => subErr.stack).join('\n\n')}`;
315
316
  throw newErr;
316
317
  }
318
+ if (config.debug) {
319
+ printLogs();
320
+ }
317
321
  return result;
318
322
  }
package/esm/config.js CHANGED
@@ -148,6 +148,18 @@ export function buildOptions() {
148
148
  describe: 'Name of a project in GraphQL Config',
149
149
  type: 'string',
150
150
  },
151
+ v: {
152
+ alias: 'verbose',
153
+ describe: 'output more detailed information about performed tasks',
154
+ type: 'boolean',
155
+ default: false,
156
+ },
157
+ d: {
158
+ alias: 'debug',
159
+ describe: 'Print debug logs to stdout',
160
+ type: 'boolean',
161
+ default: false,
162
+ },
151
163
  };
152
164
  }
153
165
  export function parseArgv(argv = process.argv) {
package/esm/hooks.js CHANGED
@@ -50,6 +50,7 @@ function execShellCommand(cmd) {
50
50
  reject(error);
51
51
  }
52
52
  else {
53
+ debugLog(stdout || stderr);
53
54
  resolve(stdout || stderr);
54
55
  }
55
56
  });
@@ -1,20 +1,16 @@
1
1
  import { getLogger } from './logger.js';
2
2
  let queue = [];
3
3
  export function debugLog(message, ...meta) {
4
- if (!process.env.GQL_CODEGEN_NODEBUG && process.env.DEBUG !== undefined) {
5
- queue.push({
6
- message,
7
- meta,
8
- });
9
- }
4
+ queue.push({
5
+ message,
6
+ meta,
7
+ });
10
8
  }
11
9
  export function printLogs() {
12
- if (!process.env.GQL_CODEGEN_NODEBUG && process.env.DEBUG !== undefined) {
13
- queue.forEach(log => {
14
- getLogger().info(log.message, ...log.meta);
15
- });
16
- resetLogs();
17
- }
10
+ queue.forEach(log => {
11
+ getLogger().info(log.message, ...log.meta);
12
+ });
13
+ resetLogs();
18
14
  }
19
15
  export function resetLogs() {
20
16
  queue = [];
@@ -1,4 +1,4 @@
1
- import { fetch } from 'cross-undici-fetch';
1
+ import { fetch } from '@whatwg-node/fetch';
2
2
  /**
3
3
  * Fetches the version directly from the registry instead of depending on
4
4
  * an ESM only module as latest-version does.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@graphql-codegen/cli",
3
- "version": "2.9.1",
3
+ "version": "2.10.1-alpha-ab1d4bbb7.0",
4
4
  "peerDependencies": {
5
5
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
6
6
  },
7
7
  "dependencies": {
8
- "@graphql-codegen/core": "2.6.0",
9
- "@graphql-codegen/plugin-helpers": "^2.6.0",
8
+ "@graphql-codegen/core": "2.6.1-alpha-ab1d4bbb7.0",
9
+ "@graphql-codegen/plugin-helpers": "^2.6.1-alpha-ab1d4bbb7.0",
10
10
  "@graphql-tools/apollo-engine-loader": "^7.3.1",
11
11
  "@graphql-tools/code-file-loader": "^7.3.0",
12
12
  "@graphql-tools/git-loader": "^7.2.0",
@@ -17,11 +17,11 @@
17
17
  "@graphql-tools/prisma-loader": "^7.2.2",
18
18
  "@graphql-tools/url-loader": "^7.12.1",
19
19
  "@graphql-tools/utils": "^8.8.0",
20
+ "@whatwg-node/fetch": "^0.0.2",
20
21
  "ansi-escapes": "^4.3.1",
21
22
  "chalk": "^4.1.0",
22
23
  "chokidar": "^3.5.2",
23
24
  "cosmiconfig": "^7.0.0",
24
- "cross-undici-fetch": "^0.4.11",
25
25
  "debounce": "^1.2.0",
26
26
  "detect-indent": "^6.0.0",
27
27
  "graphql-config": "^4.3.1",
@@ -10,6 +10,8 @@ export declare type YamlCliFlags = {
10
10
  silent: boolean;
11
11
  errorsOnly: boolean;
12
12
  profile: boolean;
13
+ verbose?: boolean;
14
+ debug?: boolean;
13
15
  ignoreNoDocuments?: boolean;
14
16
  emitLegacyCommonJSImports?: boolean;
15
17
  };
@@ -86,6 +88,18 @@ export declare function buildOptions(): {
86
88
  describe: string;
87
89
  type: "string";
88
90
  };
91
+ v: {
92
+ alias: string;
93
+ describe: string;
94
+ type: "boolean";
95
+ default: boolean;
96
+ };
97
+ d: {
98
+ alias: string;
99
+ describe: string;
100
+ type: "boolean";
101
+ default: boolean;
102
+ };
89
103
  };
90
104
  export declare function parseArgv(argv?: string[]): YamlCliFlags;
91
105
  export declare function createContext(cliFlags?: YamlCliFlags): Promise<CodegenContext>;