@teambit/status 1.0.108 → 1.0.109
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/artifacts/preview/teambit_component_status-preview.js +1 -0
- package/dist/mini-status-cmd.d.ts +1 -1
- package/package.json +10 -10
- package/index.ts +0 -5
- package/mini-status-cmd.ts +0 -69
- package/status-cmd.ts +0 -392
- package/status.aspect.ts +0 -5
- package/status.main.runtime.ts +0 -260
- /package/dist/{preview-1703647408454.js → preview-1703698405864.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["teambit.component/status-preview"]=o():e["teambit.component/status-preview"]=o()}(self,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{compositions:()=>t,compositions_metadata:()=>n,overview:()=>r});const t=[],r=[],n={compositions:[]};return o})()));
|
|
@@ -24,7 +24,7 @@ export declare class MiniStatusCmd implements Command {
|
|
|
24
24
|
newComps: string[];
|
|
25
25
|
compWithIssues: {
|
|
26
26
|
id: string;
|
|
27
|
-
issues: (import("@teambit/component-issues/component-issue").IssueObject & {
|
|
27
|
+
issues: (import("@teambit/legacy/components/component-issues/component-issue").IssueObject & {
|
|
28
28
|
dataAsString: string;
|
|
29
29
|
})[];
|
|
30
30
|
}[];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/status",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/status",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "status",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.109"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
"@teambit/component-version": "1.0.3",
|
|
18
18
|
"@teambit/harmony": "0.4.6",
|
|
19
19
|
"@teambit/lane-id": "0.0.311",
|
|
20
|
-
"@teambit/cli": "0.0.
|
|
20
|
+
"@teambit/cli": "0.0.841",
|
|
21
21
|
"@teambit/component-issues": "0.0.138",
|
|
22
|
-
"@teambit/component": "1.0.
|
|
23
|
-
"@teambit/insights": "1.0.
|
|
24
|
-
"@teambit/issues": "1.0.
|
|
25
|
-
"@teambit/lanes": "1.0.
|
|
26
|
-
"@teambit/remove": "1.0.
|
|
27
|
-
"@teambit/workspace": "1.0.
|
|
22
|
+
"@teambit/component": "1.0.109",
|
|
23
|
+
"@teambit/insights": "1.0.109",
|
|
24
|
+
"@teambit/issues": "1.0.109",
|
|
25
|
+
"@teambit/lanes": "1.0.109",
|
|
26
|
+
"@teambit/remove": "1.0.109",
|
|
27
|
+
"@teambit/workspace": "1.0.109"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/lodash": "4.14.165",
|
|
31
31
|
"@types/mocha": "9.1.0",
|
|
32
32
|
"@types/jest": "^29.2.2",
|
|
33
33
|
"@types/testing-library__jest-dom": "^5.9.5",
|
|
34
|
-
"@teambit/harmony.envs.core-aspect-env": "0.0.
|
|
34
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.14"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@teambit/legacy": "1.0.624"
|
package/index.ts
DELETED
package/mini-status-cmd.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
-
import { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';
|
|
3
|
-
import { ComponentID } from '@teambit/component-id';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import { StatusMain } from './status.main.runtime';
|
|
6
|
-
|
|
7
|
-
export type MiniStatusOpts = {
|
|
8
|
-
showIssues?: boolean;
|
|
9
|
-
ignoreCircularDependencies?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export class MiniStatusCmd implements Command {
|
|
13
|
-
name = 'mini-status [component-pattern]';
|
|
14
|
-
description = 'EXPERIMENTAL. basic status for fast execution';
|
|
15
|
-
extendedDescription = `shows only modified/new components with code changes. for the full status, use "bit status".
|
|
16
|
-
this command only checks source code changes, it doesn't check for config/aspect/dependency changes`;
|
|
17
|
-
arguments = [
|
|
18
|
-
{
|
|
19
|
-
name: 'component-pattern',
|
|
20
|
-
description: COMPONENT_PATTERN_HELP,
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
group = 'development';
|
|
24
|
-
alias = 'ms';
|
|
25
|
-
options = [
|
|
26
|
-
['', 'show-issues', 'show component issues (slows down the command)'],
|
|
27
|
-
[
|
|
28
|
-
'c',
|
|
29
|
-
'ignore-circular-dependencies',
|
|
30
|
-
'do not check for circular dependencies to get the results quicker (relevant when --show-issues flag is used)',
|
|
31
|
-
],
|
|
32
|
-
['j', 'json', 'json format'],
|
|
33
|
-
] as CommandOptions;
|
|
34
|
-
loader = true;
|
|
35
|
-
|
|
36
|
-
constructor(private status: StatusMain) {}
|
|
37
|
-
|
|
38
|
-
async report([pattern]: [string], opts: MiniStatusOpts) {
|
|
39
|
-
const { modified, newComps, compWithIssues } = await this.status.statusMini(pattern, opts);
|
|
40
|
-
const outputSection = (title: string, ids: ComponentID[]) => {
|
|
41
|
-
const titleStr = chalk.bold(title);
|
|
42
|
-
const idsStr = ids.length ? ids.map((id) => id.toStringWithoutVersion()).join('\n') : '<none>';
|
|
43
|
-
return `${titleStr}:\n${idsStr}`;
|
|
44
|
-
};
|
|
45
|
-
const outputCompWithIssues = () => {
|
|
46
|
-
if (!opts.showIssues) return '';
|
|
47
|
-
if (!compWithIssues?.length) return '<none>';
|
|
48
|
-
const titleStr = chalk.bold('\n\ncomponent with issues');
|
|
49
|
-
const issues = compWithIssues.map((c) => `${c.id.toStringWithoutVersion()}\n ${c.state.issues.outputForCLI()}`);
|
|
50
|
-
return `${titleStr}\n${issues}`;
|
|
51
|
-
};
|
|
52
|
-
const modifiedOutput = outputSection('modified components (files only)', modified);
|
|
53
|
-
const newOutput = outputSection('new components', newComps);
|
|
54
|
-
const compWithIssuesOutput = outputCompWithIssues();
|
|
55
|
-
return `${modifiedOutput}\n\n${newOutput}${compWithIssuesOutput}`;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async json([pattern]: [string], opts: MiniStatusOpts) {
|
|
59
|
-
const { modified, newComps, compWithIssues } = await this.status.statusMini(pattern, opts);
|
|
60
|
-
return {
|
|
61
|
-
modified: modified.map((m) => m.toStringWithoutVersion()),
|
|
62
|
-
newComps: newComps.map((m) => m.toStringWithoutVersion()),
|
|
63
|
-
compWithIssues: compWithIssues?.map((c) => ({
|
|
64
|
-
id: c.id.toStringWithoutVersion(),
|
|
65
|
-
issues: c.state.issues.toObjectIncludeDataAsString(),
|
|
66
|
-
})),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
package/status-cmd.ts
DELETED
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import R from 'ramda';
|
|
3
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
4
|
-
import { ComponentID } from '@teambit/component-id';
|
|
5
|
-
import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';
|
|
6
|
-
import { IssuesList } from '@teambit/component-issues';
|
|
7
|
-
import { formatBitString } from '@teambit/legacy/dist/cli/chalk-box';
|
|
8
|
-
import { getInvalidComponentLabel } from '@teambit/legacy/dist/cli/templates/component-issues-template';
|
|
9
|
-
import {
|
|
10
|
-
IMPORT_PENDING_MSG,
|
|
11
|
-
statusFailureMsg,
|
|
12
|
-
statusInvalidComponentsMsg,
|
|
13
|
-
statusWorkspaceIsCleanMsg,
|
|
14
|
-
BASE_DOCS_DOMAIN,
|
|
15
|
-
} from '@teambit/legacy/dist/constants';
|
|
16
|
-
import { compact, partition } from 'lodash';
|
|
17
|
-
import { isHash } from '@teambit/component-version';
|
|
18
|
-
import { StatusMain, StatusResult } from './status.main.runtime';
|
|
19
|
-
|
|
20
|
-
const TROUBLESHOOTING_MESSAGE = `${chalk.yellow(
|
|
21
|
-
`learn more at about Bit component: ${BASE_DOCS_DOMAIN}reference/components/component-anatomy/`
|
|
22
|
-
)}`;
|
|
23
|
-
|
|
24
|
-
type StatusFlags = { strict?: boolean; verbose?: boolean; lanes?: boolean; ignoreCircularDependencies?: boolean };
|
|
25
|
-
|
|
26
|
-
type StatusJsonResults = {
|
|
27
|
-
newComponents: string[];
|
|
28
|
-
modifiedComponents: string[];
|
|
29
|
-
stagedComponents: Array<{ id: string; versions: string[] }>;
|
|
30
|
-
unavailableOnMain: string[];
|
|
31
|
-
componentsWithIssues: Array<{
|
|
32
|
-
id: string;
|
|
33
|
-
issues: Array<{
|
|
34
|
-
type: string;
|
|
35
|
-
description: string;
|
|
36
|
-
data: any;
|
|
37
|
-
}>;
|
|
38
|
-
}>;
|
|
39
|
-
importPendingComponents: string[];
|
|
40
|
-
autoTagPendingComponents: string[];
|
|
41
|
-
invalidComponents: Array<{ id: string; error: Error }>;
|
|
42
|
-
locallySoftRemoved: string[];
|
|
43
|
-
remotelySoftRemoved: string[];
|
|
44
|
-
outdatedComponents: Array<{ id: string; headVersion: string; latestVersion?: string }>;
|
|
45
|
-
mergePendingComponents: string[];
|
|
46
|
-
componentsDuringMergeState: string[];
|
|
47
|
-
softTaggedComponents: string[];
|
|
48
|
-
snappedComponents: string[];
|
|
49
|
-
pendingUpdatesFromMain: Array<{
|
|
50
|
-
id: string;
|
|
51
|
-
divergeData: any;
|
|
52
|
-
}>;
|
|
53
|
-
updatesFromForked: Array<{
|
|
54
|
-
id: string;
|
|
55
|
-
divergeData: any;
|
|
56
|
-
}>;
|
|
57
|
-
currentLaneId: string;
|
|
58
|
-
forkedLaneId: string | undefined;
|
|
59
|
-
workspaceIssues: string[];
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export class StatusCmd implements Command {
|
|
63
|
-
name = 'status';
|
|
64
|
-
description = 'present the current status of components in the workspace, including indication of detected issues';
|
|
65
|
-
group = 'development';
|
|
66
|
-
extendedDescription: string;
|
|
67
|
-
alias = 's';
|
|
68
|
-
options = [
|
|
69
|
-
['j', 'json', 'return a json version of the component'],
|
|
70
|
-
['', 'verbose', 'show extra data: full snap hashes for staged components, and divergence point for lanes'],
|
|
71
|
-
['l', 'lanes', 'when on a lane, show updates from main and updates from forked lanes'],
|
|
72
|
-
['', 'strict', 'in case issues found, exit with code 1'],
|
|
73
|
-
['c', 'ignore-circular-dependencies', 'do not check for circular dependencies to get the results quicker'],
|
|
74
|
-
] as CommandOptions;
|
|
75
|
-
loader = true;
|
|
76
|
-
migration = true;
|
|
77
|
-
|
|
78
|
-
constructor(private status: StatusMain) {}
|
|
79
|
-
|
|
80
|
-
async json(_args, { lanes, ignoreCircularDependencies }: StatusFlags): Promise<StatusJsonResults> {
|
|
81
|
-
const {
|
|
82
|
-
newComponents,
|
|
83
|
-
modifiedComponents,
|
|
84
|
-
stagedComponents,
|
|
85
|
-
componentsWithIssues,
|
|
86
|
-
importPendingComponents,
|
|
87
|
-
autoTagPendingComponents,
|
|
88
|
-
invalidComponents,
|
|
89
|
-
locallySoftRemoved,
|
|
90
|
-
remotelySoftRemoved,
|
|
91
|
-
outdatedComponents,
|
|
92
|
-
mergePendingComponents,
|
|
93
|
-
componentsDuringMergeState,
|
|
94
|
-
softTaggedComponents,
|
|
95
|
-
snappedComponents,
|
|
96
|
-
unavailableOnMain,
|
|
97
|
-
pendingUpdatesFromMain,
|
|
98
|
-
updatesFromForked,
|
|
99
|
-
currentLaneId,
|
|
100
|
-
forkedLaneId,
|
|
101
|
-
workspaceIssues,
|
|
102
|
-
}: StatusResult = await this.status.status({ lanes, ignoreCircularDependencies });
|
|
103
|
-
return {
|
|
104
|
-
newComponents: newComponents.map((c) => c.toStringWithoutVersion()),
|
|
105
|
-
modifiedComponents: modifiedComponents.map((c) => c.toStringWithoutVersion()),
|
|
106
|
-
stagedComponents: stagedComponents.map((c) => ({ id: c.id.toStringWithoutVersion(), versions: c.versions })),
|
|
107
|
-
unavailableOnMain: unavailableOnMain.map((c) => c.toStringWithoutVersion()),
|
|
108
|
-
componentsWithIssues: componentsWithIssues.map((c) => ({
|
|
109
|
-
id: c.id.toStringWithoutVersion(),
|
|
110
|
-
issues: c.issues?.toObjectIncludeDataAsString(),
|
|
111
|
-
})),
|
|
112
|
-
importPendingComponents: importPendingComponents.map((id) => id.toStringWithoutVersion()),
|
|
113
|
-
autoTagPendingComponents: autoTagPendingComponents.map((s) => s.toStringWithoutVersion()),
|
|
114
|
-
invalidComponents: invalidComponents.map(({ id, error }) => ({ id: id.toStringWithoutVersion(), error })),
|
|
115
|
-
locallySoftRemoved: locallySoftRemoved.map((id) => id.toStringWithoutVersion()),
|
|
116
|
-
remotelySoftRemoved: remotelySoftRemoved.map((id) => id.toStringWithoutVersion()),
|
|
117
|
-
outdatedComponents: outdatedComponents.map((c) => ({ ...c, id: c.id.toStringWithoutVersion() })),
|
|
118
|
-
mergePendingComponents: mergePendingComponents.map((c) => c.id.toStringWithoutVersion()),
|
|
119
|
-
componentsDuringMergeState: componentsDuringMergeState.map((id) => id.toStringWithoutVersion()),
|
|
120
|
-
softTaggedComponents: softTaggedComponents.map((s) => s.toStringWithoutVersion()),
|
|
121
|
-
snappedComponents: snappedComponents.map((s) => s.toStringWithoutVersion()),
|
|
122
|
-
pendingUpdatesFromMain: pendingUpdatesFromMain.map((p) => ({
|
|
123
|
-
id: p.id.toStringWithoutVersion(),
|
|
124
|
-
divergeData: p.divergeData,
|
|
125
|
-
})),
|
|
126
|
-
updatesFromForked: updatesFromForked.map((p) => ({
|
|
127
|
-
id: p.id.toStringWithoutVersion(),
|
|
128
|
-
divergeData: p.divergeData,
|
|
129
|
-
})),
|
|
130
|
-
currentLaneId: currentLaneId.toString(),
|
|
131
|
-
forkedLaneId: forkedLaneId?.toString(),
|
|
132
|
-
workspaceIssues,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// eslint-disable-next-line complexity
|
|
137
|
-
async report(_args, { strict, verbose, lanes, ignoreCircularDependencies }: StatusFlags) {
|
|
138
|
-
const {
|
|
139
|
-
newComponents,
|
|
140
|
-
modifiedComponents,
|
|
141
|
-
stagedComponents,
|
|
142
|
-
componentsWithIssues,
|
|
143
|
-
importPendingComponents,
|
|
144
|
-
autoTagPendingComponents,
|
|
145
|
-
invalidComponents,
|
|
146
|
-
locallySoftRemoved,
|
|
147
|
-
remotelySoftRemoved,
|
|
148
|
-
outdatedComponents,
|
|
149
|
-
mergePendingComponents,
|
|
150
|
-
componentsDuringMergeState,
|
|
151
|
-
softTaggedComponents,
|
|
152
|
-
snappedComponents,
|
|
153
|
-
pendingUpdatesFromMain,
|
|
154
|
-
updatesFromForked,
|
|
155
|
-
unavailableOnMain,
|
|
156
|
-
currentLaneId,
|
|
157
|
-
forkedLaneId,
|
|
158
|
-
workspaceIssues,
|
|
159
|
-
}: StatusResult = await this.status.status({ lanes, ignoreCircularDependencies });
|
|
160
|
-
// If there is problem with at least one component we want to show a link to the
|
|
161
|
-
// troubleshooting doc
|
|
162
|
-
let showTroubleshootingLink = false;
|
|
163
|
-
|
|
164
|
-
function format(id: ComponentID, showIssues = false, message?: string, localVersions?: string[]): string {
|
|
165
|
-
const idWithIssues = componentsWithIssues.find((c) => c.id.isEqual(id));
|
|
166
|
-
const softTagged = softTaggedComponents.find((softTaggedId) => softTaggedId.isEqual(id));
|
|
167
|
-
|
|
168
|
-
const messageStatusText = message || 'ok';
|
|
169
|
-
const messageStatusTextWithSoftTag = softTagged ? `${messageStatusText} (soft-tagged)` : messageStatusText;
|
|
170
|
-
const color = message ? 'yellow' : 'green';
|
|
171
|
-
const messageStatus = chalk[color](messageStatusTextWithSoftTag);
|
|
172
|
-
|
|
173
|
-
if (!showIssues && !localVersions) {
|
|
174
|
-
return `${formatBitString(id.toStringWithoutVersion())} ... ${messageStatus}`;
|
|
175
|
-
}
|
|
176
|
-
let bitFormatted = `${formatBitString(id.toStringWithoutVersion())}`;
|
|
177
|
-
if (localVersions) {
|
|
178
|
-
if (verbose) {
|
|
179
|
-
bitFormatted += `. versions: ${localVersions.join(', ')}`;
|
|
180
|
-
} else {
|
|
181
|
-
const [snaps, tags] = partition(localVersions, (version) => isHash(version));
|
|
182
|
-
const tagsStr = tags.length ? `versions: ${tags.join(', ')}` : '';
|
|
183
|
-
const snapsStr = snaps.length ? `${snaps.length} snap(s)` : '';
|
|
184
|
-
bitFormatted += `. `;
|
|
185
|
-
bitFormatted += tagsStr && snapsStr ? `${tagsStr}. and ${snapsStr}` : tagsStr || snapsStr;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
bitFormatted += ' ... ';
|
|
189
|
-
if (showIssues && idWithIssues) {
|
|
190
|
-
showTroubleshootingLink = true;
|
|
191
|
-
return `${bitFormatted} ${chalk.red(statusFailureMsg)}${formatIssues(idWithIssues.issues)}`;
|
|
192
|
-
}
|
|
193
|
-
return `${bitFormatted}${messageStatus}`;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function formatCategory(title: string, description: string, compsOutput: string[]) {
|
|
197
|
-
if (!compsOutput.length) return '';
|
|
198
|
-
const titleOutput = chalk.underline.white(`${title} (${compsOutput.length})`);
|
|
199
|
-
const descOutput = description ? `${description}\n` : '';
|
|
200
|
-
return [titleOutput, descOutput, ...compsOutput].join('\n');
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const importPendingWarning = importPendingComponents.length ? chalk.yellow(`${IMPORT_PENDING_MSG}.\n`) : '';
|
|
204
|
-
|
|
205
|
-
const splitByMissing = R.groupBy((component) => {
|
|
206
|
-
return component.includes(statusFailureMsg) ? 'missing' : 'nonMissing';
|
|
207
|
-
});
|
|
208
|
-
const { missing, nonMissing } = splitByMissing(newComponents.map((c) => format(c)));
|
|
209
|
-
|
|
210
|
-
const outdatedTitle = 'pending updates';
|
|
211
|
-
const outdatedDesc =
|
|
212
|
-
'(use "bit checkout head" to merge changes)\n(use "bit diff [component_id] [new_version]" to compare changes)\n(use "bit log [component_id]" to list all available versions)';
|
|
213
|
-
const outdatedComps = outdatedComponents.map((component) => {
|
|
214
|
-
const latest =
|
|
215
|
-
component.latestVersion && component.latestVersion !== component.headVersion
|
|
216
|
-
? ` latest: ${component.latestVersion}`
|
|
217
|
-
: '';
|
|
218
|
-
return ` > ${chalk.cyan(component.id.toStringWithoutVersion())} current: ${component.id.version} head: ${
|
|
219
|
-
component.headVersion
|
|
220
|
-
}${latest}`;
|
|
221
|
-
});
|
|
222
|
-
const outdatedStr = formatCategory(outdatedTitle, outdatedDesc, outdatedComps);
|
|
223
|
-
|
|
224
|
-
const pendingMergeTitle = 'pending merge';
|
|
225
|
-
const pendingMergeDesc = `(use "bit reset" to discard local tags/snaps, and bit checkout head to re-merge with the remote.
|
|
226
|
-
alternatively, to keep local tags/snaps history, use "bit merge [component-id]")`;
|
|
227
|
-
const pendingMergeComps = mergePendingComponents.map((component) => {
|
|
228
|
-
return ` > ${chalk.cyan(component.id.toString())} local and remote have diverged and have ${
|
|
229
|
-
component.divergeData.snapsOnSourceOnly.length
|
|
230
|
-
} (source) and ${component.divergeData.snapsOnTargetOnly.length} (target) uncommon snaps respectively`;
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
const pendingMergeStr = formatCategory(pendingMergeTitle, pendingMergeDesc, pendingMergeComps);
|
|
234
|
-
|
|
235
|
-
const compDuringMergeTitle = 'components in merge state';
|
|
236
|
-
const compDuringMergeDesc = `(use "bit snap/tag [--unmerged]" to complete the merge process.
|
|
237
|
-
to cancel the merge operation, use either "bit lane merge-abort" (for prior "bit lane merge" command)
|
|
238
|
-
or use "bit merge [component-id] --abort" (for prior "bit merge" command)`;
|
|
239
|
-
const compDuringMergeComps = componentsDuringMergeState.map((c) => format(c));
|
|
240
|
-
|
|
241
|
-
const compDuringMergeStr = formatCategory(compDuringMergeTitle, compDuringMergeDesc, compDuringMergeComps);
|
|
242
|
-
|
|
243
|
-
const newComponentDescription = '\n(use "bit snap/tag" to lock a version with all your changes)\n';
|
|
244
|
-
const newComponentsTitle = newComponents.length
|
|
245
|
-
? chalk.underline.white('new components') + newComponentDescription
|
|
246
|
-
: '';
|
|
247
|
-
|
|
248
|
-
const newComponentsOutput = [newComponentsTitle, ...(nonMissing || []), ...(missing || [])].join('\n');
|
|
249
|
-
|
|
250
|
-
const modifiedDesc = '(use "bit diff" to compare changes)';
|
|
251
|
-
const modifiedComponentOutput = formatCategory(
|
|
252
|
-
'modified components',
|
|
253
|
-
modifiedDesc,
|
|
254
|
-
modifiedComponents.map((c) => format(c))
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
const autoTagPendingTitle = 'components pending auto-tag (when their modified dependencies are tagged)';
|
|
258
|
-
const autoTagPendingOutput = formatCategory(
|
|
259
|
-
autoTagPendingTitle,
|
|
260
|
-
'',
|
|
261
|
-
autoTagPendingComponents.map((c) => format(c))
|
|
262
|
-
);
|
|
263
|
-
|
|
264
|
-
const compWithIssuesDesc = '(fix the issues according to the suggested solution)';
|
|
265
|
-
const compWithIssuesOutput = formatCategory(
|
|
266
|
-
'components with issues',
|
|
267
|
-
compWithIssuesDesc,
|
|
268
|
-
componentsWithIssues.map((c) => format(c.id, true)).sort()
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
const invalidDesc = 'these components failed to load';
|
|
272
|
-
const invalidComps = invalidComponents.map((c) => format(c.id, false, getInvalidComponentLabel(c.error))).sort();
|
|
273
|
-
const invalidComponentOutput = formatCategory(statusInvalidComponentsMsg, invalidDesc, invalidComps);
|
|
274
|
-
|
|
275
|
-
const locallySoftRemovedDesc =
|
|
276
|
-
'(tag/snap and export the components to update the deletion to the remote. to undo deletion, run "bit recover")';
|
|
277
|
-
const locallySoftRemovedOutput = formatCategory(
|
|
278
|
-
'soft-removed components locally',
|
|
279
|
-
locallySoftRemovedDesc,
|
|
280
|
-
locallySoftRemoved.map((c) => format(c)).sort()
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
const remotelySoftRemovedDesc =
|
|
284
|
-
'(use "bit remove" to remove them from the workspace. use "bit recover" to undo the soft-remove)';
|
|
285
|
-
const remotelySoftRemovedOutput = formatCategory(
|
|
286
|
-
'components deleted on the remote',
|
|
287
|
-
remotelySoftRemovedDesc,
|
|
288
|
-
remotelySoftRemoved.map((c) => format(c)).sort()
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
const stagedDesc = '(use "bit export" to push these component versions to the remote scope)';
|
|
292
|
-
const stagedComps = stagedComponents.map((c) => format(c.id, false, undefined, c.versions));
|
|
293
|
-
const stagedComponentsOutput = formatCategory('staged components', stagedDesc, stagedComps);
|
|
294
|
-
|
|
295
|
-
const snappedDesc = '(use "bit tag" or "bit tag --snapped" to lock a semver version)';
|
|
296
|
-
const snappedComponentsOutput = formatCategory(
|
|
297
|
-
'snapped components (tag pending)',
|
|
298
|
-
snappedDesc,
|
|
299
|
-
snappedComponents.map((c) => format(c))
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
const unavailableOnMainDesc = '(use "bit checkout head" to make them available)';
|
|
303
|
-
const unavailableOnMainOutput = formatCategory(
|
|
304
|
-
'components unavailable on main',
|
|
305
|
-
unavailableOnMainDesc,
|
|
306
|
-
unavailableOnMain.map((c) => format(c))
|
|
307
|
-
);
|
|
308
|
-
|
|
309
|
-
const getUpdateFromMsg = (divergeData: SnapsDistance, from = 'main'): string => {
|
|
310
|
-
if (divergeData.err) return divergeData.err.message;
|
|
311
|
-
let msg = `${from} is ahead by ${divergeData.snapsOnTargetOnly.length || 0} snaps`;
|
|
312
|
-
if (divergeData.snapsOnSourceOnly && verbose) {
|
|
313
|
-
msg += ` (diverged since ${divergeData.commonSnapBeforeDiverge?.toShortString()})`;
|
|
314
|
-
}
|
|
315
|
-
return msg;
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
const updatesFromMainDesc = '(use "bit lane merge main" to merge the changes)';
|
|
319
|
-
const pendingUpdatesFromMainIds = pendingUpdatesFromMain.map((c) =>
|
|
320
|
-
format(c.id, false, getUpdateFromMsg(c.divergeData))
|
|
321
|
-
);
|
|
322
|
-
const updatesFromMainOutput = formatCategory(
|
|
323
|
-
'pending updates from main',
|
|
324
|
-
updatesFromMainDesc,
|
|
325
|
-
pendingUpdatesFromMainIds
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
let updatesFromForkedOutput = '';
|
|
329
|
-
if (forkedLaneId) {
|
|
330
|
-
const updatesFromForkedDesc = `(use "bit lane merge ${forkedLaneId.toString()}" to merge the changes
|
|
331
|
-
use "bit fetch ${forkedLaneId.toString()} --lanes" to update ${forkedLaneId.name} locally)`;
|
|
332
|
-
const pendingUpdatesFromForkedIds = updatesFromForked.map((c) =>
|
|
333
|
-
format(c.id, false, getUpdateFromMsg(c.divergeData, forkedLaneId.name))
|
|
334
|
-
);
|
|
335
|
-
updatesFromForkedOutput = formatCategory(
|
|
336
|
-
`updates from ${forkedLaneId.name}`,
|
|
337
|
-
updatesFromForkedDesc,
|
|
338
|
-
pendingUpdatesFromForkedIds
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
const getLaneStr = () => {
|
|
343
|
-
if (currentLaneId.isDefault()) return '';
|
|
344
|
-
const prefix = `\n\ncurrent lane ${chalk.bold(currentLaneId.toString())}`;
|
|
345
|
-
if (lanes) return prefix;
|
|
346
|
-
return `${prefix}\nconsider adding "--lanes" flag to see updates from main/forked`;
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
const getWorkspaceIssuesOutput = () => {
|
|
350
|
-
if (!workspaceIssues.length) return '';
|
|
351
|
-
const title = chalk.underline.white('workspace issues');
|
|
352
|
-
const issues = workspaceIssues.join('\n');
|
|
353
|
-
return `\n\n${title}\n${issues}`;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
const troubleshootingStr = showTroubleshootingLink ? `\n${TROUBLESHOOTING_MESSAGE}` : '';
|
|
357
|
-
|
|
358
|
-
const statusMsg =
|
|
359
|
-
importPendingWarning +
|
|
360
|
-
compact([
|
|
361
|
-
outdatedStr,
|
|
362
|
-
pendingMergeStr,
|
|
363
|
-
updatesFromMainOutput,
|
|
364
|
-
updatesFromForkedOutput,
|
|
365
|
-
compDuringMergeStr,
|
|
366
|
-
newComponentsOutput,
|
|
367
|
-
modifiedComponentOutput,
|
|
368
|
-
snappedComponentsOutput,
|
|
369
|
-
stagedComponentsOutput,
|
|
370
|
-
unavailableOnMainOutput,
|
|
371
|
-
autoTagPendingOutput,
|
|
372
|
-
compWithIssuesOutput,
|
|
373
|
-
invalidComponentOutput,
|
|
374
|
-
locallySoftRemovedOutput,
|
|
375
|
-
remotelySoftRemovedOutput,
|
|
376
|
-
]).join(chalk.underline('\n \n') + chalk.white('\n')) +
|
|
377
|
-
troubleshootingStr;
|
|
378
|
-
|
|
379
|
-
const results = (statusMsg || chalk.yellow(statusWorkspaceIsCleanMsg)) + getWorkspaceIssuesOutput() + getLaneStr();
|
|
380
|
-
|
|
381
|
-
const exitCode = componentsWithIssues.length && strict ? 1 : 0;
|
|
382
|
-
|
|
383
|
-
return {
|
|
384
|
-
data: results,
|
|
385
|
-
code: exitCode,
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
export function formatIssues(issues: IssuesList) {
|
|
391
|
-
return ` ${issues?.outputForCLI()}\n`;
|
|
392
|
-
}
|
package/status.aspect.ts
DELETED
package/status.main.runtime.ts
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';
|
|
2
|
-
import pMapSeries from 'p-map-series';
|
|
3
|
-
import { LaneId } from '@teambit/lane-id';
|
|
4
|
-
import { IssuesClasses, IssuesList } from '@teambit/component-issues';
|
|
5
|
-
import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';
|
|
6
|
-
import LanesAspect, { LanesMain } from '@teambit/lanes';
|
|
7
|
-
import { ComponentID } from '@teambit/component-id';
|
|
8
|
-
import { Component, InvalidComponent } from '@teambit/component';
|
|
9
|
-
import { Analytics } from '@teambit/legacy/dist/analytics/analytics';
|
|
10
|
-
import loader from '@teambit/legacy/dist/cli/loader';
|
|
11
|
-
import { BEFORE_STATUS } from '@teambit/legacy/dist/cli/loader/loader-messages';
|
|
12
|
-
import { RemoveAspect, RemoveMain } from '@teambit/remove';
|
|
13
|
-
import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
|
|
14
|
-
import ComponentsPendingImport from '@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-import';
|
|
15
|
-
import ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';
|
|
16
|
-
import { ModelComponent } from '@teambit/legacy/dist/scope/models';
|
|
17
|
-
import { InsightsAspect, InsightsMain } from '@teambit/insights';
|
|
18
|
-
import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';
|
|
19
|
-
import IssuesAspect, { IssuesMain } from '@teambit/issues';
|
|
20
|
-
import { StatusCmd } from './status-cmd';
|
|
21
|
-
import { StatusAspect } from './status.aspect';
|
|
22
|
-
import { MiniStatusCmd, MiniStatusOpts } from './mini-status-cmd';
|
|
23
|
-
|
|
24
|
-
type DivergeDataPerId = { id: ComponentID; divergeData: SnapsDistance };
|
|
25
|
-
|
|
26
|
-
export type StatusResult = {
|
|
27
|
-
newComponents: ComponentID[];
|
|
28
|
-
modifiedComponents: ComponentID[];
|
|
29
|
-
stagedComponents: { id: ComponentID; versions: string[] }[];
|
|
30
|
-
componentsWithIssues: { id: ComponentID; issues: IssuesList }[];
|
|
31
|
-
importPendingComponents: ComponentID[];
|
|
32
|
-
autoTagPendingComponents: ComponentID[];
|
|
33
|
-
invalidComponents: { id: ComponentID; error: Error }[];
|
|
34
|
-
locallySoftRemoved: ComponentID[];
|
|
35
|
-
remotelySoftRemoved: ComponentID[];
|
|
36
|
-
outdatedComponents: { id: ComponentID; headVersion: string; latestVersion?: string }[];
|
|
37
|
-
mergePendingComponents: DivergeDataPerId[];
|
|
38
|
-
componentsDuringMergeState: ComponentID[];
|
|
39
|
-
softTaggedComponents: ComponentID[];
|
|
40
|
-
snappedComponents: ComponentID[];
|
|
41
|
-
pendingUpdatesFromMain: DivergeDataPerId[];
|
|
42
|
-
updatesFromForked: DivergeDataPerId[];
|
|
43
|
-
unavailableOnMain: ComponentID[];
|
|
44
|
-
currentLaneId: LaneId;
|
|
45
|
-
forkedLaneId?: LaneId;
|
|
46
|
-
workspaceIssues: string[];
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export type MiniStatusResults = {
|
|
50
|
-
modified: ComponentID[];
|
|
51
|
-
newComps: ComponentID[];
|
|
52
|
-
compWithIssues?: Component[];
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export class StatusMain {
|
|
56
|
-
constructor(
|
|
57
|
-
private workspace: Workspace,
|
|
58
|
-
private issues: IssuesMain,
|
|
59
|
-
private insights: InsightsMain,
|
|
60
|
-
private remove: RemoveMain,
|
|
61
|
-
private lanes: LanesMain
|
|
62
|
-
) {}
|
|
63
|
-
|
|
64
|
-
async status({
|
|
65
|
-
lanes,
|
|
66
|
-
ignoreCircularDependencies,
|
|
67
|
-
}: {
|
|
68
|
-
lanes?: boolean;
|
|
69
|
-
ignoreCircularDependencies?: boolean;
|
|
70
|
-
}): Promise<StatusResult> {
|
|
71
|
-
if (!this.workspace) throw new OutsideWorkspaceError();
|
|
72
|
-
loader.start(BEFORE_STATUS);
|
|
73
|
-
const loadOpts = {
|
|
74
|
-
loadDocs: false,
|
|
75
|
-
loadCompositions: false,
|
|
76
|
-
};
|
|
77
|
-
const { components: allComps, invalidComponents: allInvalidComponents } = await this.workspace.listWithInvalid(
|
|
78
|
-
loadOpts
|
|
79
|
-
);
|
|
80
|
-
const consumer = this.workspace.consumer;
|
|
81
|
-
const laneObj = await consumer.getCurrentLaneObject();
|
|
82
|
-
const componentsList = new ComponentsList(consumer);
|
|
83
|
-
const newComponents: ConsumerComponent[] = (await componentsList.listNewComponents(
|
|
84
|
-
true,
|
|
85
|
-
loadOpts
|
|
86
|
-
)) as ConsumerComponent[];
|
|
87
|
-
const modifiedComponents = (await componentsList.listModifiedComponents(true, loadOpts)) as ConsumerComponent[];
|
|
88
|
-
const stagedComponents: ModelComponent[] = await componentsList.listExportPendingComponents(laneObj);
|
|
89
|
-
await this.addRemovedStagedIfNeeded(stagedComponents);
|
|
90
|
-
const stagedComponentsWithVersions = await pMapSeries(stagedComponents, async (stagedComp) => {
|
|
91
|
-
const versions = await stagedComp.getLocalTagsOrHashes(consumer.scope.objects);
|
|
92
|
-
return {
|
|
93
|
-
id: stagedComp.toComponentId(),
|
|
94
|
-
versions,
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const unavailableOnMain = await this.workspace.getUnavailableOnMainComponents();
|
|
99
|
-
const autoTagPendingComponents = await componentsList.listAutoTagPendingComponents();
|
|
100
|
-
const autoTagPendingComponentsIds = autoTagPendingComponents.map((component) => component.id);
|
|
101
|
-
const locallySoftRemoved = await componentsList.listLocallySoftRemoved();
|
|
102
|
-
const remotelySoftRemoved = await componentsList.listRemotelySoftRemoved();
|
|
103
|
-
const importPendingComponents = allInvalidComponents
|
|
104
|
-
.filter((c) => c.err instanceof ComponentsPendingImport)
|
|
105
|
-
.map((i) => i.id);
|
|
106
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
107
|
-
const invalidComponents = allInvalidComponents.filter((c) => !(c.error instanceof ComponentsPendingImport));
|
|
108
|
-
const divergeInvalid = await this.divergeDataErrorsToInvalidComp(allComps);
|
|
109
|
-
invalidComponents.push(...divergeInvalid);
|
|
110
|
-
const outdatedComponents = await componentsList.listOutdatedComponents();
|
|
111
|
-
const idsDuringMergeState = componentsList.listDuringMergeStateComponents();
|
|
112
|
-
const mergePendingComponents = await componentsList.listMergePendingComponents();
|
|
113
|
-
if (allComps.length) {
|
|
114
|
-
const issuesFromFlag = ignoreCircularDependencies ? [IssuesClasses.CircularDependencies.name] : [];
|
|
115
|
-
const issuesToIgnore = [...this.issues.getIssuesToIgnoreGlobally(), ...issuesFromFlag];
|
|
116
|
-
await this.issues.triggerAddComponentIssues(allComps, issuesToIgnore);
|
|
117
|
-
this.issues.removeIgnoredIssuesFromComponents(allComps);
|
|
118
|
-
}
|
|
119
|
-
const componentsWithIssues = allComps.filter((component) => !component.state.issues.isEmpty());
|
|
120
|
-
const softTaggedComponents = this.workspace.filter.bySoftTagged();
|
|
121
|
-
const snappedComponents = await this.workspace.filter.bySnappedOnMain();
|
|
122
|
-
const pendingUpdatesFromMain = lanes ? await componentsList.listUpdatesFromMainPending() : [];
|
|
123
|
-
const updatesFromForked = lanes ? await this.lanes.listUpdatesFromForked(componentsList) : [];
|
|
124
|
-
const currentLaneId = consumer.getCurrentLaneId();
|
|
125
|
-
const currentLane = await consumer.getCurrentLaneObject();
|
|
126
|
-
const forkedLaneId = currentLane?.forkedFrom;
|
|
127
|
-
const workspaceIssues = this.workspace.getWorkspaceIssues();
|
|
128
|
-
Analytics.setExtraData('new_components', newComponents.length);
|
|
129
|
-
Analytics.setExtraData('staged_components', stagedComponents.length);
|
|
130
|
-
Analytics.setExtraData('num_components_with_missing_dependencies', componentsWithIssues.length);
|
|
131
|
-
Analytics.setExtraData('autoTagPendingComponents', autoTagPendingComponents.length);
|
|
132
|
-
Analytics.setExtraData('deleted', invalidComponents.length);
|
|
133
|
-
|
|
134
|
-
const convertBitIdToComponentIdsAndSort = async (ids: ComponentID[]) =>
|
|
135
|
-
ComponentID.sortIds(await this.workspace.resolveMultipleComponentIds(ids));
|
|
136
|
-
|
|
137
|
-
const convertObjToComponentIdsAndSort = async <T>(
|
|
138
|
-
objectsWithId: Array<T & { id: ComponentID }>
|
|
139
|
-
): Promise<Array<T & { id: ComponentID }>> => {
|
|
140
|
-
const results = await Promise.all(
|
|
141
|
-
objectsWithId.map(async (obj) => {
|
|
142
|
-
return {
|
|
143
|
-
...obj,
|
|
144
|
-
id: await this.workspace.resolveComponentId(obj.id),
|
|
145
|
-
};
|
|
146
|
-
})
|
|
147
|
-
);
|
|
148
|
-
return results.sort((a, b) => a.id.toString().localeCompare(b.id.toString()));
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const sortObjectsWithId = <T>(objectsWithId: Array<T & { id: ComponentID }>): Array<T & { id: ComponentID }> => {
|
|
152
|
-
return objectsWithId.sort((a, b) => a.id.toString().localeCompare(b.id.toString()));
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
await consumer.onDestroy('status');
|
|
156
|
-
return {
|
|
157
|
-
newComponents: await convertBitIdToComponentIdsAndSort(newComponents.map((c) => c.id)),
|
|
158
|
-
modifiedComponents: await convertBitIdToComponentIdsAndSort(modifiedComponents.map((c) => c.id)),
|
|
159
|
-
stagedComponents: await convertObjToComponentIdsAndSort(stagedComponentsWithVersions),
|
|
160
|
-
componentsWithIssues: sortObjectsWithId(componentsWithIssues.map((c) => ({ id: c.id, issues: c.state.issues }))),
|
|
161
|
-
importPendingComponents, // no need to sort, we use only its length
|
|
162
|
-
autoTagPendingComponents: await convertBitIdToComponentIdsAndSort(autoTagPendingComponentsIds),
|
|
163
|
-
invalidComponents: sortObjectsWithId(invalidComponents.map((c) => ({ id: c.id, error: c.err }))),
|
|
164
|
-
locallySoftRemoved: await convertBitIdToComponentIdsAndSort(locallySoftRemoved),
|
|
165
|
-
remotelySoftRemoved: await convertBitIdToComponentIdsAndSort(remotelySoftRemoved.map((c) => c.id)),
|
|
166
|
-
outdatedComponents: await convertObjToComponentIdsAndSort(
|
|
167
|
-
outdatedComponents.map((c) => ({
|
|
168
|
-
id: c.id,
|
|
169
|
-
headVersion: c.headVersion,
|
|
170
|
-
latestVersion: c.latestVersion,
|
|
171
|
-
}))
|
|
172
|
-
),
|
|
173
|
-
mergePendingComponents: await convertObjToComponentIdsAndSort(
|
|
174
|
-
mergePendingComponents.map((c) => ({ id: c.id, divergeData: c.diverge }))
|
|
175
|
-
),
|
|
176
|
-
componentsDuringMergeState: await convertBitIdToComponentIdsAndSort(idsDuringMergeState),
|
|
177
|
-
softTaggedComponents: ComponentID.sortIds(softTaggedComponents),
|
|
178
|
-
snappedComponents: await convertBitIdToComponentIdsAndSort(snappedComponents),
|
|
179
|
-
pendingUpdatesFromMain: await convertObjToComponentIdsAndSort(pendingUpdatesFromMain),
|
|
180
|
-
updatesFromForked: await convertObjToComponentIdsAndSort(updatesFromForked),
|
|
181
|
-
unavailableOnMain,
|
|
182
|
-
currentLaneId,
|
|
183
|
-
forkedLaneId,
|
|
184
|
-
workspaceIssues: workspaceIssues.map((err) => err.message),
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
async statusMini(componentPattern?: string, opts: MiniStatusOpts = {}): Promise<MiniStatusResults> {
|
|
189
|
-
const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();
|
|
190
|
-
const compFiles = await pMapSeries(ids, (id) => this.workspace.getFilesModification(id));
|
|
191
|
-
const modified: ComponentID[] = [];
|
|
192
|
-
const newComps: ComponentID[] = [];
|
|
193
|
-
compFiles.forEach((comp) => {
|
|
194
|
-
if (!comp.id.hasVersion()) newComps.push(comp.id);
|
|
195
|
-
if (comp.isModified()) modified.push(comp.id);
|
|
196
|
-
});
|
|
197
|
-
const loadOpts = {
|
|
198
|
-
loadDocs: false,
|
|
199
|
-
loadCompositions: false,
|
|
200
|
-
};
|
|
201
|
-
const comps = opts.showIssues ? await this.workspace.getMany(ids, loadOpts) : [];
|
|
202
|
-
if (opts.showIssues) {
|
|
203
|
-
const issuesFromFlag = opts.ignoreCircularDependencies ? [IssuesClasses.CircularDependencies.name] : [];
|
|
204
|
-
const issuesToIgnore = [...this.issues.getIssuesToIgnoreGlobally(), ...issuesFromFlag];
|
|
205
|
-
await this.issues.triggerAddComponentIssues(comps, issuesToIgnore);
|
|
206
|
-
this.issues.removeIgnoredIssuesFromComponents(comps);
|
|
207
|
-
}
|
|
208
|
-
const compWithIssues = comps.filter((c) => !c.state.issues.isEmpty());
|
|
209
|
-
|
|
210
|
-
return { modified, newComps, compWithIssues };
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
private async addRemovedStagedIfNeeded(stagedComponents: ModelComponent[]) {
|
|
214
|
-
const removedStagedIds = await this.remove.getRemovedStaged();
|
|
215
|
-
if (!removedStagedIds.length) return;
|
|
216
|
-
const removedStagedBitIds = removedStagedIds.map((id) => id);
|
|
217
|
-
const nonExistsInStaged = removedStagedBitIds.filter(
|
|
218
|
-
(id) => !stagedComponents.find((c) => c.toComponentId().isEqualWithoutVersion(id))
|
|
219
|
-
);
|
|
220
|
-
if (!nonExistsInStaged.length) return;
|
|
221
|
-
const modelComps = await Promise.all(
|
|
222
|
-
nonExistsInStaged.map((id) => this.workspace.scope.legacyScope.getModelComponent(id))
|
|
223
|
-
);
|
|
224
|
-
stagedComponents.push(...modelComps);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
private async divergeDataErrorsToInvalidComp(components: Component[]): Promise<InvalidComponent[]> {
|
|
228
|
-
const invalidComponents: InvalidComponent[] = [];
|
|
229
|
-
await Promise.all(
|
|
230
|
-
components.map(async (component) => {
|
|
231
|
-
const comp = component.state._consumer as ConsumerComponent;
|
|
232
|
-
if (!comp.modelComponent) return;
|
|
233
|
-
await comp.modelComponent.setDivergeData(this.workspace.scope.legacyScope.objects, false);
|
|
234
|
-
const divergeData = comp.modelComponent.getDivergeData();
|
|
235
|
-
if (divergeData.err) {
|
|
236
|
-
invalidComponents.push({ id: component.id, err: divergeData.err });
|
|
237
|
-
}
|
|
238
|
-
})
|
|
239
|
-
);
|
|
240
|
-
return invalidComponents;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
static slots = [];
|
|
244
|
-
static dependencies = [CLIAspect, WorkspaceAspect, InsightsAspect, IssuesAspect, RemoveAspect, LanesAspect];
|
|
245
|
-
static runtime = MainRuntime;
|
|
246
|
-
static async provider([cli, workspace, insights, issues, remove, lanes]: [
|
|
247
|
-
CLIMain,
|
|
248
|
-
Workspace,
|
|
249
|
-
InsightsMain,
|
|
250
|
-
IssuesMain,
|
|
251
|
-
RemoveMain,
|
|
252
|
-
LanesMain
|
|
253
|
-
]) {
|
|
254
|
-
const statusMain = new StatusMain(workspace, issues, insights, remove, lanes);
|
|
255
|
-
cli.register(new StatusCmd(statusMain), new MiniStatusCmd(statusMain));
|
|
256
|
-
return statusMain;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
StatusAspect.addRuntime(StatusMain);
|
|
File without changes
|