UNPKG

1.12 kBJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6exports.generate = void 0;
7const clientTasks_1 = require("./tasks/clientTasks");
8const schemaTask_1 = require("./tasks/schemaTask");
9const listr_1 = __importDefault(require("listr"));
10function 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 // console.log(e)
24 throw (_a = e === null || e === void 0 ? void 0 : e.errors) === null || _a === void 0 ? void 0 : _a[0];
25 });
26}
27exports.generate = generate;
28//# sourceMappingURL=main.js.map
\No newline at end of file