1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const command_1 = require("@oclif/command");
|
4 | const colors = require("colors/safe");
|
5 | const fs = require("fs");
|
6 | const locator_1 = require("./utils/locator");
|
7 | const setup_config_1 = require("./utils/setup-config");
|
8 | const devPortal_1 = require("./utils/devPortal");
|
9 | class default_1 extends command_1.default {
|
10 | constructor() {
|
11 | super(...arguments);
|
12 | this.silent = false;
|
13 | }
|
14 | get locator() {
|
15 | return new locator_1.default(this.bearerConfig);
|
16 | }
|
17 | get colors() {
|
18 | return colors;
|
19 | }
|
20 | get integrationAuthConfig() {
|
21 | return require(this.locator.authConfigPath);
|
22 | }
|
23 | get hasViews() {
|
24 | return fs.existsSync(this.locator.srcViewsDir);
|
25 | }
|
26 | success(message) {
|
27 | this.log(this.colors.green(message));
|
28 | }
|
29 | log(_message, ..._args) {
|
30 | if (!this.silent) {
|
31 |
|
32 | super.log.apply(this, arguments);
|
33 | }
|
34 | }
|
35 | warn(_input) {
|
36 | if (!this.silent) {
|
37 |
|
38 | super.warn.apply(this, arguments);
|
39 | }
|
40 | }
|
41 | get devPortalClient() {
|
42 | return devPortal_1.devPortalClient(this);
|
43 | }
|
44 | get isIntegrationLocation() {
|
45 | return fs.existsSync(this.locator.authConfigPath);
|
46 | }
|
47 |
|
48 | async init() {
|
49 | const { flags } = this.parse(this.constructor);
|
50 | const path = flags.path || undefined;
|
51 | const { constants, config } = setup_config_1.default(path);
|
52 | this.bearerConfig = config;
|
53 | this.constants = constants;
|
54 | this.silent = flags.silent;
|
55 | }
|
56 | }
|
57 | default_1.flags = {
|
58 | help: command_1.flags.help({ char: 'h' }),
|
59 | path: command_1.flags.string({}),
|
60 | silent: command_1.flags.boolean({})
|
61 |
|
62 | };
|
63 | exports.default = default_1;
|