@teambit/doctor 0.0.486 → 0.0.488
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/validate-scope-objects.ts +83 -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/doctor-cmd.d.ts +1 -0
- package/dist/doctor-cmd.js +5 -3
- package/dist/doctor-cmd.js.map +1 -1
- 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.js +8 -1
- package/dist/doctor-registrar-builder.js.map +1 -1
- 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 +12 -3
- package/dist/doctor.main.runtime.js +121 -16
- package/dist/doctor.main.runtime.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- 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/package.json +16 -11
- /package/dist/{preview-1762441004753.js → preview-1762791698657.js} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { loadConsumerIfExist } from '@teambit/legacy.consumer';
|
|
2
|
+
import { loadScope } from '@teambit/legacy.scope';
|
|
3
|
+
import type { ExamineBareResult } from '../diagnosis';
|
|
4
|
+
import Diagnosis from '../diagnosis';
|
|
5
|
+
import { getRemoteScope } from '../doctor-context';
|
|
6
|
+
|
|
7
|
+
export const DIAGNOSIS_NAME = 'validate scope objects';
|
|
8
|
+
|
|
9
|
+
type ComponentWithMissingHead = {
|
|
10
|
+
id: string;
|
|
11
|
+
head: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default class ValidateScopeObjects extends Diagnosis {
|
|
15
|
+
name = DIAGNOSIS_NAME;
|
|
16
|
+
description = 'check if all components have their head version objects';
|
|
17
|
+
category = 'scope integrity';
|
|
18
|
+
|
|
19
|
+
_formatSymptoms(bareResult: ExamineBareResult): string {
|
|
20
|
+
if (!bareResult.data) throw new Error('ValidateScopeObjects, bareResult.data is missing');
|
|
21
|
+
const { componentsWithMissingHeads } = bareResult.data;
|
|
22
|
+
if (!componentsWithMissingHeads || componentsWithMissingHeads.length === 0) {
|
|
23
|
+
return 'No issues found';
|
|
24
|
+
}
|
|
25
|
+
return `the following components have missing head version objects:\n${componentsWithMissingHeads
|
|
26
|
+
.map((c: ComponentWithMissingHead) => ` ${c.id} (head: ${c.head})`)
|
|
27
|
+
.join('\n')}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_formatManualTreat() {
|
|
31
|
+
return 'The missing objects need to be restored from backups or re-exported from workspaces that have these components.';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async _runExamine(): Promise<ExamineBareResult> {
|
|
35
|
+
// Check if running against a remote scope
|
|
36
|
+
const remoteScope = getRemoteScope();
|
|
37
|
+
let scope = remoteScope;
|
|
38
|
+
|
|
39
|
+
// If not remote, try to get scope locally
|
|
40
|
+
if (!scope) {
|
|
41
|
+
// First try workspace
|
|
42
|
+
const consumer = await loadConsumerIfExist();
|
|
43
|
+
scope = consumer?.scope;
|
|
44
|
+
|
|
45
|
+
// If no workspace, try to load bare scope directly
|
|
46
|
+
if (!scope) {
|
|
47
|
+
try {
|
|
48
|
+
scope = await loadScope();
|
|
49
|
+
} catch {
|
|
50
|
+
// Not in a scope, that's fine
|
|
51
|
+
return { valid: true };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Get all local components only
|
|
57
|
+
const modelComponents = await scope.list(true);
|
|
58
|
+
const componentsWithMissingHeads: ComponentWithMissingHead[] = [];
|
|
59
|
+
|
|
60
|
+
// Check each component
|
|
61
|
+
for (const modelComponent of modelComponents) {
|
|
62
|
+
const head = modelComponent.getHead();
|
|
63
|
+
if (!head) continue;
|
|
64
|
+
|
|
65
|
+
// Check if the head version object exists
|
|
66
|
+
const headVersion = await scope.objects.load(head, false);
|
|
67
|
+
if (!headVersion) {
|
|
68
|
+
componentsWithMissingHeads.push({
|
|
69
|
+
id: modelComponent.id(),
|
|
70
|
+
head: head.toString(),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
valid: componentsWithMissingHeads.length === 0,
|
|
77
|
+
data: {
|
|
78
|
+
componentsWithMissingHeads,
|
|
79
|
+
totalComponents: modelComponents.length,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ExamineBareResult } from '../diagnosis';
|
|
2
|
+
import Diagnosis from '../diagnosis';
|
|
3
|
+
export declare const DIAGNOSIS_NAME = "validate scope objects";
|
|
4
|
+
export default class ValidateScopeObjects extends Diagnosis {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
category: string;
|
|
8
|
+
_formatSymptoms(bareResult: ExamineBareResult): string;
|
|
9
|
+
_formatManualTreat(): string;
|
|
10
|
+
_runExamine(): Promise<ExamineBareResult>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.DIAGNOSIS_NAME = void 0;
|
|
7
|
+
function _legacy() {
|
|
8
|
+
const data = require("@teambit/legacy.consumer");
|
|
9
|
+
_legacy = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _legacy2() {
|
|
15
|
+
const data = require("@teambit/legacy.scope");
|
|
16
|
+
_legacy2 = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _diagnosis() {
|
|
22
|
+
const data = _interopRequireDefault(require("../diagnosis"));
|
|
23
|
+
_diagnosis = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _doctorContext() {
|
|
29
|
+
const data = require("../doctor-context");
|
|
30
|
+
_doctorContext = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
|
+
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; }
|
|
37
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
38
|
+
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); }
|
|
39
|
+
const DIAGNOSIS_NAME = exports.DIAGNOSIS_NAME = 'validate scope objects';
|
|
40
|
+
class ValidateScopeObjects extends _diagnosis().default {
|
|
41
|
+
constructor(...args) {
|
|
42
|
+
super(...args);
|
|
43
|
+
_defineProperty(this, "name", DIAGNOSIS_NAME);
|
|
44
|
+
_defineProperty(this, "description", 'check if all components have their head version objects');
|
|
45
|
+
_defineProperty(this, "category", 'scope integrity');
|
|
46
|
+
}
|
|
47
|
+
_formatSymptoms(bareResult) {
|
|
48
|
+
if (!bareResult.data) throw new Error('ValidateScopeObjects, bareResult.data is missing');
|
|
49
|
+
const {
|
|
50
|
+
componentsWithMissingHeads
|
|
51
|
+
} = bareResult.data;
|
|
52
|
+
if (!componentsWithMissingHeads || componentsWithMissingHeads.length === 0) {
|
|
53
|
+
return 'No issues found';
|
|
54
|
+
}
|
|
55
|
+
return `the following components have missing head version objects:\n${componentsWithMissingHeads.map(c => ` ${c.id} (head: ${c.head})`).join('\n')}`;
|
|
56
|
+
}
|
|
57
|
+
_formatManualTreat() {
|
|
58
|
+
return 'The missing objects need to be restored from backups or re-exported from workspaces that have these components.';
|
|
59
|
+
}
|
|
60
|
+
async _runExamine() {
|
|
61
|
+
// Check if running against a remote scope
|
|
62
|
+
const remoteScope = (0, _doctorContext().getRemoteScope)();
|
|
63
|
+
let scope = remoteScope;
|
|
64
|
+
|
|
65
|
+
// If not remote, try to get scope locally
|
|
66
|
+
if (!scope) {
|
|
67
|
+
// First try workspace
|
|
68
|
+
const consumer = await (0, _legacy().loadConsumerIfExist)();
|
|
69
|
+
scope = consumer?.scope;
|
|
70
|
+
|
|
71
|
+
// If no workspace, try to load bare scope directly
|
|
72
|
+
if (!scope) {
|
|
73
|
+
try {
|
|
74
|
+
scope = await (0, _legacy2().loadScope)();
|
|
75
|
+
} catch {
|
|
76
|
+
// Not in a scope, that's fine
|
|
77
|
+
return {
|
|
78
|
+
valid: true
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Get all local components only
|
|
85
|
+
const modelComponents = await scope.list(true);
|
|
86
|
+
const componentsWithMissingHeads = [];
|
|
87
|
+
|
|
88
|
+
// Check each component
|
|
89
|
+
for (const modelComponent of modelComponents) {
|
|
90
|
+
const head = modelComponent.getHead();
|
|
91
|
+
if (!head) continue;
|
|
92
|
+
|
|
93
|
+
// Check if the head version object exists
|
|
94
|
+
const headVersion = await scope.objects.load(head, false);
|
|
95
|
+
if (!headVersion) {
|
|
96
|
+
componentsWithMissingHeads.push({
|
|
97
|
+
id: modelComponent.id(),
|
|
98
|
+
head: head.toString()
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
valid: componentsWithMissingHeads.length === 0,
|
|
104
|
+
data: {
|
|
105
|
+
componentsWithMissingHeads,
|
|
106
|
+
totalComponents: modelComponents.length
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.default = ValidateScopeObjects;
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=validate-scope-objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_legacy","data","require","_legacy2","_diagnosis","_interopRequireDefault","_doctorContext","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DIAGNOSIS_NAME","exports","ValidateScopeObjects","Diagnosis","constructor","args","_formatSymptoms","bareResult","Error","componentsWithMissingHeads","length","map","c","id","head","join","_formatManualTreat","_runExamine","remoteScope","getRemoteScope","scope","consumer","loadConsumerIfExist","loadScope","valid","modelComponents","list","modelComponent","getHead","headVersion","objects","load","push","toString","totalComponents"],"sources":["validate-scope-objects.ts"],"sourcesContent":["import { loadConsumerIfExist } from '@teambit/legacy.consumer';\nimport { loadScope } from '@teambit/legacy.scope';\nimport type { ExamineBareResult } from '../diagnosis';\nimport Diagnosis from '../diagnosis';\nimport { getRemoteScope } from '../doctor-context';\n\nexport const DIAGNOSIS_NAME = 'validate scope objects';\n\ntype ComponentWithMissingHead = {\n id: string;\n head: string;\n};\n\nexport default class ValidateScopeObjects extends Diagnosis {\n name = DIAGNOSIS_NAME;\n description = 'check if all components have their head version objects';\n category = 'scope integrity';\n\n _formatSymptoms(bareResult: ExamineBareResult): string {\n if (!bareResult.data) throw new Error('ValidateScopeObjects, bareResult.data is missing');\n const { componentsWithMissingHeads } = bareResult.data;\n if (!componentsWithMissingHeads || componentsWithMissingHeads.length === 0) {\n return 'No issues found';\n }\n return `the following components have missing head version objects:\\n${componentsWithMissingHeads\n .map((c: ComponentWithMissingHead) => ` ${c.id} (head: ${c.head})`)\n .join('\\n')}`;\n }\n\n _formatManualTreat() {\n return 'The missing objects need to be restored from backups or re-exported from workspaces that have these components.';\n }\n\n async _runExamine(): Promise<ExamineBareResult> {\n // Check if running against a remote scope\n const remoteScope = getRemoteScope();\n let scope = remoteScope;\n\n // If not remote, try to get scope locally\n if (!scope) {\n // First try workspace\n const consumer = await loadConsumerIfExist();\n scope = consumer?.scope;\n\n // If no workspace, try to load bare scope directly\n if (!scope) {\n try {\n scope = await loadScope();\n } catch {\n // Not in a scope, that's fine\n return { valid: true };\n }\n }\n }\n\n // Get all local components only\n const modelComponents = await scope.list(true);\n const componentsWithMissingHeads: ComponentWithMissingHead[] = [];\n\n // Check each component\n for (const modelComponent of modelComponents) {\n const head = modelComponent.getHead();\n if (!head) continue;\n\n // Check if the head version object exists\n const headVersion = await scope.objects.load(head, false);\n if (!headVersion) {\n componentsWithMissingHeads.push({\n id: modelComponent.id(),\n head: head.toString(),\n });\n }\n }\n\n return {\n valid: componentsWithMissingHeads.length === 0,\n data: {\n componentsWithMissingHeads,\n totalComponents: modelComponents.length,\n },\n };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,eAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,cAA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BpB,0BAA0B,CAACuB,IAAI,CAAC;UAC9BnB,EAAE,EAAEc,cAAc,CAACd,EAAE,CAAC,CAAC;UACvBC,IAAI,EAAEA,IAAI,CAACmB,QAAQ,CAAC;QACtB,CAAC,CAAC;MACJ;IACF;IAEA,OAAO;MACLT,KAAK,EAAEf,0BAA0B,CAACC,MAAM,KAAK,CAAC;MAC9CrC,IAAI,EAAE;QACJoC,0BAA0B;QAC1ByB,eAAe,EAAET,eAAe,CAACf;MACnC;IACF,CAAC;EACH;AACF;AAACT,OAAA,CAAApB,OAAA,GAAAqB,oBAAA","ignoreList":[]}
|
package/dist/doctor-cmd.d.ts
CHANGED
package/dist/doctor-cmd.js
CHANGED
|
@@ -33,7 +33,7 @@ can generate diagnostic reports and workspace archives for debugging and support
|
|
|
33
33
|
_defineProperty(this, "group", 'system');
|
|
34
34
|
_defineProperty(this, "alias", '');
|
|
35
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']]);
|
|
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
37
|
}
|
|
38
38
|
async report([diagnosisName], flags) {
|
|
39
39
|
const res = await this.runDiag(diagnosisName, flags);
|
|
@@ -87,7 +87,8 @@ can generate diagnostic reports and workspace archives for debugging and support
|
|
|
87
87
|
archive,
|
|
88
88
|
includeNodeModules = false,
|
|
89
89
|
includePublic = false,
|
|
90
|
-
excludeLocalScope = false
|
|
90
|
+
excludeLocalScope = false,
|
|
91
|
+
remote
|
|
91
92
|
} = flags;
|
|
92
93
|
if (list) {
|
|
93
94
|
return this.doctor.listDiagnoses();
|
|
@@ -110,7 +111,8 @@ can generate diagnostic reports and workspace archives for debugging and support
|
|
|
110
111
|
archiveWorkspace: Boolean(archive),
|
|
111
112
|
includeNodeModules,
|
|
112
113
|
includePublic,
|
|
113
|
-
excludeLocalScope
|
|
114
|
+
excludeLocalScope,
|
|
115
|
+
remote
|
|
114
116
|
};
|
|
115
117
|
return diagnosisName ? this.doctor.runOne(doctorOptions) : this.doctor.runAll(doctorOptions);
|
|
116
118
|
}
|
package/dist/doctor-cmd.js.map
CHANGED
|
@@ -1 +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","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};\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 ] 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 } = 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 };\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,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;
|
|
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,uBA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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":[]}
|
|
@@ -39,6 +39,13 @@ function _validateNpmExec() {
|
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
41
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
|
+
}
|
|
42
49
|
function _validateWorkspaceBitJsonSyntax() {
|
|
43
50
|
const data = _interopRequireDefault(require("./core-diagnoses/validate-workspace-bit-json-syntax"));
|
|
44
51
|
_validateWorkspaceBitJsonSyntax = function () {
|
|
@@ -62,7 +69,7 @@ function _doctorRegistrar() {
|
|
|
62
69
|
}
|
|
63
70
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
64
71
|
function registerCoreAndExtensionsDiagnoses(extensionDiagnoses = []) {
|
|
65
|
-
const diagnoses = [new (_validateWorkspaceBitJsonSyntax().default)(), new (_validateGitExec().default)(), new (_orphanSymlinkObjects().default)(), new (_brokenSymlinkFiles().default)(), new (_validateNpmExec().default)(), new (_validateYarnExec().default)(), new (_validateBitVersion().default)()].concat(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);
|
|
66
73
|
_doctorRegistrar().default.init(diagnoses);
|
|
67
74
|
}
|
|
68
75
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_brokenSymlinkFiles","data","_interopRequireDefault","require","_orphanSymlinkObjects","_validateBitVersion","_validateGitExec","_validateNpmExec","_validateWorkspaceBitJsonSyntax","_validateYarnExec","_doctorRegistrar","e","__esModule","default","registerCoreAndExtensionsDiagnoses","extensionDiagnoses","diagnoses","ValidateWorkspaceBitJsonSyntax","ValidateGitExec","OrphanSymlinkObjects","BrokenSymlinkFiles","ValidateNpmExec","ValidateYarnExec","ValidateBitVersion","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 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 ].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,OAAA;EAAAC,qBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,oBAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,mBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,iBAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,gBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,iBAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,gBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,
|
|
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,G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A;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiD,SAAAC,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElC,SAASG,kCAAkCA,CAACC,kBAA+B,GAAG,EAAE,EAAE;EAC/F,MAAMC,SAAS,GAAG,CAChB,KAAIC,yCAA8B,EAAC,CAAC,EACpC,KAAIC,0BAAe,EAAC,CAAC,EACrB,KAAIC,+BAAoB,EAAC,CAAC,EAC1B,KAAIC,6BAAkB,EAAC,CAAC,EACxB,KAAIC,0BAAe,EAAC,CAAC,EACrB,KAAIC,2BAAgB,EAAC,CAAC,EACtB,KAAIC,6BAAkB,EAAC,CAAC,EACxB,KAAIC,+BAAoB,EAAC,CAAC,CAC3B,CAACC,MAAM,CAACV,kBAAkB,CAAC;EAC5BW,0BAAe,CAACC,IAAI,CAACX,SAAS,CAAC;AACjC","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.doctorSchema = doctorSchema;
|
|
7
|
+
function _graphqlTag() {
|
|
8
|
+
const data = require("graphql-tag");
|
|
9
|
+
_graphqlTag = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _runDoctorOnScope() {
|
|
15
|
+
const data = require("./run-doctor-on-scope");
|
|
16
|
+
_runDoctorOnScope = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function doctorSchema(scopeMain) {
|
|
22
|
+
return {
|
|
23
|
+
typeDefs: (0, _graphqlTag().gql)`
|
|
24
|
+
type DiagnosisMetaData {
|
|
25
|
+
name: String!
|
|
26
|
+
description: String!
|
|
27
|
+
category: String!
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type ExamineBareResult {
|
|
31
|
+
valid: Boolean!
|
|
32
|
+
data: JSONObject
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type ExamineResult {
|
|
36
|
+
diagnosisMetaData: DiagnosisMetaData!
|
|
37
|
+
bareResult: ExamineBareResult!
|
|
38
|
+
formattedSymptoms: String!
|
|
39
|
+
formattedManualTreat: String!
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type DoctorMetaData {
|
|
43
|
+
nodeVersion: String!
|
|
44
|
+
runningTimestamp: Float!
|
|
45
|
+
platform: String!
|
|
46
|
+
bitVersion: String!
|
|
47
|
+
npmVersion: String
|
|
48
|
+
yarnVersion: String
|
|
49
|
+
userDetails: String!
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type DoctorResponse {
|
|
53
|
+
examineResults: [ExamineResult]!
|
|
54
|
+
metaData: DoctorMetaData!
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
extend type Scope {
|
|
58
|
+
# run doctor diagnostics on the scope
|
|
59
|
+
doctor(diagnosisName: String): DoctorResponse!
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
resolvers: {
|
|
63
|
+
Scope: {
|
|
64
|
+
doctor: async (_, {
|
|
65
|
+
diagnosisName
|
|
66
|
+
}) => {
|
|
67
|
+
return (0, _runDoctorOnScope().runDoctorOnScope)(scopeMain.legacyScope, diagnosisName);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=doctor.graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_graphqlTag","data","require","_runDoctorOnScope","doctorSchema","scopeMain","typeDefs","gql","resolvers","Scope","doctor","_","diagnosisName","runDoctorOnScope","legacyScope"],"sources":["doctor.graphql.ts"],"sourcesContent":["import type { Schema } from '@teambit/graphql';\nimport { gql } from 'graphql-tag';\nimport type { ScopeMain } from '@teambit/scope';\nimport { runDoctorOnScope } from './run-doctor-on-scope';\n\nexport function doctorSchema(scopeMain: ScopeMain): Schema {\n return {\n typeDefs: gql`\n type DiagnosisMetaData {\n name: String!\n description: String!\n category: String!\n }\n\n type ExamineBareResult {\n valid: Boolean!\n data: JSONObject\n }\n\n type ExamineResult {\n diagnosisMetaData: DiagnosisMetaData!\n bareResult: ExamineBareResult!\n formattedSymptoms: String!\n formattedManualTreat: String!\n }\n\n type DoctorMetaData {\n nodeVersion: String!\n runningTimestamp: Float!\n platform: String!\n bitVersion: String!\n npmVersion: String\n yarnVersion: String\n userDetails: String!\n }\n\n type DoctorResponse {\n examineResults: [ExamineResult]!\n metaData: DoctorMetaData!\n }\n\n extend type Scope {\n # run doctor diagnostics on the scope\n doctor(diagnosisName: String): DoctorResponse!\n }\n `,\n resolvers: {\n Scope: {\n doctor: async (_: ScopeMain, { diagnosisName }: { diagnosisName?: string }) => {\n return runDoctorOnScope(scopeMain.legacyScope, diagnosisName);\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,kBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,iBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASG,YAAYA,CAACC,SAAoB,EAAU;EACzD,OAAO;IACLC,QAAQ,EAAE,IAAAC,iBAAG;AACjB;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;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,KAAK,EAAE;QACLC,MAAM,EAAE,MAAAA,CAAOC,CAAY,EAAE;UAAEC;QAA0C,CAAC,KAAK;UAC7E,OAAO,IAAAC,oCAAgB,EAACR,SAAS,CAACS,WAAW,EAAEF,aAAa,CAAC;QAC/D;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -2,13 +2,15 @@ import type { CLIMain } from '@teambit/cli';
|
|
|
2
2
|
import type { ExamineResult } from './diagnosis';
|
|
3
3
|
import type Diagnosis from './diagnosis';
|
|
4
4
|
import type { Logger, LoggerMain } from '@teambit/logger';
|
|
5
|
+
import type { GraphqlMain } from '@teambit/graphql';
|
|
6
|
+
import type { ScopeMain } from '@teambit/scope';
|
|
5
7
|
export type DoctorMetaData = {
|
|
6
8
|
nodeVersion: string;
|
|
7
9
|
runningTimestamp: number;
|
|
8
10
|
platform: string;
|
|
9
11
|
bitVersion: string;
|
|
10
|
-
npmVersion: string;
|
|
11
|
-
yarnVersion: string;
|
|
12
|
+
npmVersion: string | null | undefined;
|
|
13
|
+
yarnVersion: string | null | undefined;
|
|
12
14
|
userDetails: string;
|
|
13
15
|
};
|
|
14
16
|
export type DoctorRunAllResults = {
|
|
@@ -21,6 +23,10 @@ export type DoctorRunOneResult = {
|
|
|
21
23
|
savedFilePath: string | null | undefined;
|
|
22
24
|
metaData: DoctorMetaData;
|
|
23
25
|
};
|
|
26
|
+
export type DoctorResponse = {
|
|
27
|
+
examineResults: ExamineResult[];
|
|
28
|
+
metaData: DoctorMetaData;
|
|
29
|
+
};
|
|
24
30
|
export type DoctorOptions = {
|
|
25
31
|
diagnosisName?: string;
|
|
26
32
|
filePath?: string;
|
|
@@ -28,12 +34,15 @@ export type DoctorOptions = {
|
|
|
28
34
|
includeNodeModules?: boolean;
|
|
29
35
|
includePublic?: boolean;
|
|
30
36
|
excludeLocalScope?: boolean;
|
|
37
|
+
remote?: string;
|
|
31
38
|
};
|
|
32
39
|
export declare class DoctorMain {
|
|
33
40
|
private logger;
|
|
34
41
|
constructor(logger: Logger);
|
|
35
42
|
runAll(options: DoctorOptions): Promise<DoctorRunAllResults>;
|
|
36
43
|
runOne({ diagnosisName, ...options }: DoctorOptions): Promise<DoctorRunOneResult>;
|
|
44
|
+
private _connectToRemote;
|
|
45
|
+
private _validateOptions;
|
|
37
46
|
listDiagnoses(): Promise<Diagnosis[]>;
|
|
38
47
|
private _saveExamineResultsToFile;
|
|
39
48
|
private getWithoutExt;
|
|
@@ -49,6 +58,6 @@ export declare class DoctorMain {
|
|
|
49
58
|
static slots: never[];
|
|
50
59
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
51
60
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
52
|
-
static provider([cliMain, loggerMain]: [CLIMain, LoggerMain]): Promise<DoctorMain>;
|
|
61
|
+
static provider([cliMain, loggerMain, graphql, scope]: [CLIMain, LoggerMain, GraphqlMain, ScopeMain]): Promise<DoctorMain>;
|
|
53
62
|
}
|
|
54
63
|
export default DoctorMain;
|
|
@@ -158,6 +158,20 @@ function _missingDiagnosisName() {
|
|
|
158
158
|
};
|
|
159
159
|
return data;
|
|
160
160
|
}
|
|
161
|
+
function _scope() {
|
|
162
|
+
const data = require("@teambit/scope.remotes");
|
|
163
|
+
_scope = function () {
|
|
164
|
+
return data;
|
|
165
|
+
};
|
|
166
|
+
return data;
|
|
167
|
+
}
|
|
168
|
+
function _legacy5() {
|
|
169
|
+
const data = require("@teambit/legacy.consumer");
|
|
170
|
+
_legacy5 = function () {
|
|
171
|
+
return data;
|
|
172
|
+
};
|
|
173
|
+
return data;
|
|
174
|
+
}
|
|
161
175
|
function _doctor() {
|
|
162
176
|
const data = require("./doctor.aspect");
|
|
163
177
|
_doctor = function () {
|
|
@@ -179,6 +193,20 @@ function _logger() {
|
|
|
179
193
|
};
|
|
180
194
|
return data;
|
|
181
195
|
}
|
|
196
|
+
function _graphql() {
|
|
197
|
+
const data = require("@teambit/graphql");
|
|
198
|
+
_graphql = function () {
|
|
199
|
+
return data;
|
|
200
|
+
};
|
|
201
|
+
return data;
|
|
202
|
+
}
|
|
203
|
+
function _scope2() {
|
|
204
|
+
const data = require("@teambit/scope");
|
|
205
|
+
_scope2 = function () {
|
|
206
|
+
return data;
|
|
207
|
+
};
|
|
208
|
+
return data;
|
|
209
|
+
}
|
|
182
210
|
function _chalk() {
|
|
183
211
|
const data = _interopRequireDefault(require("chalk"));
|
|
184
212
|
_chalk = function () {
|
|
@@ -186,8 +214,17 @@ function _chalk() {
|
|
|
186
214
|
};
|
|
187
215
|
return data;
|
|
188
216
|
}
|
|
217
|
+
function _doctor2() {
|
|
218
|
+
const data = require("./doctor.graphql");
|
|
219
|
+
_doctor2 = function () {
|
|
220
|
+
return data;
|
|
221
|
+
};
|
|
222
|
+
return data;
|
|
223
|
+
}
|
|
189
224
|
const _excluded = ["diagnosisName"];
|
|
190
225
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
226
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
227
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
191
228
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
192
229
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
193
230
|
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; }
|
|
@@ -203,17 +240,35 @@ class DoctorMain {
|
|
|
203
240
|
async runAll(options) {
|
|
204
241
|
(0, _doctorRegistrarBuilder().default)();
|
|
205
242
|
runningTimeStamp = this._getTimeStamp();
|
|
206
|
-
|
|
207
|
-
|
|
243
|
+
this._validateOptions(options);
|
|
244
|
+
let examineResults;
|
|
245
|
+
let envMeta;
|
|
246
|
+
|
|
247
|
+
// Handle remote scope if specified
|
|
248
|
+
if (options.remote) {
|
|
208
249
|
try {
|
|
209
|
-
|
|
250
|
+
const network = await this._connectToRemote(options.remote);
|
|
251
|
+
const response = await network.doctor();
|
|
252
|
+
examineResults = response.examineResults;
|
|
253
|
+
envMeta = response.metaData;
|
|
210
254
|
} catch (err) {
|
|
211
|
-
this.logger.error(`doctor
|
|
212
|
-
|
|
255
|
+
this.logger.error(`Failed to run doctor on remote scope "${options.remote}"`, err);
|
|
256
|
+
throw err;
|
|
213
257
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
258
|
+
} else {
|
|
259
|
+
// Run locally
|
|
260
|
+
const doctorRegistrar = _doctorRegistrar().default.getInstance();
|
|
261
|
+
const examineResultsWithNulls = await Promise.all(doctorRegistrar.diagnoses.map(async diagnosis => {
|
|
262
|
+
try {
|
|
263
|
+
return await diagnosis.examine();
|
|
264
|
+
} catch (err) {
|
|
265
|
+
this.logger.error(`doctor failed running diagnosis "${diagnosis.name}"`, err);
|
|
266
|
+
this.logger.consoleFailure(_chalk().default.red(`doctor failed running diagnosis "${diagnosis.name}".\nerror-message: ${err.message}`));
|
|
267
|
+
}
|
|
268
|
+
}));
|
|
269
|
+
examineResults = (0, _lodash().compact)(examineResultsWithNulls);
|
|
270
|
+
envMeta = await this._getEnvMeta();
|
|
271
|
+
}
|
|
217
272
|
const savedFilePath = await this._saveExamineResultsToFile(examineResults, envMeta, options);
|
|
218
273
|
return {
|
|
219
274
|
examineResults,
|
|
@@ -231,13 +286,36 @@ class DoctorMain {
|
|
|
231
286
|
}
|
|
232
287
|
(0, _doctorRegistrarBuilder().default)();
|
|
233
288
|
runningTimeStamp = this._getTimeStamp();
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
289
|
+
this._validateOptions(_objectSpread({
|
|
290
|
+
diagnosisName
|
|
291
|
+
}, options));
|
|
292
|
+
let examineResult;
|
|
293
|
+
let envMeta;
|
|
294
|
+
|
|
295
|
+
// Handle remote scope if specified
|
|
296
|
+
if (options.remote) {
|
|
297
|
+
try {
|
|
298
|
+
const network = await this._connectToRemote(options.remote);
|
|
299
|
+
const response = await network.doctor(diagnosisName);
|
|
300
|
+
if (response.examineResults.length === 0) {
|
|
301
|
+
throw new (_diagnosisNotFound().DiagnosisNotFound)(diagnosisName);
|
|
302
|
+
}
|
|
303
|
+
examineResult = response.examineResults[0];
|
|
304
|
+
envMeta = response.metaData;
|
|
305
|
+
} catch (err) {
|
|
306
|
+
this.logger.error(`Failed to run doctor on remote scope "${options.remote}"`, err);
|
|
307
|
+
throw err;
|
|
308
|
+
}
|
|
309
|
+
} else {
|
|
310
|
+
// Run locally
|
|
311
|
+
const doctorRegistrar = _doctorRegistrar().default.getInstance();
|
|
312
|
+
const diagnosis = doctorRegistrar.getDiagnosisByName(diagnosisName);
|
|
313
|
+
if (!diagnosis) {
|
|
314
|
+
throw new (_diagnosisNotFound().DiagnosisNotFound)(diagnosisName);
|
|
315
|
+
}
|
|
316
|
+
examineResult = await diagnosis.examine();
|
|
317
|
+
envMeta = await this._getEnvMeta();
|
|
238
318
|
}
|
|
239
|
-
const examineResult = await diagnosis.examine();
|
|
240
|
-
const envMeta = await this._getEnvMeta();
|
|
241
319
|
const savedFilePath = await this._saveExamineResultsToFile([examineResult], envMeta, options);
|
|
242
320
|
return {
|
|
243
321
|
examineResult,
|
|
@@ -245,6 +323,32 @@ class DoctorMain {
|
|
|
245
323
|
metaData: envMeta
|
|
246
324
|
};
|
|
247
325
|
}
|
|
326
|
+
async _connectToRemote(remoteName) {
|
|
327
|
+
const consumer = await (0, _legacy5().loadConsumerIfExist)();
|
|
328
|
+
const remote = await (0, _scope().getRemoteByName)(remoteName, consumer);
|
|
329
|
+
return remote.connect();
|
|
330
|
+
}
|
|
331
|
+
_validateOptions(options) {
|
|
332
|
+
if (!options.remote) return;
|
|
333
|
+
|
|
334
|
+
// Archive-related flags are incompatible with --remote
|
|
335
|
+
const incompatibleFlags = [];
|
|
336
|
+
if (options.archiveWorkspace) {
|
|
337
|
+
incompatibleFlags.push('--archive');
|
|
338
|
+
}
|
|
339
|
+
if (options.includeNodeModules) {
|
|
340
|
+
incompatibleFlags.push('--include-node-modules');
|
|
341
|
+
}
|
|
342
|
+
if (options.includePublic) {
|
|
343
|
+
incompatibleFlags.push('--include-public');
|
|
344
|
+
}
|
|
345
|
+
if (options.excludeLocalScope) {
|
|
346
|
+
incompatibleFlags.push('--exclude-local-scope');
|
|
347
|
+
}
|
|
348
|
+
if (incompatibleFlags.length > 0) {
|
|
349
|
+
throw new Error(`The following flags cannot be used with --remote: ${incompatibleFlags.join(', ')}. Archive-related options are only applicable when running doctor locally.`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
248
352
|
async listDiagnoses() {
|
|
249
353
|
(0, _doctorRegistrarBuilder().default)();
|
|
250
354
|
const doctorRegistrar = _doctorRegistrar().default.getInstance();
|
|
@@ -402,16 +506,17 @@ class DoctorMain {
|
|
|
402
506
|
_getBitMap(workspaceDir) {
|
|
403
507
|
return _legacy2().BitMap.loadRawSync(workspaceDir);
|
|
404
508
|
}
|
|
405
|
-
static async provider([cliMain, loggerMain]) {
|
|
509
|
+
static async provider([cliMain, loggerMain, graphql, scope]) {
|
|
406
510
|
const logger = loggerMain.createLogger(_doctor().DoctorAspect.id);
|
|
407
511
|
const doctor = new DoctorMain(logger);
|
|
408
512
|
cliMain.register(new (_doctorCmd().DoctorCmd)(doctor));
|
|
513
|
+
graphql.register(() => (0, _doctor2().doctorSchema)(scope));
|
|
409
514
|
return doctor;
|
|
410
515
|
}
|
|
411
516
|
}
|
|
412
517
|
exports.DoctorMain = DoctorMain;
|
|
413
518
|
_defineProperty(DoctorMain, "slots", []);
|
|
414
|
-
_defineProperty(DoctorMain, "dependencies", [_cli().CLIAspect, _logger().LoggerAspect]);
|
|
519
|
+
_defineProperty(DoctorMain, "dependencies", [_cli().CLIAspect, _logger().LoggerAspect, _graphql().GraphqlAspect, _scope2().ScopeAspect]);
|
|
415
520
|
_defineProperty(DoctorMain, "runtime", _cli().MainRuntime);
|
|
416
521
|
_doctor().DoctorAspect.addRuntime(DoctorMain);
|
|
417
522
|
var _default = exports.default = DoctorMain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_path","_interopRequireDefault","_fsExtra","_os","_tarStream","_tarFs","_bit","_legacy","_legacy2","_legacy3","_workspaceModules","_doctorRegistrar","_doctorRegistrarBuilder","_lodash","_legacy4","_toolboxFs","_scopeModules","_configStore","_validateNpmExec","_validateYarnExec","_diagnosisNotFound","_missingDiagnosisName","_doctor","_doctorCmd","_logger","_chalk","_excluded","e","__esModule","default","_objectWithoutProperties","t","o","r","i","_objectWithoutPropertiesLoose","Object","getOwnPropertySymbols","n","length","indexOf","propertyIsEnumerable","call","hasOwnProperty","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","runningTimeStamp","DoctorMain","constructor","logger","runAll","options","registerCoreAndExtensionsDiagnoses","_getTimeStamp","doctorRegistrar","DoctorRegistrar","getInstance","examineResultsWithNulls","Promise","all","diagnoses","map","diagnosis","examine","err","error","name","consoleFailure","chalk","red","message","examineResults","compact","envMeta","_getEnvMeta","savedFilePath","_saveExamineResultsToFile","metaData","runOne","_ref","diagnosisName","MissingDiagnosisName","getDiagnosisByName","DiagnosisNotFound","examineResult","listDiagnoses","resolve","filePath","undefined","finalFilePath","_calculateFinalFileName","packStream","_generateExamineResultsTarFile","yourTarball","fs","createWriteStream","pipe","on","info","getWithoutExt","filename","ext","getExt","substring","fileName","_getDefaultFileName","finalFileName","timestamp","d","Date","getTime","tarFilePath","archiveWorkspace","includeNodeModules","includePublic","excludeLocalScope","debugLog","_getDebugLogAsBuffer","consumerInfo","_getWorkspaceInfo","bitmap","path","_getBitMap","packExamineResults","pack","entry","JSON","stringify","hasWorkspaceConfig","scopePath","findScopePath","config","LegacyWorkspaceConfig","loadIfExist","legacyPlainConfig","_legacyPlainObject","finalize","tar","ignore","startsWith","sep","includes","isGit","isLocalScope","scopeDirsToExclude","some","dir","workspaceRoot","myPack","tarFS","finish","env","nodeVersion","process","version","runningTimestamp","platform","os","bitVersion","getBitVersion","npmVersion","getNpmVersion","yarnVersion","getYarnVersion","userDetails","_getUserDetails","getConfig","CFG_USER_NAME_KEY","email","CFG_USER_EMAIL_KEY","exists","pathExists","DEBUG_LOG","log","readFile","logWithoutChalk","removeChalkCharacters","Buffer","from","getWorkspaceInfo","cwd","workspaceDir","BitMap","loadRawSync","provider","cliMain","loggerMain","createLogger","DoctorAspect","id","doctor","register","DoctorCmd","exports","CLIAspect","LoggerAspect","MainRuntime","addRuntime","_default"],"sources":["doctor.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport os from 'os';\nimport type Stream from 'stream';\nimport tar from 'tar-stream';\nimport tarFS from 'tar-fs';\nimport { getBitVersion } from '@teambit/bit.get-bit-version';\nimport { CFG_USER_EMAIL_KEY, CFG_USER_NAME_KEY, DEBUG_LOG } from '@teambit/legacy.constants';\nimport { BitMap } from '@teambit/legacy.bit-map';\nimport { LegacyWorkspaceConfig } from '@teambit/legacy.consumer-config';\nimport type { WorkspaceInfo } from '@teambit/workspace.modules.workspace-locator';\nimport { getWorkspaceInfo } from '@teambit/workspace.modules.workspace-locator';\nimport type { ExamineResult } from './diagnosis';\nimport type Diagnosis from './diagnosis';\nimport DoctorRegistrar from './doctor-registrar';\nimport registerCoreAndExtensionsDiagnoses from './doctor-registrar-builder';\nimport { compact } from 'lodash';\nimport { removeChalkCharacters } from '@teambit/legacy.utils';\nimport { getExt } from '@teambit/toolbox.fs.extension-getter';\nimport { findScopePath } from '@teambit/scope.modules.find-scope-path';\nimport { getConfig } from '@teambit/config-store';\nimport { getNpmVersion } from './core-diagnoses/validate-npm-exec';\nimport { getYarnVersion } from './core-diagnoses/validate-yarn-exec';\nimport { DiagnosisNotFound } from './exceptions/diagnosis-not-found';\nimport { MissingDiagnosisName } from './exceptions/missing-diagnosis-name';\n\nimport { DoctorAspect } from './doctor.aspect';\nimport { DoctorCmd } from './doctor-cmd';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport chalk from 'chalk';\n\n// run specific check\nexport type DoctorMetaData = {\n nodeVersion: string;\n runningTimestamp: number;\n platform: string;\n bitVersion: string;\n npmVersion: string;\n yarnVersion: string;\n userDetails: string;\n};\nexport type DoctorRunAllResults = {\n examineResults: ExamineResult[];\n savedFilePath: string | null | undefined;\n metaData: DoctorMetaData;\n};\nexport type DoctorRunOneResult = {\n examineResult: ExamineResult;\n savedFilePath: string | null | undefined;\n metaData: DoctorMetaData;\n};\n\nlet runningTimeStamp;\n\nexport type DoctorOptions = {\n diagnosisName?: string;\n filePath?: string;\n archiveWorkspace?: boolean;\n includeNodeModules?: boolean;\n includePublic?: boolean;\n excludeLocalScope?: boolean;\n};\n\nexport class DoctorMain {\n constructor(private logger: Logger) {}\n\n async runAll(options: DoctorOptions): Promise<DoctorRunAllResults> {\n registerCoreAndExtensionsDiagnoses();\n runningTimeStamp = this._getTimeStamp();\n const doctorRegistrar = DoctorRegistrar.getInstance();\n const examineResultsWithNulls = await Promise.all(\n doctorRegistrar.diagnoses.map(async (diagnosis) => {\n try {\n return await diagnosis.examine();\n } catch (err: any) {\n this.logger.error(`doctor failed running diagnosis \"${diagnosis.name}\"`, err);\n this.logger.consoleFailure(\n chalk.red(`doctor failed running diagnosis \"${diagnosis.name}\".\\nerror-message: ${err.message}`)\n );\n }\n })\n );\n const examineResults = compact(examineResultsWithNulls);\n const envMeta = await this._getEnvMeta();\n const savedFilePath = await this._saveExamineResultsToFile(examineResults, envMeta, options);\n return { examineResults, savedFilePath, metaData: envMeta };\n }\n\n async runOne({ diagnosisName, ...options }: DoctorOptions): Promise<DoctorRunOneResult> {\n if (!diagnosisName) {\n throw new MissingDiagnosisName();\n }\n registerCoreAndExtensionsDiagnoses();\n runningTimeStamp = this._getTimeStamp();\n const doctorRegistrar = DoctorRegistrar.getInstance();\n const diagnosis = doctorRegistrar.getDiagnosisByName(diagnosisName);\n if (!diagnosis) {\n throw new DiagnosisNotFound(diagnosisName);\n }\n const examineResult = await diagnosis.examine();\n const envMeta = await this._getEnvMeta();\n const savedFilePath = await this._saveExamineResultsToFile([examineResult], envMeta, options);\n return { examineResult, savedFilePath, metaData: envMeta };\n }\n\n async listDiagnoses(): Promise<Diagnosis[]> {\n registerCoreAndExtensionsDiagnoses();\n const doctorRegistrar = DoctorRegistrar.getInstance();\n return Promise.resolve(doctorRegistrar.diagnoses);\n }\n\n private async _saveExamineResultsToFile(\n examineResults: ExamineResult[],\n envMeta: DoctorMetaData,\n options: DoctorOptions\n ): Promise<string | null | undefined> {\n if (!options.filePath) {\n return Promise.resolve(undefined);\n }\n const finalFilePath = this._calculateFinalFileName(options.filePath);\n const packStream = await this._generateExamineResultsTarFile(examineResults, envMeta, finalFilePath, options);\n\n const yourTarball = fs.createWriteStream(finalFilePath);\n\n packStream.pipe(yourTarball);\n\n return new Promise((resolve) => {\n yourTarball.on('close', () => {\n this.logger.info(`wrote a file by bit doctor, file path: ${finalFilePath}`);\n resolve(finalFilePath);\n // fs.stat(finalFilePath, private (err, stats) {\n // if (err) throw err\n // console.log(stats)\n // console.log('Got file info successfully!')\n // })\n });\n });\n }\n\n private getWithoutExt(filename: string): string {\n const ext = getExt(filename);\n // There is no extension just return the file name\n if (ext === filename) {\n return filename;\n }\n return filename.substring(0, filename.length - ext.length - 1); // -1 to remove the '.'\n }\n\n private _calculateFinalFileName(fileName: string): string {\n if (fileName === '.') {\n return this._getDefaultFileName();\n }\n let finalFileName = fileName;\n if (getExt(fileName) !== 'tar' && getExt(fileName) !== 'tar.gz') {\n finalFileName = `${this.getWithoutExt(finalFileName)}.tar`;\n }\n return finalFileName;\n }\n\n private _getDefaultFileName() {\n const timestamp = runningTimeStamp || this._getTimeStamp();\n return `doctor-results-${timestamp}.tar`;\n }\n\n // TODO: move to utils\n private _getTimeStamp() {\n const d = new Date();\n const timestamp = d.getTime();\n return timestamp;\n }\n\n private async _generateExamineResultsTarFile(\n examineResults: ExamineResult[],\n envMeta: DoctorMetaData,\n tarFilePath: string,\n options: DoctorOptions\n ): Promise<Stream.Readable> {\n const { archiveWorkspace, includeNodeModules, includePublic, excludeLocalScope } = options;\n const debugLog = await this._getDebugLogAsBuffer();\n const consumerInfo = await this._getWorkspaceInfo();\n let bitmap;\n if (consumerInfo && consumerInfo.path) {\n bitmap = this._getBitMap(consumerInfo.path);\n }\n\n const packExamineResults = async (pack) => {\n pack.entry({ name: 'env-meta.json' }, JSON.stringify(envMeta, null, 2));\n pack.entry({ name: 'doc-results.json' }, JSON.stringify(examineResults, null, 2));\n if (debugLog) {\n pack.entry({ name: 'debug.log' }, debugLog);\n }\n if (!archiveWorkspace && bitmap) {\n pack.entry({ name: '.bitmap' }, bitmap);\n }\n if (consumerInfo && consumerInfo.hasWorkspaceConfig) {\n // TODO: support new config as well\n const scopePath = findScopePath(consumerInfo.path);\n const config = scopePath ? await LegacyWorkspaceConfig.loadIfExist(consumerInfo.path, scopePath) : undefined;\n const legacyPlainConfig = config?._legacyPlainObject();\n if (legacyPlainConfig) {\n pack.entry({ name: 'config.json' }, JSON.stringify(legacyPlainConfig, null, 4));\n }\n }\n\n pack.finalize();\n\n return pack;\n };\n\n if (!archiveWorkspace) {\n const pack = tar.pack(); // pack is a streams2 stream\n return packExamineResults(pack);\n }\n\n const ignore = (fileName: string) => {\n if (fileName === tarFilePath) return true;\n if (fileName === '.DS_Store') return true;\n if (\n !includeNodeModules &&\n (fileName.startsWith(`node_modules${path.sep}`) || fileName.includes(`${path.sep}node_modules${path.sep}`))\n )\n return true;\n if (\n !includePublic &&\n (fileName.startsWith(`public${path.sep}`) || fileName.includes(`${path.sep}public${path.sep}`))\n )\n return true;\n const isGit = fileName.startsWith(`.git${path.sep}`);\n const isLocalScope =\n fileName.startsWith(`.bit${path.sep}`) || fileName.startsWith(`.git${path.sep}bit${path.sep}`);\n if (excludeLocalScope && isLocalScope) {\n const scopeDirsToExclude = ['objects', 'cache', 'tmp'];\n if (scopeDirsToExclude.some((dir) => fileName.includes(`${path.sep}${dir}${path.sep}`))) return true;\n }\n if (isGit && !isLocalScope) return true;\n return false;\n };\n\n const workspaceRoot = consumerInfo?.path || '.';\n const myPack = tarFS.pack(workspaceRoot, {\n ignore,\n finalize: false,\n finish: packExamineResults,\n });\n\n return myPack;\n }\n\n private async _getEnvMeta(): Promise<DoctorMetaData> {\n const env = {\n nodeVersion: process.version,\n runningTimestamp: runningTimeStamp || this._getTimeStamp(),\n platform: os.platform(),\n bitVersion: getBitVersion(),\n npmVersion: await getNpmVersion(),\n yarnVersion: await getYarnVersion(),\n userDetails: this._getUserDetails(),\n };\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return env;\n }\n\n private _getUserDetails(): string {\n const name = getConfig(CFG_USER_NAME_KEY) || '';\n const email = getConfig(CFG_USER_EMAIL_KEY) || '';\n return `${name}<${email}>`;\n }\n\n private async _getDebugLogAsBuffer(): Promise<Buffer | null | undefined> {\n const exists = await fs.pathExists(DEBUG_LOG);\n if (!exists) return null;\n const log = await fs.readFile(DEBUG_LOG, 'utf-8');\n const logWithoutChalk = removeChalkCharacters(log) as string;\n return Buffer.from(logWithoutChalk);\n }\n\n private async _getWorkspaceInfo(): Promise<WorkspaceInfo | null | undefined> {\n const consumerInfo = await getWorkspaceInfo(process.cwd());\n return consumerInfo;\n }\n\n private _getBitMap(workspaceDir): Buffer | null | undefined {\n return BitMap.loadRawSync(workspaceDir);\n }\n\n static slots = [];\n static dependencies = [CLIAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([cliMain, loggerMain]: [CLIMain, LoggerMain]) {\n const logger = loggerMain.createLogger(DoctorAspect.id);\n const doctor = new DoctorMain(logger);\n cliMain.register(new DoctorCmd(doctor));\n return doctor;\n }\n}\n\nDoctorAspect.addRuntime(DoctorMain);\n\nexport default DoctorMain;\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,IAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAK,UAAA,YAAAA,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li","data","require","_path","_interopRequireDefault","_fsExtra","_os","_tarStream","_tarFs","_bit","_legacy","_legacy2","_legacy3","_workspaceModules","_doctorRegistrar","_doctorRegistrarBuilder","_lodash","_legacy4","_toolboxFs","_scopeModules","_configStore","_validateNpmExec","_validateYarnExec","_diagnosisNotFound","_missingDiagnosisName","_scope","_legacy5","_doctor","_doctorCmd","_logger","_graphql","_scope2","_chalk","_doctor2","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","runningTimeStamp","DoctorMain","constructor","logger","runAll","options","registerCoreAndExtensionsDiagnoses","_getTimeStamp","_validateOptions","examineResults","envMeta","remote","network","_connectToRemote","response","doctor","metaData","err","error","doctorRegistrar","DoctorRegistrar","getInstance","examineResultsWithNulls","Promise","all","diagnoses","map","diagnosis","examine","name","consoleFailure","chalk","red","message","compact","_getEnvMeta","savedFilePath","_saveExamineResultsToFile","runOne","_ref","diagnosisName","MissingDiagnosisName","examineResult","DiagnosisNotFound","getDiagnosisByName","remoteName","consumer","loadConsumerIfExist","getRemoteByName","connect","incompatibleFlags","archiveWorkspace","includeNodeModules","includePublic","excludeLocalScope","Error","join","listDiagnoses","resolve","filePath","undefined","finalFilePath","_calculateFinalFileName","packStream","_generateExamineResultsTarFile","yourTarball","fs","createWriteStream","pipe","on","info","getWithoutExt","filename","ext","getExt","substring","fileName","_getDefaultFileName","finalFileName","timestamp","d","Date","getTime","tarFilePath","debugLog","_getDebugLogAsBuffer","consumerInfo","_getWorkspaceInfo","bitmap","path","_getBitMap","packExamineResults","pack","entry","JSON","stringify","hasWorkspaceConfig","scopePath","findScopePath","config","LegacyWorkspaceConfig","loadIfExist","legacyPlainConfig","_legacyPlainObject","finalize","tar","ignore","startsWith","sep","includes","isGit","isLocalScope","scopeDirsToExclude","some","dir","workspaceRoot","myPack","tarFS","finish","env","nodeVersion","process","version","runningTimestamp","platform","os","bitVersion","getBitVersion","npmVersion","getNpmVersion","yarnVersion","getYarnVersion","userDetails","_getUserDetails","getConfig","CFG_USER_NAME_KEY","email","CFG_USER_EMAIL_KEY","exists","pathExists","DEBUG_LOG","log","readFile","logWithoutChalk","removeChalkCharacters","Buffer","from","getWorkspaceInfo","cwd","workspaceDir","BitMap","loadRawSync","provider","cliMain","loggerMain","graphql","scope","createLogger","DoctorAspect","id","register","DoctorCmd","doctorSchema","exports","CLIAspect","LoggerAspect","GraphqlAspect","ScopeAspect","MainRuntime","addRuntime","_default"],"sources":["doctor.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport path from 'path';\nimport fs from 'fs-extra';\nimport os from 'os';\nimport type Stream from 'stream';\nimport tar from 'tar-stream';\nimport tarFS from 'tar-fs';\nimport { getBitVersion } from '@teambit/bit.get-bit-version';\nimport { CFG_USER_EMAIL_KEY, CFG_USER_NAME_KEY, DEBUG_LOG } from '@teambit/legacy.constants';\nimport { BitMap } from '@teambit/legacy.bit-map';\nimport { LegacyWorkspaceConfig } from '@teambit/legacy.consumer-config';\nimport type { WorkspaceInfo } from '@teambit/workspace.modules.workspace-locator';\nimport { getWorkspaceInfo } from '@teambit/workspace.modules.workspace-locator';\nimport type { ExamineResult } from './diagnosis';\nimport type Diagnosis from './diagnosis';\nimport DoctorRegistrar from './doctor-registrar';\nimport registerCoreAndExtensionsDiagnoses from './doctor-registrar-builder';\nimport { compact } from 'lodash';\nimport { removeChalkCharacters } from '@teambit/legacy.utils';\nimport { getExt } from '@teambit/toolbox.fs.extension-getter';\nimport { findScopePath } from '@teambit/scope.modules.find-scope-path';\nimport { getConfig } from '@teambit/config-store';\nimport { getNpmVersion } from './core-diagnoses/validate-npm-exec';\nimport { getYarnVersion } from './core-diagnoses/validate-yarn-exec';\nimport { DiagnosisNotFound } from './exceptions/diagnosis-not-found';\nimport { MissingDiagnosisName } from './exceptions/missing-diagnosis-name';\nimport { getRemoteByName } from '@teambit/scope.remotes';\nimport { loadConsumerIfExist } from '@teambit/legacy.consumer';\nimport type { Network } from '@teambit/scope.network';\n\nimport { DoctorAspect } from './doctor.aspect';\nimport { DoctorCmd } from './doctor-cmd';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { GraphqlMain } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport chalk from 'chalk';\nimport { doctorSchema } from './doctor.graphql';\n\n// run specific check\nexport type DoctorMetaData = {\n nodeVersion: string;\n runningTimestamp: number;\n platform: string;\n bitVersion: string;\n npmVersion: string | null | undefined;\n yarnVersion: string | null | undefined;\n userDetails: string;\n};\nexport type DoctorRunAllResults = {\n examineResults: ExamineResult[];\n savedFilePath: string | null | undefined;\n metaData: DoctorMetaData;\n};\nexport type DoctorRunOneResult = {\n examineResult: ExamineResult;\n savedFilePath: string | null | undefined;\n metaData: DoctorMetaData;\n};\nexport type DoctorResponse = {\n examineResults: ExamineResult[];\n metaData: DoctorMetaData;\n};\n\nlet runningTimeStamp;\n\nexport type DoctorOptions = {\n diagnosisName?: string;\n filePath?: string;\n archiveWorkspace?: boolean;\n includeNodeModules?: boolean;\n includePublic?: boolean;\n excludeLocalScope?: boolean;\n remote?: string;\n};\n\nexport class DoctorMain {\n constructor(private logger: Logger) {}\n\n async runAll(options: DoctorOptions): Promise<DoctorRunAllResults> {\n registerCoreAndExtensionsDiagnoses();\n runningTimeStamp = this._getTimeStamp();\n\n this._validateOptions(options);\n\n let examineResults: ExamineResult[];\n let envMeta: DoctorMetaData;\n\n // Handle remote scope if specified\n if (options.remote) {\n try {\n const network = await this._connectToRemote(options.remote);\n const response = await network.doctor();\n examineResults = response.examineResults;\n envMeta = response.metaData;\n } catch (err: any) {\n this.logger.error(`Failed to run doctor on remote scope \"${options.remote}\"`, err);\n throw err;\n }\n } else {\n // Run locally\n const doctorRegistrar = DoctorRegistrar.getInstance();\n const examineResultsWithNulls = await Promise.all(\n doctorRegistrar.diagnoses.map(async (diagnosis) => {\n try {\n return await diagnosis.examine();\n } catch (err: any) {\n this.logger.error(`doctor failed running diagnosis \"${diagnosis.name}\"`, err);\n this.logger.consoleFailure(\n chalk.red(`doctor failed running diagnosis \"${diagnosis.name}\".\\nerror-message: ${err.message}`)\n );\n }\n })\n );\n examineResults = compact(examineResultsWithNulls);\n envMeta = await this._getEnvMeta();\n }\n\n const savedFilePath = await this._saveExamineResultsToFile(examineResults, envMeta, options);\n return { examineResults, savedFilePath, metaData: envMeta };\n }\n\n async runOne({ diagnosisName, ...options }: DoctorOptions): Promise<DoctorRunOneResult> {\n if (!diagnosisName) {\n throw new MissingDiagnosisName();\n }\n registerCoreAndExtensionsDiagnoses();\n runningTimeStamp = this._getTimeStamp();\n\n this._validateOptions({ diagnosisName, ...options });\n\n let examineResult: ExamineResult;\n let envMeta: DoctorMetaData;\n\n // Handle remote scope if specified\n if (options.remote) {\n try {\n const network = await this._connectToRemote(options.remote);\n const response = await network.doctor(diagnosisName);\n if (response.examineResults.length === 0) {\n throw new DiagnosisNotFound(diagnosisName);\n }\n examineResult = response.examineResults[0];\n envMeta = response.metaData;\n } catch (err: any) {\n this.logger.error(`Failed to run doctor on remote scope \"${options.remote}\"`, err);\n throw err;\n }\n } else {\n // Run locally\n const doctorRegistrar = DoctorRegistrar.getInstance();\n const diagnosis = doctorRegistrar.getDiagnosisByName(diagnosisName);\n if (!diagnosis) {\n throw new DiagnosisNotFound(diagnosisName);\n }\n examineResult = await diagnosis.examine();\n envMeta = await this._getEnvMeta();\n }\n\n const savedFilePath = await this._saveExamineResultsToFile([examineResult], envMeta, options);\n return { examineResult, savedFilePath, metaData: envMeta };\n }\n\n private async _connectToRemote(remoteName: string): Promise<Network> {\n const consumer = await loadConsumerIfExist();\n const remote = await getRemoteByName(remoteName, consumer);\n return remote.connect();\n }\n\n private _validateOptions(options: DoctorOptions): void {\n if (!options.remote) return;\n\n // Archive-related flags are incompatible with --remote\n const incompatibleFlags: string[] = [];\n\n if (options.archiveWorkspace) {\n incompatibleFlags.push('--archive');\n }\n if (options.includeNodeModules) {\n incompatibleFlags.push('--include-node-modules');\n }\n if (options.includePublic) {\n incompatibleFlags.push('--include-public');\n }\n if (options.excludeLocalScope) {\n incompatibleFlags.push('--exclude-local-scope');\n }\n\n if (incompatibleFlags.length > 0) {\n throw new Error(\n `The following flags cannot be used with --remote: ${incompatibleFlags.join(', ')}. Archive-related options are only applicable when running doctor locally.`\n );\n }\n }\n\n async listDiagnoses(): Promise<Diagnosis[]> {\n registerCoreAndExtensionsDiagnoses();\n const doctorRegistrar = DoctorRegistrar.getInstance();\n return Promise.resolve(doctorRegistrar.diagnoses);\n }\n\n private async _saveExamineResultsToFile(\n examineResults: ExamineResult[],\n envMeta: DoctorMetaData,\n options: DoctorOptions\n ): Promise<string | null | undefined> {\n if (!options.filePath) {\n return Promise.resolve(undefined);\n }\n const finalFilePath = this._calculateFinalFileName(options.filePath);\n const packStream = await this._generateExamineResultsTarFile(examineResults, envMeta, finalFilePath, options);\n\n const yourTarball = fs.createWriteStream(finalFilePath);\n\n packStream.pipe(yourTarball);\n\n return new Promise((resolve) => {\n yourTarball.on('close', () => {\n this.logger.info(`wrote a file by bit doctor, file path: ${finalFilePath}`);\n resolve(finalFilePath);\n // fs.stat(finalFilePath, private (err, stats) {\n // if (err) throw err\n // console.log(stats)\n // console.log('Got file info successfully!')\n // })\n });\n });\n }\n\n private getWithoutExt(filename: string): string {\n const ext = getExt(filename);\n // There is no extension just return the file name\n if (ext === filename) {\n return filename;\n }\n return filename.substring(0, filename.length - ext.length - 1); // -1 to remove the '.'\n }\n\n private _calculateFinalFileName(fileName: string): string {\n if (fileName === '.') {\n return this._getDefaultFileName();\n }\n let finalFileName = fileName;\n if (getExt(fileName) !== 'tar' && getExt(fileName) !== 'tar.gz') {\n finalFileName = `${this.getWithoutExt(finalFileName)}.tar`;\n }\n return finalFileName;\n }\n\n private _getDefaultFileName() {\n const timestamp = runningTimeStamp || this._getTimeStamp();\n return `doctor-results-${timestamp}.tar`;\n }\n\n // TODO: move to utils\n private _getTimeStamp() {\n const d = new Date();\n const timestamp = d.getTime();\n return timestamp;\n }\n\n private async _generateExamineResultsTarFile(\n examineResults: ExamineResult[],\n envMeta: DoctorMetaData,\n tarFilePath: string,\n options: DoctorOptions\n ): Promise<Stream.Readable> {\n const { archiveWorkspace, includeNodeModules, includePublic, excludeLocalScope } = options;\n const debugLog = await this._getDebugLogAsBuffer();\n const consumerInfo = await this._getWorkspaceInfo();\n let bitmap;\n if (consumerInfo && consumerInfo.path) {\n bitmap = this._getBitMap(consumerInfo.path);\n }\n\n const packExamineResults = async (pack) => {\n pack.entry({ name: 'env-meta.json' }, JSON.stringify(envMeta, null, 2));\n pack.entry({ name: 'doc-results.json' }, JSON.stringify(examineResults, null, 2));\n if (debugLog) {\n pack.entry({ name: 'debug.log' }, debugLog);\n }\n if (!archiveWorkspace && bitmap) {\n pack.entry({ name: '.bitmap' }, bitmap);\n }\n if (consumerInfo && consumerInfo.hasWorkspaceConfig) {\n // TODO: support new config as well\n const scopePath = findScopePath(consumerInfo.path);\n const config = scopePath ? await LegacyWorkspaceConfig.loadIfExist(consumerInfo.path, scopePath) : undefined;\n const legacyPlainConfig = config?._legacyPlainObject();\n if (legacyPlainConfig) {\n pack.entry({ name: 'config.json' }, JSON.stringify(legacyPlainConfig, null, 4));\n }\n }\n\n pack.finalize();\n\n return pack;\n };\n\n if (!archiveWorkspace) {\n const pack = tar.pack(); // pack is a streams2 stream\n return packExamineResults(pack);\n }\n\n const ignore = (fileName: string) => {\n if (fileName === tarFilePath) return true;\n if (fileName === '.DS_Store') return true;\n if (\n !includeNodeModules &&\n (fileName.startsWith(`node_modules${path.sep}`) || fileName.includes(`${path.sep}node_modules${path.sep}`))\n )\n return true;\n if (\n !includePublic &&\n (fileName.startsWith(`public${path.sep}`) || fileName.includes(`${path.sep}public${path.sep}`))\n )\n return true;\n const isGit = fileName.startsWith(`.git${path.sep}`);\n const isLocalScope =\n fileName.startsWith(`.bit${path.sep}`) || fileName.startsWith(`.git${path.sep}bit${path.sep}`);\n if (excludeLocalScope && isLocalScope) {\n const scopeDirsToExclude = ['objects', 'cache', 'tmp'];\n if (scopeDirsToExclude.some((dir) => fileName.includes(`${path.sep}${dir}${path.sep}`))) return true;\n }\n if (isGit && !isLocalScope) return true;\n return false;\n };\n\n const workspaceRoot = consumerInfo?.path || '.';\n const myPack = tarFS.pack(workspaceRoot, {\n ignore,\n finalize: false,\n finish: packExamineResults,\n });\n\n return myPack;\n }\n\n private async _getEnvMeta(): Promise<DoctorMetaData> {\n const env = {\n nodeVersion: process.version,\n runningTimestamp: runningTimeStamp || this._getTimeStamp(),\n platform: os.platform(),\n bitVersion: getBitVersion(),\n npmVersion: await getNpmVersion(),\n yarnVersion: await getYarnVersion(),\n userDetails: this._getUserDetails(),\n };\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return env;\n }\n\n private _getUserDetails(): string {\n const name = getConfig(CFG_USER_NAME_KEY) || '';\n const email = getConfig(CFG_USER_EMAIL_KEY) || '';\n return `${name}<${email}>`;\n }\n\n private async _getDebugLogAsBuffer(): Promise<Buffer | null | undefined> {\n const exists = await fs.pathExists(DEBUG_LOG);\n if (!exists) return null;\n const log = await fs.readFile(DEBUG_LOG, 'utf-8');\n const logWithoutChalk = removeChalkCharacters(log) as string;\n return Buffer.from(logWithoutChalk);\n }\n\n private async _getWorkspaceInfo(): Promise<WorkspaceInfo | null | undefined> {\n const consumerInfo = await getWorkspaceInfo(process.cwd());\n return consumerInfo;\n }\n\n private _getBitMap(workspaceDir): Buffer | null | undefined {\n return BitMap.loadRawSync(workspaceDir);\n }\n\n static slots = [];\n static dependencies = [CLIAspect, LoggerAspect, GraphqlAspect, ScopeAspect];\n static runtime = MainRuntime;\n static async provider([cliMain, loggerMain, graphql, scope]: [CLIMain, LoggerMain, GraphqlMain, ScopeMain]) {\n const logger = loggerMain.createLogger(DoctorAspect.id);\n const doctor = new DoctorMain(logger);\n cliMain.register(new DoctorCmd(doctor));\n graphql.register(() => doctorSchema(scope));\n return doctor;\n }\n}\n\nDoctorAspect.addRuntime(DoctorMain);\n\nexport default DoctorMain;\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,IAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,KAAA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W,UAAU,CAACxK,UAAU,CAAC;AAAC,IAAAyK,QAAA,GAAAP,OAAA,CAAA1M,OAAA,GAErBwC,UAAU","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { DoctorAspect } from './doctor.aspect';
|
|
2
|
-
export type { DoctorMain } from './doctor.main.runtime';
|
|
2
|
+
export type { DoctorMain, DoctorMetaData, DoctorResponse } from './doctor.main.runtime';
|
|
3
|
+
export type { ExamineResult } from './diagnosis';
|
|
3
4
|
export { DiagnosisNotFound } from './exceptions/diagnosis-not-found';
|
|
4
5
|
export { DIAGNOSIS_NAME_VALIDATE_GIT_EXEC } from './core-diagnoses/validate-git-exec';
|
|
6
|
+
export { runDoctorOnScope } from './run-doctor-on-scope';
|
|
5
7
|
export default DoctorAspect;
|
|
6
8
|
export { DoctorAspect };
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,12 @@ Object.defineProperty(exports, "DoctorAspect", {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
exports.default = void 0;
|
|
25
|
+
Object.defineProperty(exports, "runDoctorOnScope", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _runDoctorOnScope().runDoctorOnScope;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
25
31
|
function _doctor() {
|
|
26
32
|
const data = require("./doctor.aspect");
|
|
27
33
|
_doctor = function () {
|
|
@@ -43,6 +49,13 @@ function _validateGitExec() {
|
|
|
43
49
|
};
|
|
44
50
|
return data;
|
|
45
51
|
}
|
|
52
|
+
function _runDoctorOnScope() {
|
|
53
|
+
const data = require("./run-doctor-on-scope");
|
|
54
|
+
_runDoctorOnScope = function () {
|
|
55
|
+
return data;
|
|
56
|
+
};
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
46
59
|
var _default = exports.default = _doctor().DoctorAspect;
|
|
47
60
|
|
|
48
61
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_doctor","data","require","_diagnosisNotFound","_validateGitExec","_default","exports","default","DoctorAspect"],"sources":["index.ts"],"sourcesContent":["import { DoctorAspect } from './doctor.aspect';\n\nexport type { DoctorMain } from './doctor.main.runtime';\nexport { DiagnosisNotFound } from './exceptions/diagnosis-not-found';\nexport { DIAGNOSIS_NAME_VALIDATE_GIT_EXEC } from './core-diagnoses/validate-git-exec';\nexport default DoctorAspect;\nexport { DoctorAspect };\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_doctor","data","require","_diagnosisNotFound","_validateGitExec","_runDoctorOnScope","_default","exports","default","DoctorAspect"],"sources":["index.ts"],"sourcesContent":["import { DoctorAspect } from './doctor.aspect';\n\nexport type { DoctorMain, DoctorMetaData, DoctorResponse } from './doctor.main.runtime';\nexport type { ExamineResult } from './diagnosis';\nexport { DiagnosisNotFound } from './exceptions/diagnosis-not-found';\nexport { DIAGNOSIS_NAME_VALIDATE_GIT_EXEC } from './core-diagnoses/validate-git-exec';\nexport { runDoctorOnScope } from './run-doctor-on-scope';\nexport default DoctorAspect;\nexport { DoctorAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyD,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAC1CC,sBAAY","ignoreList":[]}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.runDoctorOnScope = runDoctorOnScope;
|
|
7
|
+
function _os() {
|
|
8
|
+
const data = _interopRequireDefault(require("os"));
|
|
9
|
+
_os = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _doctorRegistrar() {
|
|
15
|
+
const data = _interopRequireDefault(require("./doctor-registrar"));
|
|
16
|
+
_doctorRegistrar = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _doctorRegistrarBuilder() {
|
|
22
|
+
const data = _interopRequireDefault(require("./doctor-registrar-builder"));
|
|
23
|
+
_doctorRegistrarBuilder = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _doctorContext() {
|
|
29
|
+
const data = require("./doctor-context");
|
|
30
|
+
_doctorContext = function () {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _lodash() {
|
|
36
|
+
const data = require("lodash");
|
|
37
|
+
_lodash = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _legacy() {
|
|
43
|
+
const data = require("@teambit/legacy.logger");
|
|
44
|
+
_legacy = function () {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
function _bit() {
|
|
50
|
+
const data = require("@teambit/bit.get-bit-version");
|
|
51
|
+
_bit = function () {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
return data;
|
|
55
|
+
}
|
|
56
|
+
function _legacy2() {
|
|
57
|
+
const data = require("@teambit/legacy.constants");
|
|
58
|
+
_legacy2 = function () {
|
|
59
|
+
return data;
|
|
60
|
+
};
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
function _configStore() {
|
|
64
|
+
const data = require("@teambit/config-store");
|
|
65
|
+
_configStore = function () {
|
|
66
|
+
return data;
|
|
67
|
+
};
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
function _validateNpmExec() {
|
|
71
|
+
const data = require("./core-diagnoses/validate-npm-exec");
|
|
72
|
+
_validateNpmExec = function () {
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
function _validateYarnExec() {
|
|
78
|
+
const data = require("./core-diagnoses/validate-yarn-exec");
|
|
79
|
+
_validateYarnExec = function () {
|
|
80
|
+
return data;
|
|
81
|
+
};
|
|
82
|
+
return data;
|
|
83
|
+
}
|
|
84
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
85
|
+
async function runDoctorOnScope(scope, diagnosisName) {
|
|
86
|
+
(0, _doctorRegistrarBuilder().default)();
|
|
87
|
+
|
|
88
|
+
// Set the scope as remote scope so diagnoses can access it
|
|
89
|
+
(0, _doctorContext().setRemoteScope)(scope);
|
|
90
|
+
try {
|
|
91
|
+
const doctorRegistrar = _doctorRegistrar().default.getInstance();
|
|
92
|
+
let examineResults;
|
|
93
|
+
if (diagnosisName) {
|
|
94
|
+
// Run single diagnosis
|
|
95
|
+
const diagnosis = doctorRegistrar.getDiagnosisByName(diagnosisName);
|
|
96
|
+
if (!diagnosis) {
|
|
97
|
+
throw new Error(`Diagnosis "${diagnosisName}" not found`);
|
|
98
|
+
}
|
|
99
|
+
const result = await diagnosis.examine();
|
|
100
|
+
examineResults = [result];
|
|
101
|
+
} else {
|
|
102
|
+
// Run all diagnoses
|
|
103
|
+
const examineResultsWithNulls = await Promise.all(doctorRegistrar.diagnoses.map(async diagnosis => {
|
|
104
|
+
try {
|
|
105
|
+
return await diagnosis.examine();
|
|
106
|
+
} catch (err) {
|
|
107
|
+
// Log error but continue with other diagnoses
|
|
108
|
+
_legacy().logger.error(`doctor failed running diagnosis "${diagnosis.name}"`, err);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}));
|
|
112
|
+
examineResults = (0, _lodash().compact)(examineResultsWithNulls);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Generate metadata for this scope
|
|
116
|
+
const metaData = await getEnvMeta();
|
|
117
|
+
return {
|
|
118
|
+
examineResults,
|
|
119
|
+
metaData
|
|
120
|
+
};
|
|
121
|
+
} finally {
|
|
122
|
+
// Clear remote scope context
|
|
123
|
+
(0, _doctorContext().setRemoteScope)(undefined);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async function getEnvMeta() {
|
|
127
|
+
const name = (0, _configStore().getConfig)(_legacy2().CFG_USER_NAME_KEY) || '';
|
|
128
|
+
const email = (0, _configStore().getConfig)(_legacy2().CFG_USER_EMAIL_KEY) || '';
|
|
129
|
+
return {
|
|
130
|
+
nodeVersion: process.version,
|
|
131
|
+
runningTimestamp: Date.now(),
|
|
132
|
+
platform: _os().default.platform(),
|
|
133
|
+
bitVersion: (0, _bit().getBitVersion)(),
|
|
134
|
+
npmVersion: await (0, _validateNpmExec().getNpmVersion)(),
|
|
135
|
+
yarnVersion: await (0, _validateYarnExec().getYarnVersion)(),
|
|
136
|
+
userDetails: `${name}<${email}>`
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=run-doctor-on-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_os","data","_interopRequireDefault","require","_doctorRegistrar","_doctorRegistrarBuilder","_doctorContext","_lodash","_legacy","_bit","_legacy2","_configStore","_validateNpmExec","_validateYarnExec","e","__esModule","default","runDoctorOnScope","scope","diagnosisName","registerCoreAndExtensionsDiagnoses","setRemoteScope","doctorRegistrar","DoctorRegistrar","getInstance","examineResults","diagnosis","getDiagnosisByName","Error","result","examine","examineResultsWithNulls","Promise","all","diagnoses","map","err","logger","error","name","compact","metaData","getEnvMeta","undefined","getConfig","CFG_USER_NAME_KEY","email","CFG_USER_EMAIL_KEY","nodeVersion","process","version","runningTimestamp","Date","now","platform","os","bitVersion","getBitVersion","npmVersion","getNpmVersion","yarnVersion","getYarnVersion","userDetails"],"sources":["run-doctor-on-scope.ts"],"sourcesContent":["import os from 'os';\nimport type { Scope } from '@teambit/legacy.scope';\nimport type { ExamineResult } from './diagnosis';\nimport type { DoctorResponse, DoctorMetaData } from './doctor.main.runtime';\nimport DoctorRegistrar from './doctor-registrar';\nimport registerCoreAndExtensionsDiagnoses from './doctor-registrar-builder';\nimport { setRemoteScope } from './doctor-context';\nimport { compact } from 'lodash';\nimport { logger } from '@teambit/legacy.logger';\nimport { getBitVersion } from '@teambit/bit.get-bit-version';\nimport { CFG_USER_EMAIL_KEY, CFG_USER_NAME_KEY } from '@teambit/legacy.constants';\nimport { getConfig } from '@teambit/config-store';\nimport { getNpmVersion } from './core-diagnoses/validate-npm-exec';\nimport { getYarnVersion } from './core-diagnoses/validate-yarn-exec';\n\nexport async function runDoctorOnScope(scope: Scope, diagnosisName?: string): Promise<DoctorResponse> {\n registerCoreAndExtensionsDiagnoses();\n\n // Set the scope as remote scope so diagnoses can access it\n setRemoteScope(scope);\n\n try {\n const doctorRegistrar = DoctorRegistrar.getInstance();\n\n let examineResults: ExamineResult[];\n\n if (diagnosisName) {\n // Run single diagnosis\n const diagnosis = doctorRegistrar.getDiagnosisByName(diagnosisName);\n if (!diagnosis) {\n throw new Error(`Diagnosis \"${diagnosisName}\" not found`);\n }\n const result = await diagnosis.examine();\n examineResults = [result];\n } else {\n // Run all diagnoses\n const examineResultsWithNulls = await Promise.all(\n doctorRegistrar.diagnoses.map(async (diagnosis) => {\n try {\n return await diagnosis.examine();\n } catch (err: any) {\n // Log error but continue with other diagnoses\n logger.error(`doctor failed running diagnosis \"${diagnosis.name}\"`, err);\n return null;\n }\n })\n );\n examineResults = compact(examineResultsWithNulls);\n }\n\n // Generate metadata for this scope\n const metaData = await getEnvMeta();\n\n return { examineResults, metaData };\n } finally {\n // Clear remote scope context\n setRemoteScope(undefined);\n }\n}\n\nasync function getEnvMeta(): Promise<DoctorMetaData> {\n const name = getConfig(CFG_USER_NAME_KEY) || '';\n const email = getConfig(CFG_USER_EMAIL_KEY) || '';\n\n return {\n nodeVersion: process.version,\n runningTimestamp: Date.now(),\n platform: os.platform(),\n bitVersion: getBitVersion(),\n npmVersion: await getNpmVersion(),\n yarnVersion: await getYarnVersion(),\n userDetails: `${name}<${email}>`,\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,wBAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,uBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,eAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,cAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA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C,CAAC;IACjCC,WAAW,EAAE,MAAM,IAAAC,kCAAc,EAAC,CAAC;IACnCC,WAAW,EAAE,GAAGvB,IAAI,IAAIO,KAAK;EAC/B,CAAC;AACH","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/doctor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.488",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/harmony/doctor",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "doctor",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.488"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
13
13
|
"table": "6.7.3",
|
|
14
|
+
"graphql-tag": "2.12.1",
|
|
14
15
|
"fs-extra": "10.0.0",
|
|
15
16
|
"lodash": "4.17.21",
|
|
16
17
|
"tar-fs": "2.1.3",
|
|
@@ -18,26 +19,30 @@
|
|
|
18
19
|
"glob": "7.1.6",
|
|
19
20
|
"semver": "7.7.1",
|
|
20
21
|
"execa": "2.1.0",
|
|
21
|
-
"@teambit/cli": "0.0.1283",
|
|
22
22
|
"@teambit/harmony": "0.4.7",
|
|
23
23
|
"@teambit/bit.get-bit-version": "0.0.10",
|
|
24
|
-
"@teambit/config-store": "0.0.163",
|
|
25
|
-
"@teambit/legacy.bit-map": "0.0.141",
|
|
26
24
|
"@teambit/legacy.constants": "0.0.19",
|
|
27
|
-
"@teambit/legacy.consumer-config": "0.0.84",
|
|
28
25
|
"@teambit/legacy.utils": "0.0.28",
|
|
29
|
-
"@teambit/logger": "0.0.1376",
|
|
30
26
|
"@teambit/scope.modules.find-scope-path": "0.0.20",
|
|
31
27
|
"@teambit/toolbox.fs.extension-getter": "0.0.8",
|
|
32
28
|
"@teambit/workspace.modules.workspace-locator": "0.0.20",
|
|
33
|
-
"@teambit/legacy.
|
|
34
|
-
"@teambit/legacy.scope": "0.0.84",
|
|
29
|
+
"@teambit/legacy.logger": "0.0.30",
|
|
35
30
|
"@teambit/component-id": "1.2.4",
|
|
36
31
|
"@teambit/bvm.list": "0.1.15",
|
|
37
32
|
"@teambit/git.modules.git-executable": "0.0.20",
|
|
38
|
-
"@teambit/legacy.logger": "0.0.30",
|
|
39
33
|
"@teambit/bit-error": "0.0.404",
|
|
40
|
-
"@teambit/
|
|
34
|
+
"@teambit/cli": "0.0.1285",
|
|
35
|
+
"@teambit/legacy.scope": "0.0.86",
|
|
36
|
+
"@teambit/graphql": "1.0.804",
|
|
37
|
+
"@teambit/scope": "1.0.804",
|
|
38
|
+
"@teambit/config-store": "0.0.165",
|
|
39
|
+
"@teambit/legacy.bit-map": "0.0.143",
|
|
40
|
+
"@teambit/legacy.consumer-config": "0.0.86",
|
|
41
|
+
"@teambit/legacy.consumer": "0.0.86",
|
|
42
|
+
"@teambit/logger": "0.0.1378",
|
|
43
|
+
"@teambit/scope.network": "0.0.86",
|
|
44
|
+
"@teambit/scope.remotes": "0.0.86",
|
|
45
|
+
"@teambit/objects": "0.0.311"
|
|
41
46
|
},
|
|
42
47
|
"devDependencies": {
|
|
43
48
|
"@types/fs-extra": "9.0.7",
|
|
File without changes
|