@teambit/component-issues 0.0.136 → 0.0.138
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/circular-dependencies.ts +11 -0
- package/component-issue.ts +75 -0
- package/dist/circular-dependencies.js +12 -26
- package/dist/circular-dependencies.js.map +1 -1
- package/dist/component-issue.js +57 -79
- package/dist/component-issue.js.map +1 -1
- package/dist/duplicate-component-and-package.js +12 -26
- package/dist/duplicate-component-and-package.js.map +1 -1
- package/dist/external-env-without-version.js +15 -29
- package/dist/external-env-without-version.js.map +1 -1
- package/dist/import-non-main-files.js +10 -23
- package/dist/import-non-main-files.js.map +1 -1
- package/dist/index.js +10 -81
- package/dist/index.js.map +1 -1
- package/dist/issues-list.js +131 -263
- package/dist/issues-list.js.map +1 -1
- package/dist/legacy-inside-harmony.js +12 -26
- package/dist/legacy-inside-harmony.js.map +1 -1
- package/dist/merge-config-has-conflict.js +12 -26
- package/dist/merge-config-has-conflict.js.map +1 -1
- package/dist/missing-dependencies-on-fs.js +9 -22
- package/dist/missing-dependencies-on-fs.js.map +1 -1
- package/dist/missing-dists.js +12 -26
- package/dist/missing-dists.js.map +1 -1
- package/dist/missing-links-from-nm-to-src.js +12 -26
- package/dist/missing-links-from-nm-to-src.js.map +1 -1
- package/dist/missing-manually-configured-packages.js +12 -26
- package/dist/missing-manually-configured-packages.js.map +1 -1
- package/dist/missing-packages-dependencies-on-fs.js +14 -25
- package/dist/missing-packages-dependencies-on-fs.js.map +1 -1
- package/dist/multiple-envs.js +12 -27
- package/dist/multiple-envs.js.map +1 -1
- package/dist/non-loaded-env.js +12 -26
- package/dist/non-loaded-env.js.map +1 -1
- package/dist/parse-errors.js +9 -22
- package/dist/parse-errors.js.map +1 -1
- package/dist/relative-components-authored.js +36 -55
- package/dist/relative-components-authored.js.map +1 -1
- package/dist/relative-components.js +13 -26
- package/dist/relative-components.js.map +1 -1
- package/dist/removed-dependencies.js +12 -27
- package/dist/removed-dependencies.js.map +1 -1
- package/dist/resolve-errors.js +9 -22
- package/dist/resolve-errors.js.map +1 -1
- package/dist/tsconfig.json +32 -0
- package/dist/untracked-dependencies.js +32 -47
- package/dist/untracked-dependencies.js.map +1 -1
- package/duplicate-component-and-package.ts +11 -0
- package/external-env-without-version.ts +19 -0
- package/import-non-main-files.ts +8 -0
- package/index.ts +5 -0
- package/issues-list.ts +162 -0
- package/legacy-inside-harmony.ts +11 -0
- package/merge-config-has-conflict.ts +11 -0
- package/missing-dependencies-on-fs.ts +7 -0
- package/missing-dists.ts +11 -0
- package/missing-links-from-nm-to-src.ts +11 -0
- package/missing-manually-configured-packages.ts +10 -0
- package/missing-packages-dependencies-on-fs.ts +18 -0
- package/multiple-envs.ts +12 -0
- package/non-loaded-env.ts +11 -0
- package/package.json +7 -39
- package/parse-errors.ts +7 -0
- package/relative-components-authored.ts +49 -0
- package/relative-components.ts +12 -0
- package/removed-dependencies.ts +11 -0
- package/resolve-errors.ts +7 -0
- package/tsconfig.json +2 -11
- package/untracked-dependencies.ts +41 -0
- /package/dist/{preview-1703387662836.js → preview-1703647408454.js} +0 -0
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.RemovedDependencies = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
constructor(...args) {
|
|
19
|
-
super(...args);
|
|
20
|
-
_defineProperty(this, "description", 'removed dependencies');
|
|
21
|
-
_defineProperty(this, "solution", 'run "bit install <missing-dep>" or remove any unneeded references to that component from your code');
|
|
22
|
-
_defineProperty(this, "data", void 0);
|
|
23
|
-
// deps ids
|
|
24
|
-
_defineProperty(this, "isTagBlocker", true);
|
|
25
|
-
}
|
|
26
|
-
dataToString() {
|
|
27
|
-
return _componentIssue().ISSUE_FORMAT_SPACE + this.data.join(', ');
|
|
28
|
-
}
|
|
4
|
+
const component_issue_1 = require("./component-issue");
|
|
5
|
+
class RemovedDependencies extends component_issue_1.ComponentIssue {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.description = 'removed dependencies';
|
|
9
|
+
this.solution = 'run "bit install <missing-dep>" or remove any unneeded references to that component from your code';
|
|
10
|
+
this.isTagBlocker = true;
|
|
11
|
+
}
|
|
12
|
+
dataToString() {
|
|
13
|
+
return component_issue_1.ISSUE_FORMAT_SPACE + this.data.join(', ');
|
|
14
|
+
}
|
|
29
15
|
}
|
|
30
16
|
exports.RemovedDependencies = RemovedDependencies;
|
|
31
|
-
|
|
32
17
|
//# sourceMappingURL=removed-dependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"removed-dependencies.js","sourceRoot":"","sources":["../removed-dependencies.ts"],"names":[],"mappings":";;;AAAA,uDAAuE;AAEvE,MAAa,mBAAoB,SAAQ,gCAAc;IAAvD;;QACE,gBAAW,GAAG,sBAAsB,CAAC;QACrC,aAAQ,GAAG,oGAAoG,CAAC;QAEhH,iBAAY,GAAG,IAAI,CAAC;IAItB,CAAC;IAHC,YAAY;QACV,OAAO,oCAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;CACF;AARD,kDAQC"}
|
package/dist/resolve-errors.js
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ResolveErrors = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
16
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
|
-
class ResolveErrors extends _componentIssue().ComponentIssue {
|
|
18
|
-
constructor(...args) {
|
|
19
|
-
super(...args);
|
|
20
|
-
_defineProperty(this, "description", 'error found while resolving the file dependencies');
|
|
21
|
-
_defineProperty(this, "solution", 'see the log for the full error');
|
|
22
|
-
_defineProperty(this, "data", {});
|
|
23
|
-
}
|
|
4
|
+
const component_issue_1 = require("./component-issue");
|
|
5
|
+
class ResolveErrors extends component_issue_1.ComponentIssue {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.description = 'error found while resolving the file dependencies';
|
|
9
|
+
this.solution = 'see the log for the full error';
|
|
10
|
+
this.data = {};
|
|
11
|
+
}
|
|
24
12
|
}
|
|
25
13
|
exports.ResolveErrors = ResolveErrors;
|
|
26
|
-
|
|
27
14
|
//# sourceMappingURL=resolve-errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolve-errors.js","sourceRoot":"","sources":["../resolve-errors.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAEnD,MAAa,aAAc,SAAQ,gCAAc;IAAjD;;QACE,gBAAW,GAAG,mDAAmD,CAAC;QAClE,aAAQ,GAAG,gCAAgC,CAAC;QAC5C,SAAI,GAAmC,EAAE,CAAC;IAC5C,CAAC;CAAA;AAJD,sCAIC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"es2019",
|
|
5
|
+
"DOM",
|
|
6
|
+
"ES6",
|
|
7
|
+
"DOM.Iterable"
|
|
8
|
+
],
|
|
9
|
+
"target": "es2015",
|
|
10
|
+
"module": "CommonJS",
|
|
11
|
+
"jsx": "react",
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"composite": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"outDir": "dist",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"esModuleInterop": true,
|
|
21
|
+
"rootDir": ".",
|
|
22
|
+
"resolveJsonModule": true
|
|
23
|
+
},
|
|
24
|
+
"exclude": [
|
|
25
|
+
"dist",
|
|
26
|
+
"package.json"
|
|
27
|
+
],
|
|
28
|
+
"include": [
|
|
29
|
+
"**/*",
|
|
30
|
+
"**/*.json"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -1,54 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.UntrackedDependencies = exports.MISSING_NESTED_DEPS_SPACE = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
super(...args);
|
|
29
|
-
_defineProperty(this, "description", 'untracked file dependencies');
|
|
30
|
-
_defineProperty(this, "solution", 'use "bit add <file>" to track untracked files as components');
|
|
31
|
-
_defineProperty(this, "data", {});
|
|
32
|
-
}
|
|
33
|
-
dataToString() {
|
|
34
|
-
return Object.keys(this.data).map(k => {
|
|
35
|
-
let space = _componentIssue().ISSUE_FORMAT_SPACE;
|
|
36
|
-
if (this.data[k].nested) {
|
|
37
|
-
space = MISSING_NESTED_DEPS_SPACE;
|
|
38
|
-
}
|
|
39
|
-
return `${space}${k} -> ${untrackedFilesComponentIssueToString(this.data[k])}`;
|
|
40
|
-
}).join('\n');
|
|
41
|
-
}
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const component_issue_1 = require("./component-issue");
|
|
9
|
+
exports.MISSING_NESTED_DEPS_SPACE = ' '.repeat(component_issue_1.ISSUE_FORMAT_SPACE_COUNT + 2);
|
|
10
|
+
class UntrackedDependencies extends component_issue_1.ComponentIssue {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.description = 'untracked file dependencies';
|
|
14
|
+
this.solution = 'use "bit add <file>" to track untracked files as components';
|
|
15
|
+
this.data = {};
|
|
16
|
+
}
|
|
17
|
+
dataToString() {
|
|
18
|
+
return Object.keys(this.data)
|
|
19
|
+
.map((k) => {
|
|
20
|
+
let space = component_issue_1.ISSUE_FORMAT_SPACE;
|
|
21
|
+
if (this.data[k].nested) {
|
|
22
|
+
space = exports.MISSING_NESTED_DEPS_SPACE;
|
|
23
|
+
}
|
|
24
|
+
return `${space}${k} -> ${untrackedFilesComponentIssueToString(this.data[k])}`;
|
|
25
|
+
})
|
|
26
|
+
.join('\n');
|
|
27
|
+
}
|
|
42
28
|
}
|
|
43
29
|
exports.UntrackedDependencies = UntrackedDependencies;
|
|
44
30
|
function untrackedFilesComponentIssueToString(value) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
const colorizedMap = value.untrackedFiles.map((curr) => {
|
|
32
|
+
if (curr.existing) {
|
|
33
|
+
return `${chalk_1.default.yellow(curr.relativePath)}`;
|
|
34
|
+
}
|
|
35
|
+
return curr.relativePath;
|
|
36
|
+
});
|
|
37
|
+
return colorizedMap.join(', ');
|
|
52
38
|
}
|
|
53
|
-
|
|
54
39
|
//# sourceMappingURL=untracked-dependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"untracked-dependencies.js","sourceRoot":"","sources":["../untracked-dependencies.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uDAAiG;AAEpF,QAAA,yBAAyB,GAAG,GAAG,CAAC,MAAM,CAAC,0CAAwB,GAAG,CAAC,CAAC,CAAC;AAYlF,MAAa,qBAAsB,SAAQ,gCAAc;IAAzD;;QACE,gBAAW,GAAG,6BAA6B,CAAC;QAC5C,aAAQ,GAAG,6DAA6D,CAAC;QACzE,SAAI,GAAyD,EAAE,CAAC;IAYlE,CAAC;IAXC,YAAY;QACV,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;aAC1B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,IAAI,KAAK,GAAG,oCAAkB,CAAC;YAC/B,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE;gBACvB,KAAK,GAAG,iCAAyB,CAAC;aACnC;YACD,OAAO,GAAG,KAAK,GAAG,CAAC,OAAO,oCAAoC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF;AAfD,sDAeC;AAED,SAAS,oCAAoC,CAAC,KAAmC;IAC/E,MAAM,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACrD,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,GAAG,eAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;SAC7C;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentIssue, ISSUE_FORMAT_SPACE } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class DuplicateComponentAndPackage extends ComponentIssue {
|
|
4
|
+
description = 'tracked component added as a package';
|
|
5
|
+
solution = 'either remove the package from the workspace.jsonc (bit uninstall) or remove the component (bit remove)';
|
|
6
|
+
data: string;
|
|
7
|
+
isTagBlocker = true;
|
|
8
|
+
dataToString() {
|
|
9
|
+
return ISSUE_FORMAT_SPACE + this.data;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentIssue, ISSUE_FORMAT_SPACE } from './component-issue';
|
|
2
|
+
|
|
3
|
+
type DataType = {
|
|
4
|
+
envId: string;
|
|
5
|
+
componentId: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export class ExternalEnvWithoutVersion extends ComponentIssue {
|
|
9
|
+
description = 'failed loading env - external env without a version';
|
|
10
|
+
data: DataType;
|
|
11
|
+
solution = '';
|
|
12
|
+
isTagBlocker = true;
|
|
13
|
+
formatSolution(): string {
|
|
14
|
+
return `(run "bit env set ${this.data.componentId} ${this.data.envId}")`;
|
|
15
|
+
}
|
|
16
|
+
dataToString() {
|
|
17
|
+
return ISSUE_FORMAT_SPACE + this.data.envId;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentIssue, StringsPerFilePath } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class ImportNonMainFiles extends ComponentIssue {
|
|
4
|
+
description = 'importing non-main files';
|
|
5
|
+
solution = 'the dependency should expose its API from the main file';
|
|
6
|
+
data: StringsPerFilePath = {};
|
|
7
|
+
isCacheBlocker = false;
|
|
8
|
+
}
|
package/index.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { IssuesList, IssuesClasses, IssuesNames } from './issues-list';
|
|
2
|
+
export { ISSUE_FORMAT_SPACE as MISSING_DEPS_SPACE, ComponentIssue } from './component-issue';
|
|
3
|
+
export { UntrackedFileDependencyEntry, MISSING_NESTED_DEPS_SPACE } from './untracked-dependencies';
|
|
4
|
+
export { RelativeComponentsAuthoredEntry } from './relative-components-authored';
|
|
5
|
+
export type { MissingPackagesData } from './missing-packages-dependencies-on-fs';
|
package/issues-list.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ComponentIssue, IssueObject } from './component-issue';
|
|
2
|
+
import { ImportNonMainFiles } from './import-non-main-files';
|
|
3
|
+
import { MissingDependenciesOnFs } from './missing-dependencies-on-fs';
|
|
4
|
+
import { MissingDists } from './missing-dists';
|
|
5
|
+
import { MissingPackagesDependenciesOnFs } from './missing-packages-dependencies-on-fs';
|
|
6
|
+
import { MissingManuallyConfiguredPackages } from './missing-manually-configured-packages';
|
|
7
|
+
import { ParseErrors } from './parse-errors';
|
|
8
|
+
import { RelativeComponents } from './relative-components';
|
|
9
|
+
import { RelativeComponentsAuthored } from './relative-components-authored';
|
|
10
|
+
import { ResolveErrors } from './resolve-errors';
|
|
11
|
+
import { UntrackedDependencies } from './untracked-dependencies';
|
|
12
|
+
import { LegacyInsideHarmony } from './legacy-inside-harmony';
|
|
13
|
+
import { MultipleEnvs } from './multiple-envs';
|
|
14
|
+
import { MissingLinksFromNodeModulesToSrc } from './missing-links-from-nm-to-src';
|
|
15
|
+
import { CircularDependencies } from './circular-dependencies';
|
|
16
|
+
import { DuplicateComponentAndPackage } from './duplicate-component-and-package';
|
|
17
|
+
import { MergeConfigHasConflict } from './merge-config-has-conflict';
|
|
18
|
+
import { NonLoadedEnv } from './non-loaded-env';
|
|
19
|
+
import { ExternalEnvWithoutVersion } from './external-env-without-version';
|
|
20
|
+
import { RemovedDependencies } from './removed-dependencies';
|
|
21
|
+
|
|
22
|
+
export const IssuesClasses = {
|
|
23
|
+
MissingPackagesDependenciesOnFs,
|
|
24
|
+
MissingManuallyConfiguredPackages,
|
|
25
|
+
UntrackedDependencies,
|
|
26
|
+
ResolveErrors,
|
|
27
|
+
RelativeComponents,
|
|
28
|
+
RelativeComponentsAuthored,
|
|
29
|
+
ParseErrors,
|
|
30
|
+
MissingDists,
|
|
31
|
+
LegacyInsideHarmony,
|
|
32
|
+
MissingDependenciesOnFs,
|
|
33
|
+
ImportNonMainFiles,
|
|
34
|
+
MultipleEnvs,
|
|
35
|
+
MissingLinksFromNodeModulesToSrc,
|
|
36
|
+
CircularDependencies,
|
|
37
|
+
DuplicateComponentAndPackage,
|
|
38
|
+
MergeConfigHasConflict,
|
|
39
|
+
NonLoadedEnv,
|
|
40
|
+
ExternalEnvWithoutVersion,
|
|
41
|
+
RemovedDependencies,
|
|
42
|
+
};
|
|
43
|
+
export type IssuesNames = keyof typeof IssuesClasses;
|
|
44
|
+
|
|
45
|
+
export class IssuesList {
|
|
46
|
+
constructor(
|
|
47
|
+
/**
|
|
48
|
+
* only reason to have "issues" as public is to avoid the error "Types have separate declarations of a private property"
|
|
49
|
+
* because it is used in the legacy as well. it's possible to remove it from bit-repo and install as a package, but it's not
|
|
50
|
+
* convenient for now.
|
|
51
|
+
*/
|
|
52
|
+
public _issues: ComponentIssue[] = []
|
|
53
|
+
) {}
|
|
54
|
+
|
|
55
|
+
get count() {
|
|
56
|
+
return this._issues.length;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
isEmpty() {
|
|
60
|
+
return this._issues.length === 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
outputForCLI() {
|
|
64
|
+
return this._issues.map((issue) => issue.outputForCLI()).join('');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
toObject(): { type: string; description: string; data: any }[] {
|
|
68
|
+
return this._issues.map((issue) => issue.toObject());
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated use toObjectIncludeDataAsString instead
|
|
73
|
+
* this method changes the "data" prop to string, which can be unexpected, and at times both are needed, the raw and the string.
|
|
74
|
+
* if you change to use `toObjectIncludeDataAsString`, make sure to call "dataAsString" instead of "data" when needed.
|
|
75
|
+
*/
|
|
76
|
+
toObjectWithDataAsString(): { type: string; description: string; data: string }[] {
|
|
77
|
+
return this._issues.map((issue) => ({
|
|
78
|
+
...issue.toObject(),
|
|
79
|
+
data: issue.dataToString().trim(),
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
add(issue: ComponentIssue) {
|
|
84
|
+
this._issues.push(issue);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
delete(IssueClass: typeof ComponentIssue) {
|
|
88
|
+
this._issues = this._issues.filter((issue) => issue.constructor.name !== IssueClass.name);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Use getIssueByName to prevent issues when getting different instances while using both bit from bvm and from the repo
|
|
93
|
+
* @param IssueClass
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
getIssue<T extends ComponentIssue>(IssueClass: { new (): T }): T | undefined {
|
|
97
|
+
return this._issues.find((issue) => issue instanceof IssueClass) as T | undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
getIssueByName<T extends ComponentIssue>(issueType: IssuesNames): T | undefined {
|
|
101
|
+
return this._issues.find((issue) => issue.constructor.name === issueType) as T | undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
getAllIssues(): ComponentIssue[] {
|
|
105
|
+
return this._issues;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
getAllIssueNames(): string[] {
|
|
109
|
+
return this._issues.map((issue) => issue.constructor.name);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
createIssue<T extends ComponentIssue>(IssueClass: { new (): T }): T {
|
|
113
|
+
const newIssue = new IssueClass();
|
|
114
|
+
this.add(newIssue);
|
|
115
|
+
return newIssue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
getOrCreate<T extends ComponentIssue>(IssueClass: { new (): T }): T {
|
|
119
|
+
return this.getIssue(IssueClass) || this.createIssue(IssueClass);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
shouldBlockSavingInCache(): boolean {
|
|
123
|
+
return this._issues.some((issue) => issue.isCacheBlocker);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
shouldBlockTagging(): boolean {
|
|
127
|
+
return this._issues.some((issue) => issue.isTagBlocker);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
filterNonTagBlocking(): IssuesList {
|
|
131
|
+
return new IssuesList(this._issues.filter((issue) => issue.isTagBlocker));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
toObjectIncludeDataAsString(): Array<IssueObject & { dataAsString: string }> {
|
|
135
|
+
return this._issues.map((issue) => ({
|
|
136
|
+
...issue.toObject(),
|
|
137
|
+
dataAsString: issue.dataToString(),
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
serialize() {
|
|
142
|
+
return this._issues.map((issue) => ({ type: issue.constructor.name, data: issue.serialize() }));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static deserialize(data: Record<string, any>) {
|
|
146
|
+
if (!Array.isArray(data)) {
|
|
147
|
+
// probably old format, ignore it and return an empty IssuesList
|
|
148
|
+
return new IssuesList();
|
|
149
|
+
}
|
|
150
|
+
const issues = data.map((issue) => {
|
|
151
|
+
const ClassName = issue.type;
|
|
152
|
+
if (!Object.keys(IssuesClasses).includes(ClassName)) {
|
|
153
|
+
throw new Error(`issue type "${ClassName}" is not recognized.
|
|
154
|
+
the following are permitted ${Object.keys(IssuesClasses).join(', ')}`);
|
|
155
|
+
}
|
|
156
|
+
const issueInstance: ComponentIssue = new IssuesClasses[ClassName]();
|
|
157
|
+
issueInstance.data = issueInstance.deserialize(issue.data);
|
|
158
|
+
return issueInstance;
|
|
159
|
+
});
|
|
160
|
+
return new IssuesList(issues);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentIssue, formatTitle } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class LegacyInsideHarmony extends ComponentIssue {
|
|
4
|
+
description = 'legacy component inside Harmony workspace';
|
|
5
|
+
solution = 'remove the component and re-create it via Harmony';
|
|
6
|
+
data: boolean;
|
|
7
|
+
isTagBlocker = true;
|
|
8
|
+
outputForCLI() {
|
|
9
|
+
return formatTitle(this.descriptionWithSolution, false);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentIssue, formatTitle } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class MergeConfigHasConflict extends ComponentIssue {
|
|
4
|
+
description = 'merge-conflict file has unresolved conflicts';
|
|
5
|
+
solution = `edit the merge-conflict file in the workspace root and resolve the conflicts`;
|
|
6
|
+
data: boolean;
|
|
7
|
+
isTagBlocker = true;
|
|
8
|
+
outputForCLI() {
|
|
9
|
+
return formatTitle(this.descriptionWithSolution, false);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentIssue, StringsPerFilePath } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class MissingDependenciesOnFs extends ComponentIssue {
|
|
4
|
+
description = 'non-existing dependency files';
|
|
5
|
+
solution = 'make sure all files exists on your workspace';
|
|
6
|
+
data: StringsPerFilePath = {};
|
|
7
|
+
}
|
package/missing-dists.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentIssue, formatTitle } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class MissingDists extends ComponentIssue {
|
|
4
|
+
description = 'missing dists';
|
|
5
|
+
solution = 'run "bit compile"';
|
|
6
|
+
data: boolean;
|
|
7
|
+
isTagBlocker = false;
|
|
8
|
+
outputForCLI() {
|
|
9
|
+
return formatTitle(this.descriptionWithSolution, false);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentIssue, formatTitle } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class MissingLinksFromNodeModulesToSrc extends ComponentIssue {
|
|
4
|
+
description = 'missing links from node_modules to source';
|
|
5
|
+
solution = 'run "bit link"';
|
|
6
|
+
data: boolean;
|
|
7
|
+
isTagBlocker = false;
|
|
8
|
+
outputForCLI() {
|
|
9
|
+
return formatTitle(this.descriptionWithSolution, false);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentIssue, ISSUE_FORMAT_SPACE } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class MissingManuallyConfiguredPackages extends ComponentIssue {
|
|
4
|
+
description = `missing packages that were manually set`;
|
|
5
|
+
solution = `run "bit install"`;
|
|
6
|
+
data: string[] = []; // package names
|
|
7
|
+
dataToString() {
|
|
8
|
+
return ISSUE_FORMAT_SPACE + this.data.join(', ');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentIssue, ISSUE_FORMAT_SPACE } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export type MissingPackagesData = {
|
|
4
|
+
filePath: string;
|
|
5
|
+
isDevFile: boolean;
|
|
6
|
+
missingPackages: string[];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export class MissingPackagesDependenciesOnFs extends ComponentIssue {
|
|
10
|
+
description = `missing packages or links from node_modules to the source`;
|
|
11
|
+
solution = `run "bit install --add-missing-deps" to fix both issues`;
|
|
12
|
+
data: MissingPackagesData[] = [];
|
|
13
|
+
dataToString(): string {
|
|
14
|
+
return this.data
|
|
15
|
+
.map((d) => `${ISSUE_FORMAT_SPACE}${d.filePath} -> ${this.formatDataFunction(d.missingPackages)}`)
|
|
16
|
+
.join('\n');
|
|
17
|
+
}
|
|
18
|
+
}
|
package/multiple-envs.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentIssue, ISSUE_FORMAT_SPACE } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class MultipleEnvs extends ComponentIssue {
|
|
4
|
+
description = 'multiple envs';
|
|
5
|
+
solution =
|
|
6
|
+
'set the desired env by running "bit env set <component> <env>", if it doesn\'t work, run "bit aspect unset <component> <unwanted-env-id>". to keep troubleshooting run "bit aspect list <component-id>"';
|
|
7
|
+
data: string[]; // env ids
|
|
8
|
+
isTagBlocker = true;
|
|
9
|
+
dataToString() {
|
|
10
|
+
return ISSUE_FORMAT_SPACE + this.data.join(', ');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentIssue, ISSUE_FORMAT_SPACE } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class NonLoadedEnv extends ComponentIssue {
|
|
4
|
+
description = 'failed loading env';
|
|
5
|
+
solution = `run "bit install"`;
|
|
6
|
+
data: string;
|
|
7
|
+
isTagBlocker = true;
|
|
8
|
+
dataToString() {
|
|
9
|
+
return ISSUE_FORMAT_SPACE + this.data;
|
|
10
|
+
}
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,59 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component-issues",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.138",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/component-issues",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component-issues",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.138"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
13
|
-
"core-js": "^3.0.0",
|
|
14
|
-
"@babel/runtime": "7.20.0",
|
|
15
13
|
"@teambit/component-id": "1.2.0"
|
|
16
14
|
},
|
|
17
15
|
"devDependencies": {
|
|
18
16
|
"@types/mocha": "9.1.0",
|
|
17
|
+
"@types/jest": "26.0.20",
|
|
19
18
|
"@types/node": "12.20.4",
|
|
20
|
-
"@
|
|
21
|
-
"@types/react-dom": "^17.0.5",
|
|
22
|
-
"@types/jest": "^26.0.0",
|
|
23
|
-
"@types/testing-library__jest-dom": "5.9.5"
|
|
19
|
+
"@babel/runtime": "7.20.0"
|
|
24
20
|
},
|
|
25
21
|
"peerDependencies": {
|
|
26
|
-
"@teambit/legacy": "1.0.
|
|
27
|
-
"react": "^16.8.0 || ^17.0.0",
|
|
28
|
-
"react-dom": "^16.8.0 || ^17.0.0"
|
|
22
|
+
"@teambit/legacy": "1.0.624"
|
|
29
23
|
},
|
|
30
|
-
"license": "
|
|
24
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
31
25
|
"optionalDependencies": {},
|
|
32
|
-
"peerDependenciesMeta": {}
|
|
33
|
-
"exports": {
|
|
34
|
-
"node": {
|
|
35
|
-
"require": "./dist/index.js",
|
|
36
|
-
"import": "./dist/esm.mjs"
|
|
37
|
-
},
|
|
38
|
-
"default": "./dist/index.js"
|
|
39
|
-
},
|
|
40
|
-
"private": false,
|
|
41
|
-
"engines": {
|
|
42
|
-
"node": ">=12.22.0"
|
|
43
|
-
},
|
|
44
|
-
"repository": {
|
|
45
|
-
"type": "git",
|
|
46
|
-
"url": "https://github.com/teambit/bit"
|
|
47
|
-
},
|
|
48
|
-
"keywords": [
|
|
49
|
-
"bit",
|
|
50
|
-
"bit-aspect",
|
|
51
|
-
"components",
|
|
52
|
-
"collaboration",
|
|
53
|
-
"web",
|
|
54
|
-
"react",
|
|
55
|
-
"react-components",
|
|
56
|
-
"angular",
|
|
57
|
-
"angular-components"
|
|
58
|
-
]
|
|
26
|
+
"peerDependenciesMeta": {}
|
|
59
27
|
}
|