1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const common_1 = require("@graphql-cli/common");
|
4 | const cli_1 = require("@graphql-codegen/cli");
|
5 | exports.default = (0, common_1.defineCommand)(api => {
|
6 | return {
|
7 | command: 'codegen',
|
8 | builder(yargs) {
|
9 | return yargs.options((0, cli_1.buildOptions)());
|
10 | },
|
11 | async handler(args) {
|
12 | const config = await api.useConfig({
|
13 | rootDir: args.config || process.cwd(),
|
14 | extensions: [cli_1.CodegenExtension],
|
15 | });
|
16 |
|
17 | const codegenContext = new cli_1.CodegenContext({
|
18 | graphqlConfig: config,
|
19 | });
|
20 |
|
21 | (0, cli_1.updateContextWithCliFlags)(codegenContext, args);
|
22 | await (0, cli_1.generate)(codegenContext);
|
23 | },
|
24 | };
|
25 | });
|