@graphql-codegen/cli 2.10.0 → 2.10.1-alpha-b4880d326.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,7 +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
  }
321
- (0, debugging_js_1.printLogs)();
322
+ if (config.debug) {
323
+ (0, debugging_js_1.printLogs)();
324
+ }
322
325
  return result;
323
326
  }
324
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;
@@ -188,6 +200,12 @@ function updateContextWithCliFlags(context, cliFlags) {
188
200
  if (cliFlags.silent === true) {
189
201
  config.silent = cliFlags.silent;
190
202
  }
203
+ if (cliFlags.verbose === true) {
204
+ config.verbose = cliFlags.verbose;
205
+ }
206
+ if (cliFlags.debug === true) {
207
+ config.debug = cliFlags.debug;
208
+ }
191
209
  if (cliFlags.errorsOnly === true) {
192
210
  config.errorsOnly = cliFlags.errorsOnly;
193
211
  }
@@ -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() {
package/esm/codegen.js CHANGED
@@ -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,6 +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
  }
317
- printLogs();
318
+ if (config.debug) {
319
+ printLogs();
320
+ }
318
321
  return result;
319
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) {
@@ -178,6 +190,12 @@ export function updateContextWithCliFlags(context, cliFlags) {
178
190
  if (cliFlags.silent === true) {
179
191
  config.silent = cliFlags.silent;
180
192
  }
193
+ if (cliFlags.verbose === true) {
194
+ config.verbose = cliFlags.verbose;
195
+ }
196
+ if (cliFlags.debug === true) {
197
+ config.debug = cliFlags.debug;
198
+ }
181
199
  if (cliFlags.errorsOnly === true) {
182
200
  config.errorsOnly = cliFlags.errorsOnly;
183
201
  }
@@ -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 = [];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@graphql-codegen/cli",
3
- "version": "2.10.0",
3
+ "version": "2.10.1-alpha-b4880d326.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-b4880d326.0",
9
+ "@graphql-codegen/plugin-helpers": "^2.6.1-alpha-b4880d326.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",
@@ -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>;