@graphql-codegen/cli 2.11.4 → 2.11.5
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 +4 -3
- package/cjs/load.js +1 -2
- package/esm/codegen.js +4 -3
- package/esm/load.js +1 -2
- package/package.json +1 -1
package/cjs/codegen.js
CHANGED
|
@@ -310,6 +310,10 @@ async function executeCodegen(input) {
|
|
|
310
310
|
// All the errors throw in `listr2` are collected in context
|
|
311
311
|
// Running tasks doesn't throw anything
|
|
312
312
|
const executedContext = await tasks.run();
|
|
313
|
+
if (config.debug) {
|
|
314
|
+
// if we have debug logs, make sure to print them before throwing the errors
|
|
315
|
+
(0, debugging_js_1.printLogs)();
|
|
316
|
+
}
|
|
313
317
|
if (executedContext.errors.length > 0) {
|
|
314
318
|
const errors = executedContext.errors.map(subErr => (0, plugin_helpers_1.isDetailedError)(subErr)
|
|
315
319
|
? `${subErr.message} for "${subErr.source}"${subErr.details}`
|
|
@@ -319,9 +323,6 @@ async function executeCodegen(input) {
|
|
|
319
323
|
newErr.stack = `${newErr.stack}\n\n${executedContext.errors.map(subErr => subErr.stack).join('\n\n')}`;
|
|
320
324
|
throw newErr;
|
|
321
325
|
}
|
|
322
|
-
if (config.debug) {
|
|
323
|
-
(0, debugging_js_1.printLogs)();
|
|
324
|
-
}
|
|
325
326
|
return result;
|
|
326
327
|
}
|
|
327
328
|
exports.executeCodegen = executeCodegen;
|
package/cjs/load.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadDocuments = exports.loadSchema = exports.defaultDocumentsLoadOptions = exports.defaultSchemaLoadOptions = void 0;
|
|
4
4
|
const load_1 = require("@graphql-tools/load");
|
|
5
|
-
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
6
5
|
const code_file_loader_1 = require("@graphql-tools/code-file-loader");
|
|
7
6
|
const git_loader_1 = require("@graphql-tools/git-loader");
|
|
8
7
|
const github_loader_1 = require("@graphql-tools/github-loader");
|
|
@@ -43,7 +42,7 @@ async function loadSchema(schemaPointers, config) {
|
|
|
43
42
|
return schema;
|
|
44
43
|
}
|
|
45
44
|
catch (e) {
|
|
46
|
-
throw new
|
|
45
|
+
throw new Error(`
|
|
47
46
|
Failed to load schema from ${Object.keys(schemaPointers).join(',')}:
|
|
48
47
|
|
|
49
48
|
${e.message || e}
|
package/esm/codegen.js
CHANGED
|
@@ -306,6 +306,10 @@ export async function executeCodegen(input) {
|
|
|
306
306
|
// All the errors throw in `listr2` are collected in context
|
|
307
307
|
// Running tasks doesn't throw anything
|
|
308
308
|
const executedContext = await tasks.run();
|
|
309
|
+
if (config.debug) {
|
|
310
|
+
// if we have debug logs, make sure to print them before throwing the errors
|
|
311
|
+
printLogs();
|
|
312
|
+
}
|
|
309
313
|
if (executedContext.errors.length > 0) {
|
|
310
314
|
const errors = executedContext.errors.map(subErr => isDetailedError(subErr)
|
|
311
315
|
? `${subErr.message} for "${subErr.source}"${subErr.details}`
|
|
@@ -315,8 +319,5 @@ export async function executeCodegen(input) {
|
|
|
315
319
|
newErr.stack = `${newErr.stack}\n\n${executedContext.errors.map(subErr => subErr.stack).join('\n\n')}`;
|
|
316
320
|
throw newErr;
|
|
317
321
|
}
|
|
318
|
-
if (config.debug) {
|
|
319
|
-
printLogs();
|
|
320
|
-
}
|
|
321
322
|
return result;
|
|
322
323
|
}
|
package/esm/load.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { loadSchema as loadSchemaToolkit, loadDocuments as loadDocumentsToolkit, } from '@graphql-tools/load';
|
|
2
|
-
import { DetailedError } from '@graphql-codegen/plugin-helpers';
|
|
3
2
|
import { CodeFileLoader } from '@graphql-tools/code-file-loader';
|
|
4
3
|
import { GitLoader } from '@graphql-tools/git-loader';
|
|
5
4
|
import { GithubLoader } from '@graphql-tools/github-loader';
|
|
@@ -40,7 +39,7 @@ export async function loadSchema(schemaPointers, config) {
|
|
|
40
39
|
return schema;
|
|
41
40
|
}
|
|
42
41
|
catch (e) {
|
|
43
|
-
throw new
|
|
42
|
+
throw new Error(`
|
|
44
43
|
Failed to load schema from ${Object.keys(schemaPointers).join(',')}:
|
|
45
44
|
|
|
46
45
|
${e.message || e}
|