@teambit/doctor 0.0.0-00997c6fe4e832b4e5a012dc136eed546275ebcb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core-diagnoses/broken-symlink-files.ts +78 -0
- package/core-diagnoses/orphan-symlink-objects.ts +50 -0
- package/core-diagnoses/validate-bit-version.ts +55 -0
- package/core-diagnoses/validate-git-exec.ts +39 -0
- package/core-diagnoses/validate-npm-exec.ts +41 -0
- package/core-diagnoses/validate-scope-objects.ts +83 -0
- package/core-diagnoses/validate-workspace-bit-json-syntax.ts +36 -0
- package/core-diagnoses/validate-yarn-exec.ts +41 -0
- package/dist/core-diagnoses/broken-symlink-files.d.ts +16 -0
- package/dist/core-diagnoses/broken-symlink-files.js +126 -0
- package/dist/core-diagnoses/broken-symlink-files.js.map +1 -0
- package/dist/core-diagnoses/orphan-symlink-objects.d.ts +11 -0
- package/dist/core-diagnoses/orphan-symlink-objects.js +82 -0
- package/dist/core-diagnoses/orphan-symlink-objects.js.map +1 -0
- package/dist/core-diagnoses/validate-bit-version.d.ts +10 -0
- package/dist/core-diagnoses/validate-bit-version.js +92 -0
- package/dist/core-diagnoses/validate-bit-version.js.map +1 -0
- package/dist/core-diagnoses/validate-git-exec.d.ts +11 -0
- package/dist/core-diagnoses/validate-git-exec.js +68 -0
- package/dist/core-diagnoses/validate-git-exec.js.map +1 -0
- package/dist/core-diagnoses/validate-npm-exec.d.ts +11 -0
- package/dist/core-diagnoses/validate-npm-exec.js +73 -0
- package/dist/core-diagnoses/validate-npm-exec.js.map +1 -0
- package/dist/core-diagnoses/validate-scope-objects.d.ts +11 -0
- package/dist/core-diagnoses/validate-scope-objects.js +113 -0
- package/dist/core-diagnoses/validate-scope-objects.js.map +1 -0
- package/dist/core-diagnoses/validate-workspace-bit-json-syntax.d.ts +10 -0
- package/dist/core-diagnoses/validate-workspace-bit-json-syntax.js +66 -0
- package/dist/core-diagnoses/validate-workspace-bit-json-syntax.js.map +1 -0
- package/dist/core-diagnoses/validate-yarn-exec.d.ts +11 -0
- package/dist/core-diagnoses/validate-yarn-exec.js +72 -0
- package/dist/core-diagnoses/validate-yarn-exec.js.map +1 -0
- package/dist/diagnosis-list-template.d.ts +2 -0
- package/dist/diagnosis-list-template.js +42 -0
- package/dist/diagnosis-list-template.js.map +1 -0
- package/dist/diagnosis.d.ts +41 -0
- package/dist/diagnosis.js +70 -0
- package/dist/diagnosis.js.map +1 -0
- package/dist/doctor-cmd.d.ts +26 -0
- package/dist/doctor-cmd.js +122 -0
- package/dist/doctor-cmd.js.map +1 -0
- package/dist/doctor-context.d.ts +49 -0
- package/dist/doctor-context.js +69 -0
- package/dist/doctor-context.js.map +1 -0
- package/dist/doctor-registrar-builder.d.ts +2 -0
- package/dist/doctor-registrar-builder.js +76 -0
- package/dist/doctor-registrar-builder.js.map +1 -0
- package/dist/doctor-registrar.d.ts +21 -0
- package/dist/doctor-registrar.js +62 -0
- package/dist/doctor-registrar.js.map +1 -0
- package/dist/doctor-results-template.d.ts +2 -0
- package/dist/doctor-results-template.js +115 -0
- package/dist/doctor-results-template.js.map +1 -0
- package/dist/doctor.aspect.d.ts +2 -0
- package/dist/doctor.aspect.js +18 -0
- package/dist/doctor.aspect.js.map +1 -0
- package/dist/doctor.graphql.d.ts +3 -0
- package/dist/doctor.graphql.js +74 -0
- package/dist/doctor.graphql.js.map +1 -0
- package/dist/doctor.main.runtime.d.ts +63 -0
- package/dist/doctor.main.runtime.js +524 -0
- package/dist/doctor.main.runtime.js.map +1 -0
- package/dist/esm.mjs +8 -0
- package/dist/exceptions/diagnosis-not-found.d.ts +5 -0
- package/dist/exceptions/diagnosis-not-found.js +30 -0
- package/dist/exceptions/diagnosis-not-found.js.map +1 -0
- package/dist/exceptions/missing-diagnosis-name.d.ts +4 -0
- package/dist/exceptions/missing-diagnosis-name.js +21 -0
- package/dist/exceptions/missing-diagnosis-name.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/preview-1764777197370.js +7 -0
- package/dist/run-doctor-on-scope.d.ts +3 -0
- package/dist/run-doctor-on-scope.js +140 -0
- package/dist/run-doctor-on-scope.js.map +1 -0
- package/esm.mjs +8 -0
- package/exceptions/diagnosis-not-found.ts +8 -0
- package/exceptions/missing-diagnosis-name.ts +7 -0
- package/package.json +85 -0
- package/types/asset.d.ts +41 -0
- package/types/style.d.ts +42 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.getYarnVersion = getYarnVersion;
|
|
8
|
+
function _execa() {
|
|
9
|
+
const data = _interopRequireDefault(require("execa"));
|
|
10
|
+
_execa = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _legacy() {
|
|
16
|
+
const data = require("@teambit/legacy.logger");
|
|
17
|
+
_legacy = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _diagnosis() {
|
|
23
|
+
const data = _interopRequireDefault(require("../diagnosis"));
|
|
24
|
+
_diagnosis = function () {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
31
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
32
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
33
|
+
class ValidateYarnExec extends _diagnosis().default {
|
|
34
|
+
constructor(...args) {
|
|
35
|
+
super(...args);
|
|
36
|
+
_defineProperty(this, "name", 'validate yarn exec');
|
|
37
|
+
_defineProperty(this, "description", 'validate that yarn executable found');
|
|
38
|
+
_defineProperty(this, "category", 'vendors');
|
|
39
|
+
}
|
|
40
|
+
_formatSymptoms() {
|
|
41
|
+
return 'yarn executable not found';
|
|
42
|
+
}
|
|
43
|
+
_formatManualTreat() {
|
|
44
|
+
return 'please ensure yarn is installed';
|
|
45
|
+
}
|
|
46
|
+
async _runExamine() {
|
|
47
|
+
const yarnVersion = await getYarnVersion();
|
|
48
|
+
if (yarnVersion) {
|
|
49
|
+
return {
|
|
50
|
+
valid: true
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
valid: false,
|
|
55
|
+
data: {}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.default = ValidateYarnExec;
|
|
60
|
+
async function getYarnVersion() {
|
|
61
|
+
try {
|
|
62
|
+
const {
|
|
63
|
+
stdout
|
|
64
|
+
} = await (0, _execa().default)('yarn', ['-v']);
|
|
65
|
+
return stdout;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
_legacy().logger.debugAndAddBreadCrumb('npm-client', `can't find yarn version by running yarn -v. ${e.message}`);
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=validate-yarn-exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_execa","data","_interopRequireDefault","require","_legacy","_diagnosis","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ValidateYarnExec","Diagnosis","constructor","args","_formatSymptoms","_formatManualTreat","_runExamine","yarnVersion","getYarnVersion","valid","exports","stdout","execa","logger","debugAndAddBreadCrumb","message"],"sources":["validate-yarn-exec.ts"],"sourcesContent":["import execa from 'execa';\nimport { logger } from '@teambit/legacy.logger';\nimport type { ExamineBareResult } from '../diagnosis';\nimport Diagnosis from '../diagnosis';\n\nexport default class ValidateYarnExec extends Diagnosis {\n name = 'validate yarn exec';\n description = 'validate that yarn executable found';\n category = 'vendors';\n\n _formatSymptoms(): string {\n return 'yarn executable not found';\n }\n\n _formatManualTreat() {\n return 'please ensure yarn is installed';\n }\n\n async _runExamine(): Promise<ExamineBareResult> {\n const yarnVersion = await getYarnVersion();\n if (yarnVersion) {\n return {\n valid: true,\n };\n }\n return {\n valid: false,\n data: {},\n };\n }\n}\n\nexport async function getYarnVersion(): Promise<string | null | undefined> {\n try {\n const { stdout } = await execa('yarn', ['-v']);\n return stdout;\n } catch (e: any) {\n logger.debugAndAddBreadCrumb('npm-client', `can't find yarn version by running yarn -v. ${e.message}`);\n }\n return null;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqC,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,C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AA,GAAAmB,gBAAA;AAEM,eAAeQ,cAAcA,CAAA,EAAuC;EACzE,IAAI;IACF,MAAM;MAAEG;IAAO,CAAC,GAAG,MAAM,IAAAC,gBAAK,EAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAOD,MAAM;EACf,CAAC,CAAC,OAAOhC,CAAM,EAAE;IACfkC,gBAAM,CAACC,qBAAqB,CAAC,YAAY,EAAE,+CAA+CnC,CAAC,CAACoC,OAAO,EAAE,CAAC;EACxG;EACA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = formatDiagnosesList;
|
|
7
|
+
function _chalk() {
|
|
8
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
9
|
+
_chalk = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _table() {
|
|
15
|
+
const data = require("table");
|
|
16
|
+
_table = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
// const NAME_COLUMN_WIDTH = 100;
|
|
23
|
+
// const DESCRIPTION_COLUMN_WIDTH = 30;
|
|
24
|
+
|
|
25
|
+
const tableColumnConfig = {
|
|
26
|
+
columnDefault: {
|
|
27
|
+
alignment: 'left'
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
function createRow(diagnosis) {
|
|
31
|
+
return [diagnosis.category, diagnosis.name, diagnosis.description];
|
|
32
|
+
}
|
|
33
|
+
function formatDiagnosesList(diagnosesList) {
|
|
34
|
+
const header = [_chalk().default.bold('category'), _chalk().default.bold('name'), _chalk().default.bold('description')];
|
|
35
|
+
const rows = diagnosesList.map(createRow);
|
|
36
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
37
|
+
rows.unshift(header);
|
|
38
|
+
const output = (0, _table().table)(rows, tableColumnConfig);
|
|
39
|
+
return output;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=diagnosis-list-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_table","e","__esModule","default","tableColumnConfig","columnDefault","alignment","createRow","diagnosis","category","name","description","formatDiagnosesList","diagnosesList","header","chalk","bold","rows","map","unshift","output","table"],"sources":["diagnosis-list-template.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { table } from 'table';\nimport type { Alignment } from 'table';\n\nimport type Diagnosis from './diagnosis';\n\n// const NAME_COLUMN_WIDTH = 100;\n// const DESCRIPTION_COLUMN_WIDTH = 30;\n\nconst tableColumnConfig = {\n columnDefault: {\n alignment: 'left' as Alignment,\n },\n};\n\ntype DiagnosisRow = [string, string, string];\n\nfunction createRow(diagnosis: Diagnosis): DiagnosisRow {\n return [diagnosis.category, diagnosis.name, diagnosis.description];\n}\n\nexport default function formatDiagnosesList(diagnosesList: Diagnosis[]): string {\n const header = [chalk.bold('category'), chalk.bold('name'), chalk.bold('description')];\n const rows = diagnosesList.map(createRow);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n rows.unshift(header);\n const output = table(rows, tableColumnConfig);\n return output;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8B,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK9B;AACA;;AAEA,MAAMG,iBAAiB,GAAG;EACxBC,aAAa,EAAE;IACbC,SAAS,EAAE;EACb;AACF,CAAC;AAID,SAASC,SAASA,CAACC,SAAoB,EAAgB;EACrD,OAAO,CAACA,SAAS,CAACC,QAAQ,EAAED,SAAS,CAACE,IAAI,EAAEF,SAAS,CAACG,WAAW,CAAC;AACpE;AAEe,SAASC,mBAAmBA,CAACC,aAA0B,EAAU;EAC9E,MAAMC,MAAM,GAAG,CAACC,gBAAK,CAACC,IAAI,CAAC,UAAU,CAAC,EAAED,gBAAK,CAACC,IAAI,CAAC,MAAM,CAAC,EAAED,gBAAK,CAACC,IAAI,CAAC,aAAa,CAAC,CAAC;EACtF,MAAMC,IAAI,GAAGJ,aAAa,CAACK,GAAG,CAACX,SAAS,CAAC;EACzC;EACAU,IAAI,CAACE,OAAO,CAACL,MAAM,CAAC;EACpB,MAAMM,MAAM,GAAG,IAAAC,cAAK,EAACJ,IAAI,EAAEb,iBAAiB,CAAC;EAC7C,OAAOgB,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type ExamineBareResult = {
|
|
2
|
+
valid: boolean;
|
|
3
|
+
data?: Record<string, any>;
|
|
4
|
+
};
|
|
5
|
+
export type DiagnosisMetaData = {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
category: string;
|
|
9
|
+
};
|
|
10
|
+
export type ExamineResult = {
|
|
11
|
+
diagnosisMetaData: DiagnosisMetaData;
|
|
12
|
+
bareResult: ExamineBareResult;
|
|
13
|
+
formattedSymptoms: string;
|
|
14
|
+
formattedManualTreat: string;
|
|
15
|
+
};
|
|
16
|
+
export default class Diagnosis {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
category: string;
|
|
20
|
+
result: Record<string, any>;
|
|
21
|
+
/**
|
|
22
|
+
* A function that actually runs the examination
|
|
23
|
+
*/
|
|
24
|
+
_runExamine(): Promise<ExamineBareResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a descriptive symptoms message which might include specific data from the examination
|
|
27
|
+
* @param bareResult ExamineBareResult
|
|
28
|
+
*/
|
|
29
|
+
_formatSymptoms(bareResult: ExamineBareResult): string;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a descriptive instruction to handle the issue (might include specific data from the examination)
|
|
32
|
+
* @param bareResult ExamineBareResult
|
|
33
|
+
*/
|
|
34
|
+
_formatManualTreat(bareResult: ExamineBareResult): string;
|
|
35
|
+
getMeta(): {
|
|
36
|
+
category: string;
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
examine(): Promise<ExamineResult>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
class Diagnosis {
|
|
11
|
+
constructor() {
|
|
12
|
+
_defineProperty(this, "name", void 0);
|
|
13
|
+
_defineProperty(this, "description", void 0);
|
|
14
|
+
_defineProperty(this, "category", void 0);
|
|
15
|
+
_defineProperty(this, "result", void 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A function that actually runs the examination
|
|
19
|
+
*/
|
|
20
|
+
async _runExamine() {
|
|
21
|
+
throw new Error('You must implement this method');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns a descriptive symptoms message which might include specific data from the examination
|
|
26
|
+
* @param bareResult ExamineBareResult
|
|
27
|
+
*/
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
+
_formatSymptoms(bareResult) {
|
|
30
|
+
throw new Error('You must implement this method');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Returns a descriptive instruction to handle the issue (might include specific data from the examination)
|
|
35
|
+
* @param bareResult ExamineBareResult
|
|
36
|
+
*/
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
|
+
_formatManualTreat(bareResult) {
|
|
39
|
+
throw new Error('You must implement this method');
|
|
40
|
+
}
|
|
41
|
+
getMeta() {
|
|
42
|
+
return {
|
|
43
|
+
category: this.category,
|
|
44
|
+
name: this.name,
|
|
45
|
+
description: this.description
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async examine() {
|
|
49
|
+
const bareResult = await this._runExamine();
|
|
50
|
+
if (bareResult.valid) {
|
|
51
|
+
return {
|
|
52
|
+
diagnosisMetaData: this.getMeta(),
|
|
53
|
+
bareResult,
|
|
54
|
+
formattedSymptoms: '',
|
|
55
|
+
formattedManualTreat: ''
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const formattedSymptoms = this._formatSymptoms(bareResult);
|
|
59
|
+
const formattedManualTreat = this._formatManualTreat(bareResult);
|
|
60
|
+
return {
|
|
61
|
+
diagnosisMetaData: this.getMeta(),
|
|
62
|
+
bareResult,
|
|
63
|
+
formattedSymptoms,
|
|
64
|
+
formattedManualTreat
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.default = Diagnosis;
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=diagnosis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Diagnosis","constructor","_defineProperty","_runExamine","Error","_formatSymptoms","bareResult","_formatManualTreat","getMeta","category","name","description","examine","valid","diagnosisMetaData","formattedSymptoms","formattedManualTreat","exports","default"],"sources":["diagnosis.ts"],"sourcesContent":["export type ExamineBareResult = {\n valid: boolean;\n data?: Record<string, any>;\n};\n\nexport type DiagnosisMetaData = {\n name: string;\n description: string;\n category: string;\n};\n\nexport type ExamineResult = {\n diagnosisMetaData: DiagnosisMetaData;\n bareResult: ExamineBareResult;\n formattedSymptoms: string; // A human readable of the found issues\n formattedManualTreat: string; // human readable steps to fix\n};\n\nexport default class Diagnosis {\n name: string;\n description: string;\n category: string;\n result: Record<string, any>;\n\n /**\n * A function that actually runs the examination\n */\n async _runExamine(): Promise<ExamineBareResult> {\n throw new Error('You must implement this method');\n }\n\n /**\n * Returns a descriptive symptoms message which might include specific data from the examination\n * @param bareResult ExamineBareResult\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _formatSymptoms(bareResult: ExamineBareResult): string {\n throw new Error('You must implement this method');\n }\n\n /**\n * Returns a descriptive instruction to handle the issue (might include specific data from the examination)\n * @param bareResult ExamineBareResult\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _formatManualTreat(bareResult: ExamineBareResult): string {\n throw new Error('You must implement this method');\n }\n\n getMeta() {\n return {\n category: this.category,\n name: this.name,\n description: this.description,\n };\n }\n\n async examine(): Promise<ExamineResult> {\n const bareResult = await this._runExamine();\n if (bareResult.valid) {\n return {\n diagnosisMetaData: this.getMeta(),\n bareResult,\n formattedSymptoms: '',\n formattedManualTreat: '',\n };\n }\n const formattedSymptoms = this._formatSymptoms(bareResult);\n const formattedManualTreat = this._formatManualTreat(bareResult);\n return {\n diagnosisMetaData: this.getMeta(),\n bareResult,\n formattedSymptoms,\n formattedManualTre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
import type { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import type { DoctorMain } from './doctor.main.runtime';
|
|
3
|
+
type Flags = {
|
|
4
|
+
list?: boolean;
|
|
5
|
+
save?: string;
|
|
6
|
+
archive?: string;
|
|
7
|
+
includeNodeModules?: boolean;
|
|
8
|
+
includePublic?: boolean;
|
|
9
|
+
excludeLocalScope?: boolean;
|
|
10
|
+
remote?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class DoctorCmd implements Command {
|
|
13
|
+
private doctor;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
extendedDescription: string;
|
|
17
|
+
group: string;
|
|
18
|
+
alias: string;
|
|
19
|
+
loadAspects: boolean;
|
|
20
|
+
options: CommandOptions;
|
|
21
|
+
constructor(doctor: DoctorMain);
|
|
22
|
+
report([diagnosisName]: string[], flags: Flags): Promise<string>;
|
|
23
|
+
json([diagnosisName]: string[], flags: Flags): Promise<any>;
|
|
24
|
+
private runDiag;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DoctorCmd = void 0;
|
|
7
|
+
function _diagnosisListTemplate() {
|
|
8
|
+
const data = _interopRequireDefault(require("./diagnosis-list-template"));
|
|
9
|
+
_diagnosisListTemplate = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _doctorResultsTemplate() {
|
|
15
|
+
const data = _interopRequireDefault(require("./doctor-results-template"));
|
|
16
|
+
_doctorResultsTemplate = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
|
+
class DoctorCmd {
|
|
26
|
+
constructor(doctor) {
|
|
27
|
+
this.doctor = doctor;
|
|
28
|
+
_defineProperty(this, "name", 'doctor [diagnosis-name]');
|
|
29
|
+
_defineProperty(this, "description", 'diagnose and troubleshoot workspace issues');
|
|
30
|
+
_defineProperty(this, "extendedDescription", `runs comprehensive health checks on your workspace to detect and report configuration problems,
|
|
31
|
+
missing dependencies, corrupted data, and other issues that may affect workspace functionality.
|
|
32
|
+
can generate diagnostic reports and workspace archives for debugging and support purposes.`);
|
|
33
|
+
_defineProperty(this, "group", 'system');
|
|
34
|
+
_defineProperty(this, "alias", '');
|
|
35
|
+
_defineProperty(this, "loadAspects", false);
|
|
36
|
+
_defineProperty(this, "options", [['j', 'json', 'return diagnoses in json format'], ['', 'list', 'list all available diagnoses'], ['s', 'save [filePath]', 'save diagnoses to a file'], ['a', 'archive [filePath]', 'archive the workspace including diagnosis info (by default exclude node-modules and include .bit)'], ['n', 'include-node-modules', 'relevant for --archive. include node_modules in the archive file'], ['p', 'include-public', 'relevant for --archive. include public folder in the archive file'], ['e', 'exclude-local-scope', 'relevant for --archive. exclude .bit or .git/bit from the archive file'], ['r', 'remote <remoteName>', 'run doctor checks on a remote scope']]);
|
|
37
|
+
}
|
|
38
|
+
async report([diagnosisName], flags) {
|
|
39
|
+
const res = await this.runDiag(diagnosisName, flags);
|
|
40
|
+
if (flags.list) {
|
|
41
|
+
return (0, _diagnosisListTemplate().default)(res);
|
|
42
|
+
}
|
|
43
|
+
if (diagnosisName) {
|
|
44
|
+
const {
|
|
45
|
+
examineResult,
|
|
46
|
+
savedFilePath,
|
|
47
|
+
metaData
|
|
48
|
+
} = res;
|
|
49
|
+
return (0, _doctorResultsTemplate().default)({
|
|
50
|
+
examineResults: [examineResult],
|
|
51
|
+
savedFilePath,
|
|
52
|
+
metaData
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const {
|
|
56
|
+
examineResults,
|
|
57
|
+
savedFilePath,
|
|
58
|
+
metaData
|
|
59
|
+
} = res;
|
|
60
|
+
return (0, _doctorResultsTemplate().default)({
|
|
61
|
+
examineResults,
|
|
62
|
+
savedFilePath,
|
|
63
|
+
metaData
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async json([diagnosisName], flags) {
|
|
67
|
+
const res = await this.runDiag(diagnosisName, flags);
|
|
68
|
+
if (flags.list) {
|
|
69
|
+
return res;
|
|
70
|
+
}
|
|
71
|
+
const {
|
|
72
|
+
examineResults,
|
|
73
|
+
examineResult,
|
|
74
|
+
savedFilePath
|
|
75
|
+
} = res;
|
|
76
|
+
const fullJson = {
|
|
77
|
+
savedFilePath,
|
|
78
|
+
examineResult,
|
|
79
|
+
examineResults
|
|
80
|
+
};
|
|
81
|
+
return fullJson;
|
|
82
|
+
}
|
|
83
|
+
async runDiag(diagnosisName, flags = {}) {
|
|
84
|
+
const {
|
|
85
|
+
list = false,
|
|
86
|
+
save,
|
|
87
|
+
archive,
|
|
88
|
+
includeNodeModules = false,
|
|
89
|
+
includePublic = false,
|
|
90
|
+
excludeLocalScope = false,
|
|
91
|
+
remote
|
|
92
|
+
} = flags;
|
|
93
|
+
if (list) {
|
|
94
|
+
return this.doctor.listDiagnoses();
|
|
95
|
+
}
|
|
96
|
+
if ((includeNodeModules || excludeLocalScope) && !archive) {
|
|
97
|
+
throw new Error('to use --include-node-modules or --exclude-local-scope please specify --archive');
|
|
98
|
+
}
|
|
99
|
+
let filePath = save;
|
|
100
|
+
// Happen when used --save without specify the location
|
|
101
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
102
|
+
if (save === true || archive === true) {
|
|
103
|
+
filePath = '.';
|
|
104
|
+
}
|
|
105
|
+
if (typeof archive === 'string') {
|
|
106
|
+
filePath = archive;
|
|
107
|
+
}
|
|
108
|
+
const doctorOptions = {
|
|
109
|
+
diagnosisName,
|
|
110
|
+
filePath,
|
|
111
|
+
archiveWorkspace: Boolean(archive),
|
|
112
|
+
includeNodeModules,
|
|
113
|
+
includePublic,
|
|
114
|
+
excludeLocalScope,
|
|
115
|
+
remote
|
|
116
|
+
};
|
|
117
|
+
return diagnosisName ? this.doctor.runOne(doctorOptions) : this.doctor.runAll(doctorOptions);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.DoctorCmd = DoctorCmd;
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=doctor-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_diagnosisListTemplate","data","_interopRequireDefault","require","_doctorResultsTemplate","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DoctorCmd","constructor","doctor","report","diagnosisName","flags","res","runDiag","list","formatDiagnosesList","examineResult","savedFilePath","metaData","formatDiagnosesResult","examineResults","json","fullJson","save","archive","includeNodeModules","includePublic","excludeLocalScope","remote","listDiagnoses","Error","filePath","doctorOptions","archiveWorkspace","Boolean","runOne","runAll","exports"],"sources":["doctor-cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport formatDiagnosesList from './diagnosis-list-template';\nimport formatDiagnosesResult from './doctor-results-template';\nimport type { DoctorMain, DoctorOptions } from './doctor.main.runtime';\n\ntype Flags = {\n list?: boolean;\n save?: string;\n archive?: string;\n includeNodeModules?: boolean;\n includePublic?: boolean;\n excludeLocalScope?: boolean;\n remote?: string;\n};\n\nexport class DoctorCmd implements Command {\n name = 'doctor [diagnosis-name]';\n description = 'diagnose and troubleshoot workspace issues';\n extendedDescription = `runs comprehensive health checks on your workspace to detect and report configuration problems, \nmissing dependencies, corrupted data, and other issues that may affect workspace functionality.\ncan generate diagnostic reports and workspace archives for debugging and support purposes.`;\n group = 'system';\n alias = '';\n loadAspects = false;\n options = [\n ['j', 'json', 'return diagnoses in json format'],\n ['', 'list', 'list all available diagnoses'],\n ['s', 'save [filePath]', 'save diagnoses to a file'],\n [\n 'a',\n 'archive [filePath]',\n 'archive the workspace including diagnosis info (by default exclude node-modules and include .bit)',\n ],\n ['n', 'include-node-modules', 'relevant for --archive. include node_modules in the archive file'],\n ['p', 'include-public', 'relevant for --archive. include public folder in the archive file'],\n ['e', 'exclude-local-scope', 'relevant for --archive. exclude .bit or .git/bit from the archive file'],\n ['r', 'remote <remoteName>', 'run doctor checks on a remote scope'],\n ] as CommandOptions;\n\n constructor(private doctor: DoctorMain) {}\n\n async report([diagnosisName]: string[], flags: Flags) {\n const res = await this.runDiag(diagnosisName, flags);\n if (flags.list) {\n return formatDiagnosesList(res);\n }\n if (diagnosisName) {\n const { examineResult, savedFilePath, metaData } = res;\n return formatDiagnosesResult({ examineResults: [examineResult], savedFilePath, metaData });\n }\n const { examineResults, savedFilePath, metaData } = res;\n return formatDiagnosesResult({ examineResults, savedFilePath, metaData });\n }\n\n async json([diagnosisName]: string[], flags: Flags) {\n const res = await this.runDiag(diagnosisName, flags);\n if (flags.list) {\n return res;\n }\n const { examineResults, examineResult, savedFilePath } = res;\n const fullJson = {\n savedFilePath,\n examineResult,\n examineResults,\n };\n return fullJson;\n }\n\n private async runDiag(diagnosisName?: string, flags: Flags = {}): Promise<any> {\n const {\n list = false,\n save,\n archive,\n includeNodeModules = false,\n includePublic = false,\n excludeLocalScope = false,\n remote,\n } = flags;\n\n if (list) {\n return this.doctor.listDiagnoses();\n }\n if ((includeNodeModules || excludeLocalScope) && !archive) {\n throw new Error('to use --include-node-modules or --exclude-local-scope please specify --archive');\n }\n let filePath = save;\n // Happen when used --save without specify the location\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (save === true || archive === true) {\n filePath = '.';\n }\n if (typeof archive === 'string') {\n filePath = archive;\n }\n const doctorOptions: DoctorOptions = {\n diagnosisName,\n filePath,\n archiveWorkspace: Boolean(archive),\n includeNodeModules,\n includePublic,\n excludeLocalScope,\n remote,\n };\n return diagnosisName ? this.doctor.runOne(doctorOptions) : this.doctor.runAll(doctorOptions);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,uBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,sBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,uBAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,sBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8D,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAA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,KAAK,IAAI,IAAIC,OAAO,KAAK,IAAI,EAAE;MACrCO,QAAQ,GAAG,GAAG;IAChB;IACA,IAAI,OAAOP,OAAO,KAAK,QAAQ,EAAE;MAC/BO,QAAQ,GAAGP,OAAO;IACpB;IACA,MAAMQ,aAA4B,GAAG;MACnCtB,aAAa;MACbqB,QAAQ;MACRE,gBAAgB,EAAEC,OAAO,CAACV,OAAO,CAAC;MAClCC,kBAAkB;MAClBC,aAAa;MACbC,iBAAiB;MACjBC;IACF,CAAC;IACD,OAAOlB,aAAa,GAAG,IAAI,CAACF,MAAM,CAAC2B,MAAM,CAACH,aAAa,CAAC,GAAG,IAAI,CAACxB,MAAM,CAAC4B,MAAM,CAACJ,aAAa,CAAC;EAC9F;AACF;AAACK,OAAA,CAAA/B,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doctor Context
|
|
3
|
+
*
|
|
4
|
+
* This module provides a context mechanism for sharing scope information between
|
|
5
|
+
* the doctor runtime and individual diagnosis implementations.
|
|
6
|
+
*
|
|
7
|
+
* ## Purpose
|
|
8
|
+
* When running doctor against a remote scope (using `bit doctor --remote <name>`),
|
|
9
|
+
* individual diagnoses need access to that remote scope object. However, the base
|
|
10
|
+
* Diagnosis class doesn't pass the scope as a parameter to `_runExamine()`.
|
|
11
|
+
*
|
|
12
|
+
* ## How it works
|
|
13
|
+
* 1. Before running diagnoses, `setRemoteScope()` is called with the remote scope
|
|
14
|
+
* 2. Individual diagnoses call `getRemoteScope()` to access the remote scope
|
|
15
|
+
* 3. After diagnoses complete, `setRemoteScope(undefined)` clears the context
|
|
16
|
+
*
|
|
17
|
+
* ## Usage Example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // In doctor runtime or run-doctor-on-scope.ts:
|
|
20
|
+
* setRemoteScope(scope);
|
|
21
|
+
* try {
|
|
22
|
+
* const result = await diagnosis.examine();
|
|
23
|
+
* } finally {
|
|
24
|
+
* setRemoteScope(undefined);
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* // In a diagnosis implementation:
|
|
28
|
+
* async _runExamine() {
|
|
29
|
+
* const remoteScope = getRemoteScope();
|
|
30
|
+
* const scope = remoteScope || consumer?.scope || await loadScope();
|
|
31
|
+
* // ... use scope
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
import type { Scope } from '@teambit/legacy.scope';
|
|
36
|
+
/**
|
|
37
|
+
* Sets the remote scope context for diagnoses to access.
|
|
38
|
+
* Should be called before running diagnoses and cleared (set to undefined) after.
|
|
39
|
+
*
|
|
40
|
+
* @param scope - The remote scope being examined, or undefined to clear the context
|
|
41
|
+
*/
|
|
42
|
+
export declare function setRemoteScope(scope: Scope | undefined): void;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the current remote scope context.
|
|
45
|
+
* Returns undefined if not running against a remote scope.
|
|
46
|
+
*
|
|
47
|
+
* @returns The remote scope if set, otherwise undefined
|
|
48
|
+
*/
|
|
49
|
+
export declare function getRemoteScope(): Scope | undefined;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRemoteScope = getRemoteScope;
|
|
7
|
+
exports.setRemoteScope = setRemoteScope;
|
|
8
|
+
/**
|
|
9
|
+
* Doctor Context
|
|
10
|
+
*
|
|
11
|
+
* This module provides a context mechanism for sharing scope information between
|
|
12
|
+
* the doctor runtime and individual diagnosis implementations.
|
|
13
|
+
*
|
|
14
|
+
* ## Purpose
|
|
15
|
+
* When running doctor against a remote scope (using `bit doctor --remote <name>`),
|
|
16
|
+
* individual diagnoses need access to that remote scope object. However, the base
|
|
17
|
+
* Diagnosis class doesn't pass the scope as a parameter to `_runExamine()`.
|
|
18
|
+
*
|
|
19
|
+
* ## How it works
|
|
20
|
+
* 1. Before running diagnoses, `setRemoteScope()` is called with the remote scope
|
|
21
|
+
* 2. Individual diagnoses call `getRemoteScope()` to access the remote scope
|
|
22
|
+
* 3. After diagnoses complete, `setRemoteScope(undefined)` clears the context
|
|
23
|
+
*
|
|
24
|
+
* ## Usage Example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // In doctor runtime or run-doctor-on-scope.ts:
|
|
27
|
+
* setRemoteScope(scope);
|
|
28
|
+
* try {
|
|
29
|
+
* const result = await diagnosis.examine();
|
|
30
|
+
* } finally {
|
|
31
|
+
* setRemoteScope(undefined);
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* // In a diagnosis implementation:
|
|
35
|
+
* async _runExamine() {
|
|
36
|
+
* const remoteScope = getRemoteScope();
|
|
37
|
+
* const scope = remoteScope || consumer?.scope || await loadScope();
|
|
38
|
+
* // ... use scope
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Module-level storage for the remote scope being examined.
|
|
45
|
+
* This is set when running doctor against a remote scope.
|
|
46
|
+
*/
|
|
47
|
+
let remoteScope;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sets the remote scope context for diagnoses to access.
|
|
51
|
+
* Should be called before running diagnoses and cleared (set to undefined) after.
|
|
52
|
+
*
|
|
53
|
+
* @param scope - The remote scope being examined, or undefined to clear the context
|
|
54
|
+
*/
|
|
55
|
+
function setRemoteScope(scope) {
|
|
56
|
+
remoteScope = scope;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets the current remote scope context.
|
|
61
|
+
* Returns undefined if not running against a remote scope.
|
|
62
|
+
*
|
|
63
|
+
* @returns The remote scope if set, otherwise undefined
|
|
64
|
+
*/
|
|
65
|
+
function getRemoteScope() {
|
|
66
|
+
return remoteScope;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=doctor-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["remoteScope","setRemoteScope","scope","getRemoteScope"],"sources":["doctor-context.ts"],"sourcesContent":["/**\n * Doctor Context\n *\n * This module provides a context mechanism for sharing scope information between\n * the doctor runtime and individual diagnosis implementations.\n *\n * ## Purpose\n * When running doctor against a remote scope (using `bit doctor --remote <name>`),\n * individual diagnoses need access to that remote scope object. However, the base\n * Diagnosis class doesn't pass the scope as a parameter to `_runExamine()`.\n *\n * ## How it works\n * 1. Before running diagnoses, `setRemoteScope()` is called with the remote scope\n * 2. Individual diagnoses call `getRemoteScope()` to access the remote scope\n * 3. After diagnoses complete, `setRemoteScope(undefined)` clears the context\n *\n * ## Usage Example\n * ```typescript\n * // In doctor runtime or run-doctor-on-scope.ts:\n * setRemoteScope(scope);\n * try {\n * const result = await diagnosis.examine();\n * } finally {\n * setRemoteScope(undefined);\n * }\n *\n * // In a diagnosis implementation:\n * async _runExamine() {\n * const remoteScope = getRemoteScope();\n * const scope = remoteScope || consumer?.scope || await loadScope();\n * // ... use scope\n * }\n * ```\n */\n\nimport type { Scope } from '@teambit/legacy.scope';\n\n/**\n * Module-level storage for the remote scope being examined.\n * This is set when running doctor against a remote scope.\n */\nlet remoteScope: Scope | undefined;\n\n/**\n * Sets the remote scope context for diagnoses to access.\n * Should be called before running diagnoses and cleared (set to undefined) after.\n *\n * @param scope - The remote scope being examined, or undefined to clear the context\n */\nexport function setRemoteScope(scope: Scope | undefined) {\n remoteScope = scope;\n}\n\n/**\n * Gets the current remote scope context.\n * Returns undefined if not running against a remote scope.\n *\n * @returns The remote scope if set, otherwise undefined\n */\nexport function getRemoteScope(): Scope | undefined {\n return remoteScope;\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,IAAIA,WAA8B;;AAElC;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,KAAwB,EAAE;EACvDF,WAAW,GAAGE,KAAK;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAA,EAAsB;EAClD,OAAOH,WAAW;AACpB","ignoreList":[]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = registerCoreAndExtensionsDiagnoses;
|
|
7
|
+
function _brokenSymlinkFiles() {
|
|
8
|
+
const data = _interopRequireDefault(require("./core-diagnoses/broken-symlink-files"));
|
|
9
|
+
_brokenSymlinkFiles = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _orphanSymlinkObjects() {
|
|
15
|
+
const data = _interopRequireDefault(require("./core-diagnoses/orphan-symlink-objects"));
|
|
16
|
+
_orphanSymlinkObjects = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _validateBitVersion() {
|
|
22
|
+
const data = _interopRequireDefault(require("./core-diagnoses/validate-bit-version"));
|
|
23
|
+
_validateBitVersion = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _validateGitExec() {
|
|
29
|
+
const data = _interopRequireDefault(require("./core-diagnoses/validate-git-exec"));
|
|
30
|
+
_validateGitExec = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _validateNpmExec() {
|
|
36
|
+
const data = _interopRequireDefault(require("./core-diagnoses/validate-npm-exec"));
|
|
37
|
+
_validateNpmExec = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _validateScopeObjects() {
|
|
43
|
+
const data = _interopRequireDefault(require("./core-diagnoses/validate-scope-objects"));
|
|
44
|
+
_validateScopeObjects = function () {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
function _validateWorkspaceBitJsonSyntax() {
|
|
50
|
+
const data = _interopRequireDefault(require("./core-diagnoses/validate-workspace-bit-json-syntax"));
|
|
51
|
+
_validateWorkspaceBitJsonSyntax = function () {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
function _validateYarnExec() {
|
|
57
|
+
const data = _interopRequireDefault(require("./core-diagnoses/validate-yarn-exec"));
|
|
58
|
+
_validateYarnExec = function () {
|
|
59
|
+
return data;
|
|
60
|
+
};
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
function _doctorRegistrar() {
|
|
64
|
+
const data = _interopRequireDefault(require("./doctor-registrar"));
|
|
65
|
+
_doctorRegistrar = function () {
|
|
66
|
+
return data;
|
|
67
|
+
};
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
71
|
+
function registerCoreAndExtensionsDiagnoses(extensionDiagnoses = []) {
|
|
72
|
+
const diagnoses = [new (_validateWorkspaceBitJsonSyntax().default)(), new (_validateGitExec().default)(), new (_orphanSymlinkObjects().default)(), new (_brokenSymlinkFiles().default)(), new (_validateNpmExec().default)(), new (_validateYarnExec().default)(), new (_validateBitVersion().default)(), new (_validateScopeObjects().default)()].concat(extensionDiagnoses);
|
|
73
|
+
_doctorRegistrar().default.init(diagnoses);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=doctor-registrar-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_brokenSymlinkFiles","data","_interopRequireDefault","require","_orphanSymlinkObjects","_validateBitVersion","_validateGitExec","_validateNpmExec","_validateScopeObjects","_validateWorkspaceBitJsonSyntax","_validateYarnExec","_doctorRegistrar","e","__esModule","default","registerCoreAndExtensionsDiagnoses","extensionDiagnoses","diagnoses","ValidateWorkspaceBitJsonSyntax","ValidateGitExec","OrphanSymlinkObjects","BrokenSymlinkFiles","ValidateNpmExec","ValidateYarnExec","ValidateBitVersion","ValidateScopeObjects","concat","DoctorRegistrar","init"],"sources":["doctor-registrar-builder.ts"],"sourcesContent":["import BrokenSymlinkFiles from './core-diagnoses/broken-symlink-files';\nimport OrphanSymlinkObjects from './core-diagnoses/orphan-symlink-objects';\nimport ValidateBitVersion from './core-diagnoses/validate-bit-version';\nimport ValidateGitExec from './core-diagnoses/validate-git-exec';\nimport ValidateNpmExec from './core-diagnoses/validate-npm-exec';\nimport ValidateScopeObjects from './core-diagnoses/validate-scope-objects';\nimport ValidateWorkspaceBitJsonSyntax from './core-diagnoses/validate-workspace-bit-json-syntax';\nimport ValidateYarnExec from './core-diagnoses/validate-yarn-exec';\nimport type Diagnosis from './diagnosis';\nimport DoctorRegistrar from './doctor-registrar';\n\nexport default function registerCoreAndExtensionsDiagnoses(extensionDiagnoses: Diagnosis[] = []) {\n const diagnoses = [\n new ValidateWorkspaceBitJsonSyntax(),\n new ValidateGitExec(),\n new OrphanSymlinkObjects(),\n new BrokenSymlinkFiles(),\n new ValidateNpmExec(),\n new ValidateYarnExec(),\n new ValidateBitVersion(),\n new ValidateScopeObjects(),\n ].concat(extensionDiagnoses);\n DoctorRegistrar.init(diagnoses);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,oBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,mBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,sBAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAA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