1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.generate = void 0;
|
7 | const clientTasks_1 = require("./tasks/clientTasks");
|
8 | const schemaTask_1 = require("./tasks/schemaTask");
|
9 | const listr_1 = __importDefault(require("listr"));
|
10 | function generate(config) {
|
11 | if (!config.output) {
|
12 | throw new Error('`output` must be defined in the config');
|
13 | }
|
14 | return new listr_1.default([
|
15 | {
|
16 | title: `generating the client in \`${config.output}\``,
|
17 | task: () => new listr_1.default([(0, schemaTask_1.schemaTask)(config), ...(0, clientTasks_1.clientTasks)(config)]),
|
18 | },
|
19 | ], { renderer: config.verbose ? 'verbose' : 'silent', exitOnError: false })
|
20 | .run()
|
21 | .catch((e) => {
|
22 | var _a;
|
23 |
|
24 | throw (_a = e === null || e === void 0 ? void 0 : e.errors) === null || _a === void 0 ? void 0 : _a[0];
|
25 | });
|
26 | }
|
27 | exports.generate = generate;
|
28 |
|
\ | No newline at end of file |