@teambit/workspace 0.0.653 → 0.0.656

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,16 +1,28 @@
1
1
  import { ComponentTreeNode, ComponentTreeNodeProps } from '@teambit/component-tree';
2
2
  import { ComponentStatusResolver } from '@teambit/component.ui.component-status-resolver';
3
- import React, { useContext } from 'react';
3
+ import React, { useContext, useMemo } from 'react';
4
4
 
5
+ import { useLanesContext } from '@teambit/lanes.ui.lanes';
5
6
  import { WorkspaceContext } from './ui/workspace/workspace-context';
6
7
 
7
8
  export class ComponentTreeWidget implements ComponentTreeNode {
8
9
  widget = ({ component }: ComponentTreeNodeProps) => {
9
10
  const workspace = useContext(WorkspaceContext);
10
-
11
11
  const workspaceComponent = workspace.getComponent(component.id);
12
+ const lanes = useLanesContext();
13
+
14
+ const isInCurrentLane = useMemo(() => {
15
+ return workspaceComponent?.id && lanes?.isInCurrentLane(workspaceComponent.id);
16
+ }, [lanes?.currentLane, workspaceComponent?.id]);
17
+
12
18
  if (!workspaceComponent) return null;
13
19
 
14
- return <ComponentStatusResolver status={workspaceComponent.status} issuesCount={workspaceComponent.issuesCount} />;
20
+ return (
21
+ <ComponentStatusResolver
22
+ status={workspaceComponent.status}
23
+ issuesCount={workspaceComponent.issuesCount}
24
+ isInCurrentLane={isInCurrentLane}
25
+ />
26
+ );
15
27
  };
16
28
  }
@@ -37,6 +37,16 @@ function _react() {
37
37
  return data;
38
38
  }
39
39
 
40
+ function _lanesUi() {
41
+ const data = require("@teambit/lanes.ui.lanes");
42
+
43
+ _lanesUi = function () {
44
+ return data;
45
+ };
46
+
47
+ return data;
48
+ }
49
+
40
50
  function _workspaceContext() {
41
51
  const data = require("./ui/workspace/workspace-context");
42
52
 
@@ -58,10 +68,15 @@ class ComponentTreeWidget {
58
68
  }) => {
59
69
  const workspace = (0, _react().useContext)(_workspaceContext().WorkspaceContext);
60
70
  const workspaceComponent = workspace.getComponent(component.id);
71
+ const lanes = (0, _lanesUi().useLanesContext)();
72
+ const isInCurrentLane = (0, _react().useMemo)(() => {
73
+ return (workspaceComponent === null || workspaceComponent === void 0 ? void 0 : workspaceComponent.id) && (lanes === null || lanes === void 0 ? void 0 : lanes.isInCurrentLane(workspaceComponent.id));
74
+ }, [lanes === null || lanes === void 0 ? void 0 : lanes.currentLane, workspaceComponent === null || workspaceComponent === void 0 ? void 0 : workspaceComponent.id]);
61
75
  if (!workspaceComponent) return null;
62
76
  return /*#__PURE__*/_react().default.createElement(_componentUi().ComponentStatusResolver, {
63
77
  status: workspaceComponent.status,
64
- issuesCount: workspaceComponent.issuesCount
78
+ issuesCount: workspaceComponent.issuesCount,
79
+ isInCurrentLane: isInCurrentLane
65
80
  });
66
81
  });
67
82
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["component-tree.widget.tsx"],"names":["ComponentTreeWidget","component","workspace","WorkspaceContext","workspaceComponent","getComponent","id","status","issuesCount"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;AAEO,MAAMA,mBAAN,CAAuD;AAAA;AAAA,oDACnD,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAA2C;AAClD,YAAMC,SAAS,GAAG,yBAAWC,oCAAX,CAAlB;AAEA,YAAMC,kBAAkB,GAAGF,SAAS,CAACG,YAAV,CAAuBJ,SAAS,CAACK,EAAjC,CAA3B;AACA,UAAI,CAACF,kBAAL,EAAyB,OAAO,IAAP;AAEzB,0BAAO,+BAAC,sCAAD;AAAyB,QAAA,MAAM,EAAEA,kBAAkB,CAACG,MAApD;AAA4D,QAAA,WAAW,EAAEH,kBAAkB,CAACI;AAA5F,QAAP;AACD,KAR2D;AAAA;;AAAA","sourcesContent":["import { ComponentTreeNode, ComponentTreeNodeProps } from '@teambit/component-tree';\nimport { ComponentStatusResolver } from '@teambit/component.ui.component-status-resolver';\nimport React, { useContext } from 'react';\n\nimport { WorkspaceContext } from './ui/workspace/workspace-context';\n\nexport class ComponentTreeWidget implements ComponentTreeNode {\n widget = ({ component }: ComponentTreeNodeProps) => {\n const workspace = useContext(WorkspaceContext);\n\n const workspaceComponent = workspace.getComponent(component.id);\n if (!workspaceComponent) return null;\n\n return <ComponentStatusResolver status={workspaceComponent.status} issuesCount={workspaceComponent.issuesCount} />;\n };\n}\n"]}
1
+ {"version":3,"sources":["component-tree.widget.tsx"],"names":["ComponentTreeWidget","component","workspace","WorkspaceContext","workspaceComponent","getComponent","id","lanes","isInCurrentLane","currentLane","status","issuesCount"],"mappings":";;;;;;;;;;;;;;;;;;;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;;;;;;AAEO,MAAMA,mBAAN,CAAuD;AAAA;AAAA,oDACnD,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAA2C;AAClD,YAAMC,SAAS,GAAG,yBAAWC,oCAAX,CAAlB;AACA,YAAMC,kBAAkB,GAAGF,SAAS,CAACG,YAAV,CAAuBJ,SAAS,CAACK,EAAjC,CAA3B;AACA,YAAMC,KAAK,GAAG,iCAAd;AAEA,YAAMC,eAAe,GAAG,sBAAQ,MAAM;AACpC,eAAO,CAAAJ,kBAAkB,SAAlB,IAAAA,kBAAkB,WAAlB,YAAAA,kBAAkB,CAAEE,EAApB,MAA0BC,KAA1B,aAA0BA,KAA1B,uBAA0BA,KAAK,CAAEC,eAAP,CAAuBJ,kBAAkB,CAACE,EAA1C,CAA1B,CAAP;AACD,OAFuB,EAErB,CAACC,KAAD,aAACA,KAAD,uBAACA,KAAK,CAAEE,WAAR,EAAqBL,kBAArB,aAAqBA,kBAArB,uBAAqBA,kBAAkB,CAAEE,EAAzC,CAFqB,CAAxB;AAIA,UAAI,CAACF,kBAAL,EAAyB,OAAO,IAAP;AAEzB,0BACE,+BAAC,sCAAD;AACE,QAAA,MAAM,EAAEA,kBAAkB,CAACM,MAD7B;AAEE,QAAA,WAAW,EAAEN,kBAAkB,CAACO,WAFlC;AAGE,QAAA,eAAe,EAAEH;AAHnB,QADF;AAOD,KAnB2D;AAAA;;AAAA","sourcesContent":["import { ComponentTreeNode, ComponentTreeNodeProps } from '@teambit/component-tree';\nimport { ComponentStatusResolver } from '@teambit/component.ui.component-status-resolver';\nimport React, { useContext, useMemo } from 'react';\n\nimport { useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { WorkspaceContext } from './ui/workspace/workspace-context';\n\nexport class ComponentTreeWidget implements ComponentTreeNode {\n widget = ({ component }: ComponentTreeNodeProps) => {\n const workspace = useContext(WorkspaceContext);\n const workspaceComponent = workspace.getComponent(component.id);\n const lanes = useLanesContext();\n\n const isInCurrentLane = useMemo(() => {\n return workspaceComponent?.id && lanes?.isInCurrentLane(workspaceComponent.id);\n }, [lanes?.currentLane, workspaceComponent?.id]);\n\n if (!workspaceComponent) return null;\n\n return (\n <ComponentStatusResolver\n status={workspaceComponent.status}\n issuesCount={workspaceComponent.issuesCount}\n isInCurrentLane={isInCurrentLane}\n />\n );\n };\n}\n"]}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Command, CommandOptions } from '@teambit/cli';
3
2
  import { EjectConfResult, Workspace } from './workspace';
4
3
  declare type EjectConfArgs = [string];
@@ -10,13 +9,12 @@ export default class EjectConfCmd implements Command {
10
9
  private workspace;
11
10
  name: string;
12
11
  description: string;
12
+ extendedDescription: string;
13
13
  alias: string;
14
14
  group: string;
15
- shortDescription: string;
16
15
  options: CommandOptions;
17
16
  constructor(workspace: Workspace);
18
- render(args: EjectConfArgs, options: EjectConfOptionsCLI): Promise<JSX.Element>;
19
17
  report(args: EjectConfArgs, options: EjectConfOptionsCLI): Promise<string>;
20
- json([componentId]: EjectConfArgs, options: EjectConfOptionsCLI): Promise<EjectConfResult>;
18
+ json([pattern]: EjectConfArgs, options: EjectConfOptionsCLI): Promise<EjectConfResult[]>;
21
19
  }
22
20
  export {};
@@ -21,30 +21,30 @@ function _defineProperty2() {
21
21
  return data;
22
22
  }
23
23
 
24
- function _chalk() {
25
- const data = _interopRequireDefault(require("chalk"));
24
+ function _path() {
25
+ const data = _interopRequireDefault(require("path"));
26
26
 
27
- _chalk = function () {
27
+ _path = function () {
28
28
  return data;
29
29
  };
30
30
 
31
31
  return data;
32
32
  }
33
33
 
34
- function _ink() {
35
- const data = require("ink");
34
+ function _chalk() {
35
+ const data = _interopRequireDefault(require("chalk"));
36
36
 
37
- _ink = function () {
37
+ _chalk = function () {
38
38
  return data;
39
39
  };
40
40
 
41
41
  return data;
42
42
  }
43
43
 
44
- function _react() {
45
- const data = _interopRequireDefault(require("react"));
44
+ function _constants() {
45
+ const data = require("@teambit/legacy/dist/constants");
46
46
 
47
- _react = function () {
47
+ _constants = function () {
48
48
  return data;
49
49
  };
50
50
 
@@ -54,31 +54,22 @@ function _react() {
54
54
  class EjectConfCmd {
55
55
  constructor(workspace) {
56
56
  this.workspace = workspace;
57
- (0, _defineProperty2().default)(this, "name", 'eject-conf [id]');
58
- (0, _defineProperty2().default)(this, "description", 'ejecting components configuration');
57
+ (0, _defineProperty2().default)(this, "name", 'eject-conf <pattern>');
58
+ (0, _defineProperty2().default)(this, "description", 'eject components configuration (create a `component.json` file)');
59
+ (0, _defineProperty2().default)(this, "extendedDescription", `${(0, _constants().PATTERN_HELP)('eject-conf')}`);
59
60
  (0, _defineProperty2().default)(this, "alias", '');
60
61
  (0, _defineProperty2().default)(this, "group", 'development');
61
- (0, _defineProperty2().default)(this, "shortDescription", 'eject the target component configuration file (e.g. create a `component.json` file)');
62
62
  (0, _defineProperty2().default)(this, "options", [['p', 'propagate', 'mark propagate true in the config file'], ['o', 'override', 'override file if exist']]);
63
- } // TODO: remove this ts-ignore
64
- // @ts-ignore
65
-
66
-
67
- async render(args, options) {
68
- const ejectResult = await this.json(args, options);
69
- const [componentId] = args;
70
- return /*#__PURE__*/_react().default.createElement(_ink().Text, {
71
- color: "green"
72
- }, "successfully ejected config for component ", componentId, " in path ", ejectResult.configPath);
73
63
  }
74
64
 
75
65
  async report(args, options) {
76
66
  const ejectResult = await this.json(args, options);
77
- const [componentId] = args;
78
- return `successfully ejected config for component ${_chalk().default.bold(componentId)} in path ${_chalk().default.green(ejectResult.configPath)}`;
67
+ const paths = ejectResult.map(result => result.configPath).map(p => _path().default.relative(this.workspace.path, p)).join('\n');
68
+ return _chalk().default.green(`successfully ejected config in the following path(s)
69
+ ${_chalk().default.bold(paths)}`);
79
70
  }
80
71
 
81
- async json([componentId], options) {
72
+ async json([pattern], options) {
82
73
  const ejectOptions = options;
83
74
 
84
75
  if (ejectOptions.propagate === 'true') {
@@ -89,8 +80,8 @@ class EjectConfCmd {
89
80
  ejectOptions.override = true;
90
81
  }
91
82
 
92
- const id = await this.workspace.resolveComponentId(componentId);
93
- const results = await this.workspace.ejectConfig(id, ejectOptions);
83
+ const componentIds = await this.workspace.idsByPattern(pattern);
84
+ const results = await this.workspace.ejectMultipleConfigs(componentIds, ejectOptions);
94
85
  return results;
95
86
  }
96
87
 
@@ -1 +1 @@
1
- {"version":3,"sources":["eject-conf.cmd.tsx"],"names":["EjectConfCmd","constructor","workspace","render","args","options","ejectResult","json","componentId","configPath","report","chalk","bold","green","ejectOptions","propagate","override","id","resolveComponentId","results","ejectConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAWe,MAAMA,YAAN,CAAsC;AAWnDC,EAAAA,WAAW,CAASC,SAAT,EAA+B;AAAA,SAAtBA,SAAsB,GAAtBA,SAAsB;AAAA,kDAVnC,iBAUmC;AAAA,yDAT5B,mCAS4B;AAAA,mDARlC,EAQkC;AAAA,mDAPlC,aAOkC;AAAA,8DANvB,qFAMuB;AAAA,qDALhC,CACR,CAAC,GAAD,EAAM,WAAN,EAAmB,wCAAnB,CADQ,EAER,CAAC,GAAD,EAAM,UAAN,EAAkB,wBAAlB,CAFQ,CAKgC;AAAE,GAXO,CAanD;AACA;;;AACY,QAANC,MAAM,CAACC,IAAD,EAAsBC,OAAtB,EAAoD;AAC9D,UAAMC,WAAW,GAAG,MAAM,KAAKC,IAAL,CAAUH,IAAV,EAAgBC,OAAhB,CAA1B;AACA,UAAM,CAACG,WAAD,IAAgBJ,IAAtB;AACA,wBACE,+BAAC,WAAD;AAAM,MAAA,KAAK,EAAC;AAAZ,qDAC6CI,WAD7C,eACmEF,WAAW,CAACG,UAD/E,CADF;AAKD;;AAEW,QAANC,MAAM,CAACN,IAAD,EAAsBC,OAAtB,EAAqE;AAC/E,UAAMC,WAAW,GAAG,MAAM,KAAKC,IAAL,CAAUH,IAAV,EAAgBC,OAAhB,CAA1B;AACA,UAAM,CAACG,WAAD,IAAgBJ,IAAtB;AACA,WAAQ,6CAA4CO,iBAAMC,IAAN,CAAWJ,WAAX,CAAwB,YAAWG,iBAAME,KAAN,CACrFP,WAAW,CAACG,UADyE,CAErF,EAFF;AAGD;;AAES,QAAJF,IAAI,CAAC,CAACC,WAAD,CAAD,EAA+BH,OAA/B,EAAuF;AAC/F,UAAMS,YAAY,GAAGT,OAArB;;AACA,QAAIS,YAAY,CAACC,SAAb,KAA2B,MAA/B,EAAuC;AACrCD,MAAAA,YAAY,CAACC,SAAb,GAAyB,IAAzB;AACD;;AACD,QAAID,YAAY,CAACE,QAAb,KAA0B,MAA9B,EAAsC;AACpCF,MAAAA,YAAY,CAACE,QAAb,GAAwB,IAAxB;AACD;;AAED,UAAMC,EAAE,GAAG,MAAM,KAAKf,SAAL,CAAegB,kBAAf,CAAkCV,WAAlC,CAAjB;AAEA,UAAMW,OAAO,GAAG,MAAM,KAAKjB,SAAL,CAAekB,WAAf,CAA2BH,EAA3B,EAA+BH,YAA/B,CAAtB;AACA,WAAOK,OAAP;AACD;;AA9CkD","sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Text } from 'ink';\nimport React from 'react';\n\nimport { EjectConfOptions, EjectConfResult, Workspace } from './workspace';\n\ntype EjectConfArgs = [string];\n// From the cli we might get those as string in case we run it like --propagate true (return string) as opposed to only --propagate\ntype EjectConfOptionsCLI = {\n propagate: string | boolean | undefined;\n override: string | boolean | undefined;\n};\n\nexport default class EjectConfCmd implements Command {\n name = 'eject-conf [id]';\n description = 'ejecting components configuration';\n alias = '';\n group = 'development';\n shortDescription = 'eject the target component configuration file (e.g. create a `component.json` file)';\n options = [\n ['p', 'propagate', 'mark propagate true in the config file'],\n ['o', 'override', 'override file if exist'],\n ] as CommandOptions;\n\n constructor(private workspace: Workspace) {}\n\n // TODO: remove this ts-ignore\n // @ts-ignore\n async render(args: EjectConfArgs, options: EjectConfOptionsCLI) {\n const ejectResult = await this.json(args, options);\n const [componentId] = args;\n return (\n <Text color=\"green\">\n successfully ejected config for component {componentId} in path {ejectResult.configPath}\n </Text>\n );\n }\n\n async report(args: EjectConfArgs, options: EjectConfOptionsCLI): Promise<string> {\n const ejectResult = await this.json(args, options);\n const [componentId] = args;\n return `successfully ejected config for component ${chalk.bold(componentId)} in path ${chalk.green(\n ejectResult.configPath\n )}`;\n }\n\n async json([componentId]: EjectConfArgs, options: EjectConfOptionsCLI): Promise<EjectConfResult> {\n const ejectOptions = options;\n if (ejectOptions.propagate === 'true') {\n ejectOptions.propagate = true;\n }\n if (ejectOptions.override === 'true') {\n ejectOptions.override = true;\n }\n\n const id = await this.workspace.resolveComponentId(componentId);\n\n const results = await this.workspace.ejectConfig(id, ejectOptions as EjectConfOptions);\n return results;\n }\n}\n"]}
1
+ {"version":3,"sources":["eject-conf.cmd.ts"],"names":["EjectConfCmd","constructor","workspace","report","args","options","ejectResult","json","paths","map","result","configPath","p","path","relative","join","chalk","green","bold","pattern","ejectOptions","propagate","override","componentIds","idsByPattern","results","ejectMultipleConfigs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAWe,MAAMA,YAAN,CAAsC;AAWnDC,EAAAA,WAAW,CAASC,SAAT,EAA+B;AAAA,SAAtBA,SAAsB,GAAtBA,SAAsB;AAAA,kDAVnC,sBAUmC;AAAA,yDAT5B,iEAS4B;AAAA,iEARnB,GAAE,+BAAa,YAAb,CAA2B,EAQV;AAAA,mDAPlC,EAOkC;AAAA,mDANlC,aAMkC;AAAA,qDALhC,CACR,CAAC,GAAD,EAAM,WAAN,EAAmB,wCAAnB,CADQ,EAER,CAAC,GAAD,EAAM,UAAN,EAAkB,wBAAlB,CAFQ,CAKgC;AAAE;;AAEhC,QAANC,MAAM,CAACC,IAAD,EAAsBC,OAAtB,EAAqE;AAC/E,UAAMC,WAAW,GAAG,MAAM,KAAKC,IAAL,CAAUH,IAAV,EAAgBC,OAAhB,CAA1B;AACA,UAAMG,KAAK,GAAGF,WAAW,CACtBG,GADW,CACNC,MAAD,IAAYA,MAAM,CAACC,UADZ,EAEXF,GAFW,CAENG,CAAD,IAAOC,gBAAKC,QAAL,CAAc,KAAKZ,SAAL,CAAeW,IAA7B,EAAmCD,CAAnC,CAFA,EAGXG,IAHW,CAGN,IAHM,CAAd;AAIA,WAAOC,iBAAMC,KAAN,CAAa;AACxB,EAAED,iBAAME,IAAN,CAAWV,KAAX,CAAkB,EADT,CAAP;AAED;;AAES,QAAJD,IAAI,CAAC,CAACY,OAAD,CAAD,EAA2Bd,OAA3B,EAAqF;AAC7F,UAAMe,YAAY,GAAGf,OAArB;;AACA,QAAIe,YAAY,CAACC,SAAb,KAA2B,MAA/B,EAAuC;AACrCD,MAAAA,YAAY,CAACC,SAAb,GAAyB,IAAzB;AACD;;AACD,QAAID,YAAY,CAACE,QAAb,KAA0B,MAA9B,EAAsC;AACpCF,MAAAA,YAAY,CAACE,QAAb,GAAwB,IAAxB;AACD;;AAED,UAAMC,YAAY,GAAG,MAAM,KAAKrB,SAAL,CAAesB,YAAf,CAA4BL,OAA5B,CAA3B;AACA,UAAMM,OAAO,GAAG,MAAM,KAAKvB,SAAL,CAAewB,oBAAf,CAAoCH,YAApC,EAAkDH,YAAlD,CAAtB;AACA,WAAOK,OAAP;AACD;;AAnCkD","sourcesContent":["import path from 'path';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { PATTERN_HELP } from '@teambit/legacy/dist/constants';\n\nimport { EjectConfOptions, EjectConfResult, Workspace } from './workspace';\n\ntype EjectConfArgs = [string];\n// From the cli we might get those as string in case we run it like --propagate true (return string) as opposed to only --propagate\ntype EjectConfOptionsCLI = {\n propagate: string | boolean | undefined;\n override: string | boolean | undefined;\n};\n\nexport default class EjectConfCmd implements Command {\n name = 'eject-conf <pattern>';\n description = 'eject components configuration (create a `component.json` file)';\n extendedDescription = `${PATTERN_HELP('eject-conf')}`;\n alias = '';\n group = 'development';\n options = [\n ['p', 'propagate', 'mark propagate true in the config file'],\n ['o', 'override', 'override file if exist'],\n ] as CommandOptions;\n\n constructor(private workspace: Workspace) {}\n\n async report(args: EjectConfArgs, options: EjectConfOptionsCLI): Promise<string> {\n const ejectResult = await this.json(args, options);\n const paths = ejectResult\n .map((result) => result.configPath)\n .map((p) => path.relative(this.workspace.path, p))\n .join('\\n');\n return chalk.green(`successfully ejected config in the following path(s)\n${chalk.bold(paths)}`);\n }\n\n async json([pattern]: EjectConfArgs, options: EjectConfOptionsCLI): Promise<EjectConfResult[]> {\n const ejectOptions = options;\n if (ejectOptions.propagate === 'true') {\n ejectOptions.propagate = true;\n }\n if (ejectOptions.override === 'true') {\n ejectOptions.override = true;\n }\n\n const componentIds = await this.workspace.idsByPattern(pattern);\n const results = await this.workspace.ejectMultipleConfigs(componentIds, ejectOptions as EjectConfOptions);\n return results;\n }\n}\n"]}
@@ -36,6 +36,10 @@ export declare class ComponentStatus {
36
36
  * the component is not authored and not imported.
37
37
  */
38
38
  readonly nested?: boolean | undefined;
39
+ /**
40
+ * does the component exist on the current lane
41
+ */
42
+ readonly isInCurrentLane?: boolean | undefined;
39
43
  constructor(
40
44
  /**
41
45
  * is the component modified.
@@ -68,6 +72,10 @@ export declare class ComponentStatus {
68
72
  /**
69
73
  * the component is not authored and not imported.
70
74
  */
71
- nested?: boolean | undefined);
72
- static fromLegacy(status: LegacyComponentStatus, hasModifiedDependencies: boolean, isOutdated: boolean): ComponentStatus;
75
+ nested?: boolean | undefined,
76
+ /**
77
+ * does the component exist on the current lane
78
+ */
79
+ isInCurrentLane?: boolean | undefined);
80
+ static fromLegacy(status: LegacyComponentStatus, hasModifiedDependencies: boolean, isOutdated: boolean, isInCurrentLane?: boolean): ComponentStatus;
73
81
  }
@@ -38,7 +38,11 @@ class ComponentStatus {
38
38
  /**
39
39
  * the component is not authored and not imported.
40
40
  */
41
- nested) {
41
+ nested,
42
+ /**
43
+ * does the component exist on the current lane
44
+ */
45
+ isInCurrentLane) {
42
46
  this.modifyInfo = modifyInfo;
43
47
  this.isNew = isNew;
44
48
  this.isDeleted = isDeleted;
@@ -47,14 +51,15 @@ class ComponentStatus {
47
51
  this.isInScope = isInScope;
48
52
  this.isOutdated = isOutdated;
49
53
  this.nested = nested;
54
+ this.isInCurrentLane = isInCurrentLane;
50
55
  }
51
56
 
52
- static fromLegacy(status, hasModifiedDependencies, isOutdated) {
57
+ static fromLegacy(status, hasModifiedDependencies, isOutdated, isInCurrentLane) {
53
58
  const modify = {
54
59
  hasModifiedFiles: !!status.modified,
55
60
  hasModifiedDependencies
56
61
  };
57
- return new ComponentStatus(modify, !!status.newlyCreated, !!status.deleted, !!status.staged, !status.notExist, !status.missingFromScope, isOutdated, !!status.nested);
62
+ return new ComponentStatus(modify, !!status.newlyCreated, !!status.deleted, !!status.staged, !status.notExist, !status.missingFromScope, isOutdated, !!status.nested, isInCurrentLane);
58
63
  }
59
64
 
60
65
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["component-status.ts"],"names":["ComponentStatus","constructor","modifyInfo","isNew","isDeleted","isStaged","isInWorkspace","isInScope","isOutdated","nested","fromLegacy","status","hasModifiedDependencies","modify","hasModifiedFiles","modified","newlyCreated","deleted","staged","notExist","missingFromScope"],"mappings":";;;;;;;AAOO,MAAMA,eAAN,CAAsB;AAC3BC,EAAAA,WAAW;AACT;AACJ;AACA;AACaC,EAAAA,UAJA;AAMT;AACJ;AACA;AACaC,EAAAA,KATA;AAWT;AACJ;AACA;AACaC,EAAAA,SAdA;AAgBT;AACJ;AACA;AACaC,EAAAA,QAnBA;AAqBT;AACJ;AACA;AACaC,EAAAA,aAxBA;AA0BT;AACJ;AACA;AACaC,EAAAA,SA7BA;AA+BT;AACJ;AACA;AACaC,EAAAA,UAlCA;AAoCT;AACJ;AACA;AACaC,EAAAA,MAvCA,EAwCT;AAAA,SApCSP,UAoCT,GApCSA,UAoCT;AAAA,SA/BSC,KA+BT,GA/BSA,KA+BT;AAAA,SA1BSC,SA0BT,GA1BSA,SA0BT;AAAA,SArBSC,QAqBT,GArBSA,QAqBT;AAAA,SAhBSC,aAgBT,GAhBSA,aAgBT;AAAA,SAXSC,SAWT,GAXSA,SAWT;AAAA,SANSC,UAMT,GANSA,UAMT;AAAA,SADSC,MACT,GADSA,MACT;AAAE;;AAEa,SAAVC,UAAU,CAACC,MAAD,EAAgCC,uBAAhC,EAAkEJ,UAAlE,EAAuF;AACtG,UAAMK,MAAkB,GAAG;AACzBC,MAAAA,gBAAgB,EAAE,CAAC,CAACH,MAAM,CAACI,QADF;AAEzBH,MAAAA;AAFyB,KAA3B;AAIA,WAAO,IAAIZ,eAAJ,CACLa,MADK,EAEL,CAAC,CAACF,MAAM,CAACK,YAFJ,EAGL,CAAC,CAACL,MAAM,CAACM,OAHJ,EAIL,CAAC,CAACN,MAAM,CAACO,MAJJ,EAKL,CAACP,MAAM,CAACQ,QALH,EAML,CAACR,MAAM,CAACS,gBANH,EAOLZ,UAPK,EAQL,CAAC,CAACG,MAAM,CAACF,MARJ,CAAP;AAUD;;AA1D0B","sourcesContent":["import { ComponentStatus as LegacyComponentStatus } from '@teambit/legacy/dist/consumer/component-ops/component-status-loader';\n\nexport type ModifyInfo = {\n hasModifiedFiles: boolean;\n hasModifiedDependencies: boolean;\n};\n\nexport class ComponentStatus {\n constructor(\n /**\n * is the component modified.\n */\n readonly modifyInfo: ModifyInfo,\n\n /**\n * is the new component new.\n */\n readonly isNew: boolean,\n\n /**\n * is the component deleted from the workspace.\n */\n readonly isDeleted: boolean,\n\n /**\n * is the component staged.\n */\n readonly isStaged: boolean,\n\n /**\n * does the component exists in the workspace.\n */\n readonly isInWorkspace: boolean,\n\n /**\n * does the component exists in the scope.\n */\n readonly isInScope: boolean,\n\n /**\n * does the component is outdated (pending for update).\n */\n readonly isOutdated: boolean,\n\n /**\n * the component is not authored and not imported.\n */\n readonly nested?: boolean\n ) {}\n\n static fromLegacy(status: LegacyComponentStatus, hasModifiedDependencies: boolean, isOutdated: boolean) {\n const modify: ModifyInfo = {\n hasModifiedFiles: !!status.modified,\n hasModifiedDependencies,\n };\n return new ComponentStatus(\n modify,\n !!status.newlyCreated,\n !!status.deleted,\n !!status.staged,\n !status.notExist,\n !status.missingFromScope,\n isOutdated,\n !!status.nested\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["component-status.ts"],"names":["ComponentStatus","constructor","modifyInfo","isNew","isDeleted","isStaged","isInWorkspace","isInScope","isOutdated","nested","isInCurrentLane","fromLegacy","status","hasModifiedDependencies","modify","hasModifiedFiles","modified","newlyCreated","deleted","staged","notExist","missingFromScope"],"mappings":";;;;;;;AAOO,MAAMA,eAAN,CAAsB;AAC3BC,EAAAA,WAAW;AACT;AACJ;AACA;AACaC,EAAAA,UAJA;AAMT;AACJ;AACA;AACaC,EAAAA,KATA;AAWT;AACJ;AACA;AACaC,EAAAA,SAdA;AAgBT;AACJ;AACA;AACaC,EAAAA,QAnBA;AAqBT;AACJ;AACA;AACaC,EAAAA,aAxBA;AA0BT;AACJ;AACA;AACaC,EAAAA,SA7BA;AA+BT;AACJ;AACA;AACaC,EAAAA,UAlCA;AAoCT;AACJ;AACA;AACaC,EAAAA,MAvCA;AAwCT;AACJ;AACA;AACaC,EAAAA,eA3CA,EA4CT;AAAA,SAxCSR,UAwCT,GAxCSA,UAwCT;AAAA,SAnCSC,KAmCT,GAnCSA,KAmCT;AAAA,SA9BSC,SA8BT,GA9BSA,SA8BT;AAAA,SAzBSC,QAyBT,GAzBSA,QAyBT;AAAA,SApBSC,aAoBT,GApBSA,aAoBT;AAAA,SAfSC,SAeT,GAfSA,SAeT;AAAA,SAVSC,UAUT,GAVSA,UAUT;AAAA,SALSC,MAKT,GALSA,MAKT;AAAA,SADSC,eACT,GADSA,eACT;AAAE;;AAEa,SAAVC,UAAU,CACfC,MADe,EAEfC,uBAFe,EAGfL,UAHe,EAIfE,eAJe,EAKf;AACA,UAAMI,MAAkB,GAAG;AACzBC,MAAAA,gBAAgB,EAAE,CAAC,CAACH,MAAM,CAACI,QADF;AAEzBH,MAAAA;AAFyB,KAA3B;AAIA,WAAO,IAAIb,eAAJ,CACLc,MADK,EAEL,CAAC,CAACF,MAAM,CAACK,YAFJ,EAGL,CAAC,CAACL,MAAM,CAACM,OAHJ,EAIL,CAAC,CAACN,MAAM,CAACO,MAJJ,EAKL,CAACP,MAAM,CAACQ,QALH,EAML,CAACR,MAAM,CAACS,gBANH,EAOLb,UAPK,EAQL,CAAC,CAACI,MAAM,CAACH,MARJ,EASLC,eATK,CAAP;AAWD;;AApE0B","sourcesContent":["import { ComponentStatus as LegacyComponentStatus } from '@teambit/legacy/dist/consumer/component-ops/component-status-loader';\n\nexport type ModifyInfo = {\n hasModifiedFiles: boolean;\n hasModifiedDependencies: boolean;\n};\n\nexport class ComponentStatus {\n constructor(\n /**\n * is the component modified.\n */\n readonly modifyInfo: ModifyInfo,\n\n /**\n * is the new component new.\n */\n readonly isNew: boolean,\n\n /**\n * is the component deleted from the workspace.\n */\n readonly isDeleted: boolean,\n\n /**\n * is the component staged.\n */\n readonly isStaged: boolean,\n\n /**\n * does the component exists in the workspace.\n */\n readonly isInWorkspace: boolean,\n\n /**\n * does the component exists in the scope.\n */\n readonly isInScope: boolean,\n\n /**\n * does the component is outdated (pending for update).\n */\n readonly isOutdated: boolean,\n\n /**\n * the component is not authored and not imported.\n */\n readonly nested?: boolean,\n /**\n * does the component exist on the current lane\n */\n readonly isInCurrentLane?: boolean\n ) {}\n\n static fromLegacy(\n status: LegacyComponentStatus,\n hasModifiedDependencies: boolean,\n isOutdated: boolean,\n isInCurrentLane?: boolean\n ) {\n const modify: ModifyInfo = {\n hasModifiedFiles: !!status.modified,\n hasModifiedDependencies,\n };\n return new ComponentStatus(\n modify,\n !!status.newlyCreated,\n !!status.deleted,\n !!status.staged,\n !status.notExist,\n !status.missingFromScope,\n isOutdated,\n !!status.nested,\n isInCurrentLane\n );\n }\n}\n"]}
@@ -274,6 +274,7 @@ export declare class Workspace implements ComponentFactory {
274
274
  lane: Lane;
275
275
  } | null>;
276
276
  getDefaultExtensions(): ExtensionDataList;
277
+ ejectMultipleConfigs(ids: ComponentID[], options: EjectConfOptions): Promise<EjectConfResult[]>;
277
278
  ejectConfig(id: ComponentID, options: EjectConfOptions): Promise<EjectConfResult>;
278
279
  /**
279
280
  * see component-aspect, createAspectListFromLegacy() method for a context why this is needed.
package/dist/workspace.js CHANGED
@@ -1063,6 +1063,10 @@ class Workspace {
1063
1063
  return _extensionData().ExtensionDataList.fromConfigObject(this.config.extensions);
1064
1064
  }
1065
1065
 
1066
+ async ejectMultipleConfigs(ids, options) {
1067
+ return Promise.all(ids.map(id => this.ejectConfig(id, options)));
1068
+ }
1069
+
1066
1070
  async ejectConfig(id, options) {
1067
1071
  const componentId = await this.resolveComponentId(id);
1068
1072
  const component = await this.scope.get(componentId);
@@ -1764,10 +1768,15 @@ needed-for: ${(neededFor === null || neededFor === void 0 ? void 0 : neededFor.t
1764
1768
  if (this.aspectLoader.isValidAspect(manifest)) return undefined;
1765
1769
  return index;
1766
1770
  }));
1767
- const manifestsIds = workspaceManifests.map(m => m.id);
1768
- const scopeManifests = await this.scope.getManifestsGraphRecursively(scopeIds, (0, _lodash().compact)(manifestsIds), throwOnError);
1769
- const allManifests = [...scopeManifests, ...workspaceManifests];
1770
- await this.aspectLoader.loadExtensionsByManifests(allManifests, throwOnError); // Try require components for potential plugins
1771
+ const workspaceManifestsIds = (0, _lodash().compact)(workspaceManifests.map(m => m.id)); // We are grouping the scope aspects by whether they are envs of something of the list or not
1772
+ // if yes, we want to load them first
1773
+ // the rest we will load together with the workspace aspects
1774
+
1775
+ const scopeIdsGrouped = await this.scope.groupAspectIdsByEnvOfTheList(scopeIds);
1776
+ const scopeEnvsManifestsIds = scopeIdsGrouped.envs && scopeIdsGrouped.envs.length ? await this.scope.loadAspects(scopeIdsGrouped.envs, throwOnError) : [];
1777
+ const scopeOtherManifests = scopeIdsGrouped.other && scopeIdsGrouped.other.length ? await this.scope.getManifestsGraphRecursively(scopeIdsGrouped.other, (0, _lodash().compact)(workspaceManifestsIds), throwOnError) : [];
1778
+ const scopeOtherManifestsIds = (0, _lodash().compact)(scopeOtherManifests.map(m => m.id));
1779
+ await this.aspectLoader.loadExtensionsByManifests([...scopeOtherManifests, ...workspaceManifests], throwOnError); // Try require components for potential plugins
1771
1780
 
1772
1781
  const pluginsWorkspaceComps = potentialPluginsIndexes.map(index => {
1773
1782
  return workspaceComps[index];
@@ -1776,7 +1785,7 @@ needed-for: ${(neededFor === null || neededFor === void 0 ? void 0 : neededFor.t
1776
1785
  const pluginsWorkspaceAspects = await this.requireComponents(pluginsWorkspaceComps);
1777
1786
  const pluginsWorkspaceManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(pluginsWorkspaceAspects, throwOnError);
1778
1787
  await this.aspectLoader.loadExtensionsByManifests(pluginsWorkspaceManifests, throwOnError);
1779
- return (0, _lodash().compact)(allManifests.map(manifest => manifest.id));
1788
+ return (0, _lodash().compact)(scopeEnvsManifestsIds.concat(scopeOtherManifestsIds).concat(workspaceManifestsIds));
1780
1789
  }
1781
1790
  /**
1782
1791
  * Note - this gets called from Harmony only.