@teambit/status 0.0.5 → 0.0.8

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.
@@ -1,24 +1,25 @@
1
1
  import { CLIMain } from '@teambit/cli';
2
2
  import { Workspace } from '@teambit/workspace';
3
3
  import { BitId, BitIds } from '@teambit/legacy/dist/bit-id';
4
- import Component from '@teambit/legacy/dist/consumer/component';
4
+ import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
5
5
  import { DivergedComponent } from '@teambit/legacy/dist/consumer/component/components-list';
6
6
  import { InvalidComponent } from '@teambit/legacy/dist/consumer/component/consumer-component';
7
7
  import { ModelComponent } from '@teambit/legacy/dist/scope/models';
8
+ import { InsightsMain } from '@teambit/insights';
8
9
  import { IssuesMain } from '@teambit/issues';
9
10
  export declare type StatusResult = {
10
- newComponents: Component[];
11
- modifiedComponent: Component[];
11
+ newComponents: ConsumerComponent[];
12
+ modifiedComponent: ConsumerComponent[];
12
13
  stagedComponents: ModelComponent[];
13
- componentsWithIssues: Component[];
14
+ componentsWithIssues: ConsumerComponent[];
14
15
  importPendingComponents: BitId[];
15
16
  autoTagPendingComponents: BitId[];
16
17
  invalidComponents: InvalidComponent[];
17
- outdatedComponents: Component[];
18
+ outdatedComponents: ConsumerComponent[];
18
19
  mergePendingComponents: DivergedComponent[];
19
20
  componentsDuringMergeState: BitIds;
20
- componentsWithIndividualFiles: Component[];
21
- componentsWithTrackDirs: Component[];
21
+ componentsWithIndividualFiles: ConsumerComponent[];
22
+ componentsWithTrackDirs: ConsumerComponent[];
22
23
  softTaggedComponents: BitId[];
23
24
  snappedComponents: BitId[];
24
25
  laneName: string | null;
@@ -26,10 +27,11 @@ export declare type StatusResult = {
26
27
  export declare class StatusMain {
27
28
  private workspace;
28
29
  private issues;
29
- constructor(workspace: Workspace, issues: IssuesMain);
30
+ private insights;
31
+ constructor(workspace: Workspace, issues: IssuesMain, insights: InsightsMain);
30
32
  status(): Promise<StatusResult>;
31
33
  static slots: never[];
32
34
  static dependencies: import("@teambit/harmony").Aspect[];
33
35
  static runtime: import("@teambit/harmony").RuntimeDefinition;
34
- static provider([cli, workspace, issues]: [CLIMain, Workspace, IssuesMain]): Promise<StatusMain>;
36
+ static provider([cli, workspace, insights, issues]: [CLIMain, Workspace, InsightsMain, IssuesMain]): Promise<StatusMain>;
35
37
  }
@@ -111,6 +111,16 @@ function _exceptions() {
111
111
  return data;
112
112
  }
113
113
 
114
+ function _insights() {
115
+ const data = require("@teambit/insights");
116
+
117
+ _insights = function () {
118
+ return data;
119
+ };
120
+
121
+ return data;
122
+ }
123
+
114
124
  function _issues() {
115
125
  const data = _interopRequireDefault(require("@teambit/issues"));
116
126
 
@@ -142,9 +152,10 @@ function _status() {
142
152
  }
143
153
 
144
154
  class StatusMain {
145
- constructor(workspace, issues) {
155
+ constructor(workspace, issues, insights) {
146
156
  this.workspace = workspace;
147
157
  this.issues = issues;
158
+ this.insights = insights;
148
159
  }
149
160
 
150
161
  async status() {
@@ -168,11 +179,20 @@ class StatusMain {
168
179
  const invalidComponents = allInvalidComponents.filter(c => !(c.error instanceof _componentsPendingImport().default));
169
180
  const outdatedComponents = await componentsList.listOutdatedComponents();
170
181
  const mergePendingComponents = await componentsList.listMergePendingComponents();
171
- const newAndModified = newComponents.concat(modifiedComponent);
172
- const issuesToIgnore = this.issues.getIssuesToIgnore();
173
- const componentsWithIssues = newAndModified.filter(component => {
174
- issuesToIgnore.forEach(issueToIgnore => component.issues.delete(_componentIssues().IssuesClasses[issueToIgnore]));
182
+ const newAndModifiedLegacy = newComponents.concat(modifiedComponent);
183
+ const issuesToIgnore = this.issues.getIssuesToIgnoreGlobally();
184
+
185
+ if (!this.workspace.isLegacy && newAndModifiedLegacy.length) {
186
+ const newAndModified = await this.workspace.getManyByLegacy(newAndModifiedLegacy);
187
+
188
+ if (!issuesToIgnore.includes(_componentIssues().IssuesClasses.CircularDependencies.name)) {
189
+ await this.insights.addInsightsAsComponentIssues(newAndModified);
190
+ }
191
+
192
+ this.issues.removeIgnoredIssuesFromComponents(newAndModified);
193
+ }
175
194
 
195
+ const componentsWithIssues = newAndModifiedLegacy.filter(component => {
176
196
  if (consumer.isLegacy && component.issues) {
177
197
  component.issues.delete(_componentIssues().IssuesClasses.RelativeComponentsAuthored);
178
198
  }
@@ -219,8 +239,8 @@ class StatusMain {
219
239
  };
220
240
  }
221
241
 
222
- static async provider([cli, workspace, issues]) {
223
- const statusMain = new StatusMain(workspace, issues);
242
+ static async provider([cli, workspace, insights, issues]) {
243
+ const statusMain = new StatusMain(workspace, issues, insights);
224
244
  cli.register(new (_statusCmd().StatusCmd)(statusMain));
225
245
  return statusMain;
226
246
  }
@@ -229,7 +249,7 @@ class StatusMain {
229
249
 
230
250
  exports.StatusMain = StatusMain;
231
251
  (0, _defineProperty2().default)(StatusMain, "slots", []);
232
- (0, _defineProperty2().default)(StatusMain, "dependencies", [_cli().CLIAspect, _workspace().default, _issues().default]);
252
+ (0, _defineProperty2().default)(StatusMain, "dependencies", [_cli().CLIAspect, _workspace().default, _insights().InsightsAspect, _issues().default]);
233
253
  (0, _defineProperty2().default)(StatusMain, "runtime", _cli().MainRuntime);
234
254
 
235
255
  _status().StatusAspect.addRuntime(StatusMain);
@@ -1 +1 @@
1
- {"version":3,"sources":["status.main.runtime.ts"],"names":["StatusMain","constructor","workspace","issues","status","ConsumerNotFound","loader","start","BEFORE_STATUS","consumer","laneObj","getCurrentLaneObject","componentsList","ComponentsList","newComponents","listNewComponents","modifiedComponent","listModifiedComponents","stagedComponents","listExportPendingComponents","autoTagPendingComponents","listAutoTagPendingComponents","autoTagPendingComponentsIds","map","component","id","allInvalidComponents","listInvalidComponents","importPendingComponents","filter","c","error","ComponentsPendingImport","i","invalidComponents","outdatedComponents","listOutdatedComponents","mergePendingComponents","listMergePendingComponents","newAndModified","concat","issuesToIgnore","getIssuesToIgnore","componentsWithIssues","forEach","issueToIgnore","delete","IssuesClasses","isLegacy","RelativeComponentsAuthored","isEmpty","componentsDuringMergeState","listDuringMergeStateComponents","softTaggedComponents","listSoftTaggedComponents","snappedComponents","listSnappedComponentsOnMain","toBitId","currentLane","getCurrentLaneId","laneName","isDefault","name","Analytics","setExtraData","length","onDestroy","sortComponentsByName","componentsWithIndividualFiles","listComponentsWithIndividualFiles","componentsWithTrackDirs","listComponentsWithTrackDir","provider","cli","statusMain","register","StatusCmd","CLIAspect","WorkspaceAspect","IssuesAspect","MainRuntime","StatusAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAoBO,MAAMA,UAAN,CAAiB;AACtBC,EAAAA,WAAW,CAASC,SAAT,EAAuCC,MAAvC,EAA2D;AAAA,SAAlDD,SAAkD,GAAlDA,SAAkD;AAAA,SAApBC,MAAoB,GAApBA,MAAoB;AAAE;;AAE5D,QAANC,MAAM,GAA0B;AACpC,QAAI,CAAC,KAAKF,SAAV,EAAqB,MAAM,KAAIG,8BAAJ,GAAN;;AACrBC,sBAAOC,KAAP,CAAaC,+BAAb;;AACA,UAAMC,QAAQ,GAAG,KAAKP,SAAL,CAAeO,QAAhC;AACA,UAAMC,OAAO,GA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V;AAEL;AACAE,MAAAA,iBAAiB,EAAEH,0BAAesD,oBAAf,CAAoCnD,iBAApC,CAHd;AAILE,MAAAA,gBAAgB,EAAEL,0BAAesD,oBAAf,CAAoCjD,gBAApC,CAJb;AAKLyB,MAAAA,oBALK;AAKiB;AACtBf,MAAAA,uBANK;AAMoB;AACzBR,MAAAA,wBAAwB,EAAEP,0BAAesD,oBAAf,CAAoC7C,2BAApC,CAPrB;AAQL;AACAY,MAAAA,iBATK;AAULC,MAAAA,kBAVK;AAWLE,MAAAA,sBAXK;AAYLc,MAAAA,0BAZK;AAaLiB,MAAAA,6BAA6B,EAAE,MAAMxD,cAAc,CAACyD,iCAAf,EAbhC;AAcLC,MAAAA,uBAAuB,EAAE,MAAM1D,cAAc,CAAC2D,0BAAf,EAd1B;AAeLlB,MAAAA,oBAfK;AAgBLE,MAAAA,iBAhBK;AAiBLK,MAAAA;AAjBK,KAAP;AAmBD;;AAKoB,eAARY,QAAQ,CAAC,CAACC,GAAD,EAAMvE,SAAN,EAAiBC,MAAjB,CAAD,EAA6D;AAChF,UAAMuE,UAAU,GAAG,IAAI1E,UAAJ,CAAeE,SAAf,EAA0BC,MAA1B,CAAnB;AACAsE,IAAAA,GAAG,CAACE,QAAJ,CAAa,KAAIC,sBAAJ,EAAcF,UAAd,CAAb;AACA,WAAOA,UAAP;AACD;;AAxEqB;;;gCAAX1E,U,WAiEI,E;gCAjEJA,U,kBAkEW,CAAC6E,gBAAD,EAAYC,oBAAZ,EAA6BC,iBAA7B,C;gCAlEX/E,U,aAmEMgF,kB;;AAQnBC,uBAAaC,UAAb,CAAwBlF,UAAxB","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { Analytics } from '@teambit/legacy/dist/analytics/analytics';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { BEFORE_STATUS } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport Component from '@teambit/legacy/dist/consumer/component';\nimport ComponentsPendingImport from '@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-import';\nimport ComponentsList, { DivergedComponent } from '@teambit/legacy/dist/consumer/component/components-list';\nimport { InvalidComponent } from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport IssuesAspect, { IssuesMain } from '@teambit/issues';\nimport { StatusCmd } from './status-cmd';\nimport { StatusAspect } from './status.aspect';\n\nexport type StatusResult = {\n newComponents: Component[];\n modifiedComponent: Component[];\n stagedComponents: ModelComponent[];\n componentsWithIssues: Component[];\n importPendingComponents: BitId[];\n autoTagPendingComponents: BitId[];\n invalidComponents: InvalidComponent[];\n outdatedComponents: Component[];\n mergePendingComponents: DivergedComponent[];\n componentsDuringMergeState: BitIds;\n componentsWithIndividualFiles: Component[];\n componentsWithTrackDirs: Component[];\n softTaggedComponents: BitId[];\n snappedComponents: BitId[];\n laneName: string | null; // null if default\n};\n\nexport class StatusMain {\n constructor(private workspace: Workspace, private issues: IssuesMain) {}\n\n async status(): Promise<StatusResult> {\n if (!this.workspace) throw new ConsumerNotFound();\n loader.start(BEFORE_STATUS);\n const consumer = this.workspace.consumer;\n const laneObj = await consumer.getCurrentLaneObject();\n const componentsList = new ComponentsList(consumer);\n const newComponents: Component[] = (await componentsList.listNewComponents(true)) as Component[];\n const modifiedComponent = (await componentsList.listModifiedComponents(true)) as Component[];\n const stagedComponents: ModelComponent[] = await componentsList.listExportPendingComponents(laneObj);\n const autoTagPendingComponents = await componentsList.listAutoTagPendingComponents();\n const autoTagPendingComponentsIds = autoTagPendingComponents.map((component) => component.id);\n const allInvalidComponents = await componentsList.listInvalidComponents();\n const importPendingComponents = allInvalidComponents\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n .filter((c) => c.error instanceof ComponentsPendingImport)\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n .map((i) => i.id);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const invalidComponents = allInvalidComponents.filter((c) => !(c.error instanceof ComponentsPendingImport));\n const outdatedComponents = await componentsList.listOutdatedComponents();\n const mergePendingComponents = await componentsList.listMergePendingComponents();\n const newAndModified: Component[] = newComponents.concat(modifiedComponent);\n const issuesToIgnore = this.issues.getIssuesToIgnore();\n const componentsWithIssues = newAndModified.filter((component: Component) => {\n issuesToIgnore.forEach((issueToIgnore) => component.issues.delete(IssuesClasses[issueToIgnore]));\n if (consumer.isLegacy && component.issues) {\n component.issues.delete(IssuesClasses.RelativeComponentsAuthored);\n }\n return component.issues && !component.issues.isEmpty();\n });\n const componentsDuringMergeState = componentsList.listDuringMergeStateComponents();\n const softTaggedComponents = componentsList.listSoftTaggedComponents();\n const snappedComponents = (await componentsList.listSnappedComponentsOnMain()).map((c) => c.toBitId());\n const currentLane = consumer.getCurrentLaneId();\n const laneName = currentLane.isDefault() ? null : currentLane.name;\n Analytics.setExtraData('new_components', newComponents.length);\n Analytics.setExtraData('staged_components', stagedComponents.length);\n Analytics.setExtraData('num_components_with_missing_dependencies', componentsWithIssues.length);\n Analytics.setExtraData('autoTagPendingComponents', autoTagPendingComponents.length);\n Analytics.setExtraData('deleted', invalidComponents.length);\n await consumer.onDestroy();\n return {\n newComponents: ComponentsList.sortComponentsByName(newComponents),\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n modifiedComponent: ComponentsList.sortComponentsByName(modifiedComponent),\n stagedComponents: ComponentsList.sortComponentsByName(stagedComponents),\n componentsWithIssues, // no need to sort, we don't print it as is\n importPendingComponents, // no need to sort, we use only its length\n autoTagPendingComponents: ComponentsList.sortComponentsByName(autoTagPendingComponentsIds),\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n invalidComponents,\n outdatedComponents,\n mergePendingComponents,\n componentsDuringMergeState,\n componentsWithIndividualFiles: await componentsList.listComponentsWithIndividualFiles(),\n componentsWithTrackDirs: await componentsList.listComponentsWithTrackDir(),\n softTaggedComponents,\n snappedComponents,\n laneName,\n };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, IssuesAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace, issues]: [CLIMain, Workspace, IssuesMain]) {\n const statusMain = new StatusMain(workspace, issues);\n cli.register(new StatusCmd(statusMain));\n return statusMain;\n }\n}\n\nStatusAspect.addRuntime(StatusMain);\n"]}
1
+ {"version":3,"sources":["status.main.runtime.ts"],"names":["StatusMain","constructor","workspace","issues","insights","status","ConsumerNotFound","loader","start","BEFORE_STATUS","consumer","laneObj","getCurrentLaneObject","componentsList","ComponentsList","newComponents","listNewComponents","modifiedComponent","listModifiedComponents","stagedComponents","listExportPendingComponents","autoTagPendingComponents","listAutoTagPendingComponents","autoTagPendingComponentsIds","map","component","id","allInvalidComponents","listInvalidComponents","importPendingComponents","filter","c","error","ComponentsPendingImport","i","invalidComponents","outdatedComponents","listOutdatedComponents","mergePendingComponents","listMergePendingComponents","newAndModifiedLegacy","concat","issuesToIgnore","getIssuesToIgnoreGlobally","isLegacy","length","newAndModified","getManyByLegacy","includes","IssuesClasses","CircularDependencies","name","addInsightsAsComponentIssues","removeIgnoredIssuesFromComponents","componentsWithIssues","delete","RelativeComponentsAuthored","isEmpty","componentsDuringMergeState","listDuringMergeStateComponents","softTaggedComponents","listSoftTaggedComponents","snappedComponents","listSnappedComponentsOnMain","toBitId","currentLane","getCurrentLaneId","laneName","isDefault","Analytics","setExtraData","onDestroy","sortComponentsByName","componentsWithIndividualFiles","listComponentsWithIndividualFiles","componentsWithTrackDirs","listComponentsWithTrackDir","provider","cli","statusMain","register","StatusCmd","CLIAspect","WorkspaceAspect","InsightsAspect","IssuesAspect","MainRuntime","StatusAspect","addRuntime"],"mappings":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;AACLxD,MAAAA,aAAa,EAAED,0BAAe0D,oBAAf,CAAoCzD,aAApC,CADV;AAEL;AACAE,MAAAA,iBAAiB,EAAEH,0BAAe0D,oBAAf,CAAoCvD,iBAApC,CAHd;AAILE,MAAAA,gBAAgB,EAAEL,0BAAe0D,oBAAf,CAAoCrD,gBAApC,CAJb;AAKLmC,MAAAA,oBALK;AAKiB;AACtBzB,MAAAA,uBANK;AAMoB;AACzBR,MAAAA,wBAAwB,EAAEP,0BAAe0D,oBAAf,CAAoCjD,2BAApC,CAPrB;AAQL;AACAY,MAAAA,iBATK;AAULC,MAAAA,kBAVK;AAWLE,MAAAA,sBAXK;AAYLoB,MAAAA,0BAZK;AAaLe,MAAAA,6BAA6B,EAAE,MAAM5D,cAAc,CAAC6D,iCAAf,EAbhC;AAcLC,MAAAA,uBAAuB,EAAE,MAAM9D,cAAc,CAAC+D,0BAAf,EAd1B;AAeLhB,MAAAA,oBAfK;AAgBLE,MAAAA,iBAhBK;AAiBLK,MAAAA;AAjBK,KAAP;AAmBD;;AAKoB,eAARU,QAAQ,CAAC,CAACC,GAAD,EAAM5E,SAAN,EAAiBE,QAAjB,EAA2BD,MAA3B,CAAD,EAAqF;AACxG,UAAM4E,UAAU,GAAG,IAAI/E,UAAJ,CAAeE,SAAf,EAA0BC,MAA1B,EAAkCC,QAAlC,CAAnB;AACA0E,IAAAA,GAAG,CAACE,QAAJ,CAAa,KAAIC,sBAAJ,EAAcF,UAAd,CAAb;AACA,WAAOA,UAAP;AACD;;AA9EqB;;;gCAAX/E,U,WAuEI,E;gCAvEJA,U,kBAwEW,CAACkF,gBAAD,EAAYC,oBAAZ,EAA6BC,0BAA7B,EAA6CC,iBAA7C,C;gCAxEXrF,U,aAyEMsF,kB;;AAQnBC,uBAAaC,UAAb,CAAwBxF,UAAxB","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { Analytics } from '@teambit/legacy/dist/analytics/analytics';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { BEFORE_STATUS } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport ComponentsPendingImport from '@teambit/legacy/dist/consumer/component-ops/exceptions/components-pending-import';\nimport ComponentsList, { DivergedComponent } from '@teambit/legacy/dist/consumer/component/components-list';\nimport { InvalidComponent } from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport { InsightsAspect, InsightsMain } from '@teambit/insights';\nimport IssuesAspect, { IssuesMain } from '@teambit/issues';\nimport { StatusCmd } from './status-cmd';\nimport { StatusAspect } from './status.aspect';\n\nexport type StatusResult = {\n newComponents: ConsumerComponent[];\n modifiedComponent: ConsumerComponent[];\n stagedComponents: ModelComponent[];\n componentsWithIssues: ConsumerComponent[];\n importPendingComponents: BitId[];\n autoTagPendingComponents: BitId[];\n invalidComponents: InvalidComponent[];\n outdatedComponents: ConsumerComponent[];\n mergePendingComponents: DivergedComponent[];\n componentsDuringMergeState: BitIds;\n componentsWithIndividualFiles: ConsumerComponent[];\n componentsWithTrackDirs: ConsumerComponent[];\n softTaggedComponents: BitId[];\n snappedComponents: BitId[];\n laneName: string | null; // null if default\n};\n\nexport class StatusMain {\n constructor(private workspace: Workspace, private issues: IssuesMain, private insights: InsightsMain) {}\n\n async status(): Promise<StatusResult> {\n if (!this.workspace) throw new ConsumerNotFound();\n loader.start(BEFORE_STATUS);\n const consumer = this.workspace.consumer;\n const laneObj = await consumer.getCurrentLaneObject();\n const componentsList = new ComponentsList(consumer);\n const newComponents: ConsumerComponent[] = (await componentsList.listNewComponents(true)) as ConsumerComponent[];\n const modifiedComponent = (await componentsList.listModifiedComponents(true)) as ConsumerComponent[];\n const stagedComponents: ModelComponent[] = await componentsList.listExportPendingComponents(laneObj);\n const autoTagPendingComponents = await componentsList.listAutoTagPendingComponents();\n const autoTagPendingComponentsIds = autoTagPendingComponents.map((component) => component.id);\n const allInvalidComponents = await componentsList.listInvalidComponents();\n const importPendingComponents = allInvalidComponents\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n .filter((c) => c.error instanceof ComponentsPendingImport)\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n .map((i) => i.id);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const invalidComponents = allInvalidComponents.filter((c) => !(c.error instanceof ComponentsPendingImport));\n const outdatedComponents = await componentsList.listOutdatedComponents();\n const mergePendingComponents = await componentsList.listMergePendingComponents();\n const newAndModifiedLegacy: ConsumerComponent[] = newComponents.concat(modifiedComponent);\n const issuesToIgnore = this.issues.getIssuesToIgnoreGlobally();\n if (!this.workspace.isLegacy && newAndModifiedLegacy.length) {\n const newAndModified = await this.workspace.getManyByLegacy(newAndModifiedLegacy);\n if (!issuesToIgnore.includes(IssuesClasses.CircularDependencies.name)) {\n await this.insights.addInsightsAsComponentIssues(newAndModified);\n }\n this.issues.removeIgnoredIssuesFromComponents(newAndModified);\n }\n const componentsWithIssues = newAndModifiedLegacy.filter((component: ConsumerComponent) => {\n if (consumer.isLegacy && component.issues) {\n component.issues.delete(IssuesClasses.RelativeComponentsAuthored);\n }\n return component.issues && !component.issues.isEmpty();\n });\n const componentsDuringMergeState = componentsList.listDuringMergeStateComponents();\n const softTaggedComponents = componentsList.listSoftTaggedComponents();\n const snappedComponents = (await componentsList.listSnappedComponentsOnMain()).map((c) => c.toBitId());\n const currentLane = consumer.getCurrentLaneId();\n const laneName = currentLane.isDefault() ? null : currentLane.name;\n Analytics.setExtraData('new_components', newComponents.length);\n Analytics.setExtraData('staged_components', stagedComponents.length);\n Analytics.setExtraData('num_components_with_missing_dependencies', componentsWithIssues.length);\n Analytics.setExtraData('autoTagPendingComponents', autoTagPendingComponents.length);\n Analytics.setExtraData('deleted', invalidComponents.length);\n await consumer.onDestroy();\n return {\n newComponents: ComponentsList.sortComponentsByName(newComponents),\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n modifiedComponent: ComponentsList.sortComponentsByName(modifiedComponent),\n stagedComponents: ComponentsList.sortComponentsByName(stagedComponents),\n componentsWithIssues, // no need to sort, we don't print it as is\n importPendingComponents, // no need to sort, we use only its length\n autoTagPendingComponents: ComponentsList.sortComponentsByName(autoTagPendingComponentsIds),\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n invalidComponents,\n outdatedComponents,\n mergePendingComponents,\n componentsDuringMergeState,\n componentsWithIndividualFiles: await componentsList.listComponentsWithIndividualFiles(),\n componentsWithTrackDirs: await componentsList.listComponentsWithTrackDir(),\n softTaggedComponents,\n snappedComponents,\n laneName,\n };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, InsightsAspect, IssuesAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace, insights, issues]: [CLIMain, Workspace, InsightsMain, IssuesMain]) {\n const statusMain = new StatusMain(workspace, issues, insights);\n cli.register(new StatusCmd(statusMain));\n return statusMain;\n }\n}\n\nStatusAspect.addRuntime(StatusMain);\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/status",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "homepage": "https://bit.dev/teambit/component/status",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "status",
9
- "version": "0.0.5"
9
+ "version": "0.0.8"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -14,11 +14,12 @@
14
14
  "@teambit/harmony": "0.2.11",
15
15
  "@babel/runtime": "7.12.18",
16
16
  "core-js": "^3.0.0",
17
- "@teambit/cli": "0.0.463",
17
+ "@teambit/cli": "0.0.465",
18
18
  "@teambit/legacy-bit-id": "0.0.399",
19
- "@teambit/component-issues": "0.0.48",
20
- "@teambit/issues": "0.0.2",
21
- "@teambit/workspace": "0.0.693"
19
+ "@teambit/component-issues": "0.0.49",
20
+ "@teambit/insights": "0.0.696",
21
+ "@teambit/issues": "0.0.4",
22
+ "@teambit/workspace": "0.0.696"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@types/mocha": "9.1.0",
@@ -29,7 +30,7 @@
29
30
  "@types/node": "12.20.4"
30
31
  },
31
32
  "peerDependencies": {
32
- "@teambit/legacy": "1.0.241",
33
+ "@teambit/legacy": "1.0.243",
33
34
  "react-dom": "^16.8.0 || ^17.0.0",
34
35
  "react": "^16.8.0 || ^17.0.0"
35
36
  },
@@ -57,7 +58,7 @@
57
58
  "react": "-"
58
59
  },
59
60
  "peerDependencies": {
60
- "@teambit/legacy": "1.0.241",
61
+ "@teambit/legacy": "1.0.243",
61
62
  "react-dom": "^16.8.0 || ^17.0.0",
62
63
  "react": "^16.8.0 || ^17.0.0"
63
64
  }