1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const tslib_1 = require("tslib");
|
4 | const Debug = require("debug");
|
5 | class Ailment {
|
6 | constructor({ client, config, log, project, shell, session }) {
|
7 | this.projects = undefined;
|
8 | this.implicit = true;
|
9 | this.client = client;
|
10 | this.config = config;
|
11 | this.log = log;
|
12 | this.project = project;
|
13 | this.shell = shell;
|
14 | this.session = session;
|
15 | }
|
16 | get debug() {
|
17 | if (!this._debug) {
|
18 | this._debug = Debug(`ionic:cli-utils:lib:doctor:ailments:${this.id}`);
|
19 | }
|
20 | return this._debug;
|
21 | }
|
22 | getLocalPackageJson(pkgName) {
|
23 | return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
24 | try {
|
25 | return yield this.project.requirePackageJson(pkgName);
|
26 | }
|
27 | catch (e) {
|
28 | if (e.fatal) {
|
29 | throw e;
|
30 | }
|
31 | }
|
32 | });
|
33 | }
|
34 | }
|
35 | exports.Ailment = Ailment;
|
36 | class AilmentRegistry {
|
37 | constructor() {
|
38 | this._ailments = [];
|
39 | }
|
40 | register(ailment) {
|
41 | this._ailments.push(ailment);
|
42 | }
|
43 | get ailments() {
|
44 | return this._ailments;
|
45 | }
|
46 | get(id) {
|
47 | return this._ailments.find(a => a.id === id);
|
48 | }
|
49 | }
|
50 | exports.AilmentRegistry = AilmentRegistry;
|