1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const cli_1 = require("@graphql-codegen/cli");
|
4 | exports.plugin = {
|
5 | async init({ program, loadGraphQLConfig, reportError }) {
|
6 |
|
7 | cli_1.setCommandOptions(program
|
8 | .command('codegen'))
|
9 | .action(async (cliFlags) => {
|
10 | try {
|
11 |
|
12 | const graphqlConfig = await loadGraphQLConfig({
|
13 | extensions: [cli_1.CodegenExtension]
|
14 | });
|
15 |
|
16 | const codegenContext = new cli_1.CodegenContext({
|
17 | graphqlConfig: graphqlConfig,
|
18 | });
|
19 |
|
20 | cli_1.updateContextWithCliFlags(codegenContext, cliFlags);
|
21 | await cli_1.generate(codegenContext);
|
22 | }
|
23 | catch (e) {
|
24 | reportError(e);
|
25 | }
|
26 | });
|
27 | }
|
28 | };
|
29 |
|
\ | No newline at end of file |