@teambit/version-history 0.0.542 → 0.0.544

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.
@@ -4,8 +4,10 @@ export declare class VersionHistoryCmd implements Command {
4
4
  name: string;
5
5
  alias: string;
6
6
  description: string;
7
+ extendedDescription: string;
7
8
  options: never[];
8
9
  group: string;
10
+ private: boolean;
9
11
  commands: Command[];
10
12
  report([unrecognizedSubcommand]: [string]): Promise<string>;
11
13
  }
@@ -26,6 +28,7 @@ export declare class VersionHistoryBuildCmd implements Command {
26
28
  }[];
27
29
  options: CommandOptions;
28
30
  group: string;
31
+ private: boolean;
29
32
  constructor(versionHistoryMain: VersionHistoryMain);
30
33
  report([pattern]: [string], opts: BuildOptions): Promise<string>;
31
34
  }
@@ -37,6 +40,7 @@ export declare class VersionHistoryGraphCmd implements Command {
37
40
  options: CommandOptions;
38
41
  group: string;
39
42
  commands: Command[];
43
+ private: boolean;
40
44
  constructor(versionHistoryMain: VersionHistoryMain);
41
45
  report([id]: [string], { shortHash, mark, png, layout, limit, }: {
42
46
  shortHash?: boolean;
@@ -57,6 +61,7 @@ export declare class VersionHistoryShowCmd implements Command {
57
61
  options: CommandOptions;
58
62
  group: string;
59
63
  commands: Command[];
64
+ private: boolean;
60
65
  constructor(versionHistoryMain: VersionHistoryMain);
61
66
  report([id]: [string], { shortHash }: ShowOptions): Promise<string>;
62
67
  json([id]: [string]): Promise<Record<string, any>>;
@@ -40,9 +40,13 @@ class VersionHistoryCmd {
40
40
  constructor() {
41
41
  _defineProperty(this, "name", 'version-history <sub-command>');
42
42
  _defineProperty(this, "alias", 'vh');
43
- _defineProperty(this, "description", 'manage the version-history of components');
43
+ _defineProperty(this, "description", 'manage component version history data structures');
44
+ _defineProperty(this, "extendedDescription", `tools for building and maintaining the internal version history data that tracks component evolution and relationships.
45
+ includes commands to rebuild corrupted version history, generate visual graphs, and inspect version relationships.
46
+ mainly used for debugging and repair purposes when version history data becomes corrupted.`);
44
47
  _defineProperty(this, "options", []);
45
48
  _defineProperty(this, "group", 'version-control');
49
+ _defineProperty(this, "private", true);
46
50
  _defineProperty(this, "commands", []);
47
51
  }
48
52
  async report([unrecognizedSubcommand]) {
@@ -60,7 +64,8 @@ class VersionHistoryBuildCmd {
60
64
  description: _legacy().COMPONENT_PATTERN_HELP
61
65
  }]);
62
66
  _defineProperty(this, "options", [['', 'from-snap <snap>', 'build the version history from a specific snap. the pattern must be a single component-id'], ['', 'from-all-lanes', 'build the version history from the heads of all lanes that include this component'], ['', 'delete-existing', 'delete the existing version history before building it'], ['', 'remote <scope>', 'make the change on the remote scope']]);
63
- _defineProperty(this, "group", 'info-analysis');
67
+ _defineProperty(this, "group", 'version-control');
68
+ _defineProperty(this, "private", true);
64
69
  }
65
70
  async report([pattern], opts) {
66
71
  const results = await this.versionHistoryMain.buildByPattern(pattern, opts);
@@ -89,8 +94,9 @@ class VersionHistoryGraphCmd {
89
94
  _defineProperty(this, "alias", '');
90
95
  _defineProperty(this, "description", 'generate a graph of the version history of a component and save as an SVG file');
91
96
  _defineProperty(this, "options", [['s', 'short-hash', 'show only 9 chars of the hash'], ['m', 'mark <string>', 'paint the given node-ids in the graph in red color, for multiple, separate by commas'], ['', 'png', 'save the graph as a png file instead of svg. requires "graphviz" to be installed'], ['l', 'layout <name>', 'GraphVis layout. default to "dot". options are [circo, dot, fdp, neato, osage, patchwork, sfdp, twopi]'], ['', 'limit <number>', 'limit the number of nodes in the graph (starting from the heads)']]);
92
- _defineProperty(this, "group", 'info-analysis');
97
+ _defineProperty(this, "group", 'version-control');
93
98
  _defineProperty(this, "commands", []);
99
+ _defineProperty(this, "private", true);
94
100
  }
95
101
  async report([id], {
96
102
  shortHash,
@@ -124,8 +130,9 @@ class VersionHistoryShowCmd {
124
130
  _defineProperty(this, "alias", 'vh');
125
131
  _defineProperty(this, "description", 'show the version-history of a component');
126
132
  _defineProperty(this, "options", [['s', 'short-hash', 'show only 9 chars of the hash'], ['j', 'json', 'json format']]);
127
- _defineProperty(this, "group", 'info-analysis');
133
+ _defineProperty(this, "group", 'version-control');
128
134
  _defineProperty(this, "commands", []);
135
+ _defineProperty(this, "private", true);
129
136
  }
130
137
  async report([id], {
131
138
  shortHash
@@ -1 +1 @@
1
- {"version":3,"names":["_legacy","data","require","_legacy2","_chalk","_interopRequireDefault","_catVersionHistory","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","VersionHistoryCmd","constructor","report","unrecognizedSubcommand","chalk","red","exports","VersionHistoryBuildCmd","versionHistoryMain","name","description","COMPONENT_PATTERN_HELP","pattern","opts","results","buildByPattern","resultsStr","keys","map","idStr","result","getMsg","err","message","added","length","msg","bold","join","green","colorPerEdgeType","unrelated","squashed","VersionHistoryGraphCmd","id","shortHash","mark","png","layout","limit","graphHistory","generateGraph","markIds","split","node","trim","undefined","config","visualDependencyGraph","VisualDependencyGraph","loadFromClearGraph","render","RangeError","Error","VersionHistoryShowCmd","versionHistory","show","output","item","pointers","cyan","edges","edge","hash","type","json","catVersionHistory"],"sources":["version-history-cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { GraphConfig } from '@teambit/legacy.dependency-graph';\nimport { VisualDependencyGraph } from '@teambit/legacy.dependency-graph';\nimport chalk from 'chalk';\nimport type { VersionHistoryMain } from './version-history.main.runtime';\nimport { catVersionHistory } from './cat-version-history';\n\nexport class VersionHistoryCmd implements Command {\n name = 'version-history <sub-command>';\n alias = 'vh';\n description = 'manage the version-history of components';\n options = [];\n group = 'version-control';\n commands: Command[] = [];\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"version-history\", please run \"bit version-history --help\" to list the subcommands`\n );\n }\n}\n\nexport type BuildOptions = {\n fromSnap?: string;\n deleteExisting?: boolean;\n remote?: string;\n pattern?: string;\n fromAllLanes?: boolean;\n};\n\nexport class VersionHistoryBuildCmd implements Command {\n name = 'build <component-pattern>';\n description = 'rebuild the version history of a component. helpful when it got corrupted for some reason';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n options = [\n [\n '',\n 'from-snap <snap>',\n 'build the version history from a specific snap. the pattern must be a single component-id',\n ],\n ['', 'from-all-lanes', 'build the version history from the heads of all lanes that include this component'],\n ['', 'delete-existing', 'delete the existing version history before building it'],\n ['', 'remote <scope>', 'make the change on the remote scope'],\n ] as CommandOptions;\n group = 'info-analysis';\n\n constructor(private versionHistoryMain: VersionHistoryMain) {}\n\n async report([pattern]: [string], opts: BuildOptions) {\n const results = await this.versionHistoryMain.buildByPattern(pattern, opts);\n const resultsStr = Object.keys(results)\n .map((idStr) => {\n const result = results[idStr];\n const getMsg = () => {\n if (result.err) return `failed with an error: ${chalk.red(result.err.message)}`;\n if (!result.added) return 'no changes';\n return `successfully added ${result.added.length} hashes`;\n };\n const msg = getMsg();\n return `${chalk.bold(idStr)}: ${msg}`;\n })\n .join('\\n');\n\n return `${chalk.green('completed building version history for the following component(s)')}:\\n${resultsStr}`;\n }\n}\n\nconst colorPerEdgeType = {\n unrelated: 'red',\n squashed: 'blue',\n};\n\nexport class VersionHistoryGraphCmd implements Command {\n name = 'graph <component-id>';\n alias = '';\n description = 'generate a graph of the version history of a component and save as an SVG file';\n options = [\n ['s', 'short-hash', 'show only 9 chars of the hash'],\n ['m', 'mark <string>', 'paint the given node-ids in the graph in red color, for multiple, separate by commas'],\n ['', 'png', 'save the graph as a png file instead of svg. requires \"graphviz\" to be installed'],\n [\n 'l',\n 'layout <name>',\n 'GraphVis layout. default to \"dot\". options are [circo, dot, fdp, neato, osage, patchwork, sfdp, twopi]',\n ],\n ['', 'limit <number>', 'limit the number of nodes in the graph (starting from the heads)'],\n ] as CommandOptions;\n group = 'info-analysis';\n commands: Command[] = [];\n\n constructor(private versionHistoryMain: VersionHistoryMain) {}\n\n async report(\n [id]: [string],\n {\n shortHash,\n mark,\n png,\n layout,\n limit,\n }: {\n shortHash?: boolean;\n mark?: string;\n png?: boolean;\n layout?: string;\n limit?: number;\n }\n ) {\n const graphHistory = await this.versionHistoryMain.generateGraph(id, shortHash, limit);\n const markIds = mark ? mark.split(',').map((node) => node.trim()) : undefined;\n const config: GraphConfig = { colorPerEdgeType };\n if (layout) config.layout = layout;\n const visualDependencyGraph = await VisualDependencyGraph.loadFromClearGraph(graphHistory, config, markIds);\n\n try {\n return await visualDependencyGraph.render(png ? 'png' : 'svg');\n } catch (err) {\n if (err instanceof RangeError) {\n throw new Error(\n 'failed to render the graph, the graph is too big. try to limit the number of nodes by using \"--limit\" flag'\n );\n }\n throw err;\n }\n }\n}\n\nexport type ShowOptions = { shortHash?: boolean };\n\nexport class VersionHistoryShowCmd implements Command {\n name = 'show <component-id>';\n alias = 'vh';\n description = 'show the version-history of a component';\n options = [\n ['s', 'short-hash', 'show only 9 chars of the hash'],\n ['j', 'json', 'json format'],\n ] as CommandOptions;\n group = 'info-analysis';\n commands: Command[] = [];\n\n constructor(private versionHistoryMain: VersionHistoryMain) {}\n\n async report([id]: [string], { shortHash }: ShowOptions) {\n const versionHistory = await this.versionHistoryMain.show(id, { shortHash });\n const output = versionHistory\n .map((item) => {\n const pointers = item.pointers.length ? ` (${chalk.cyan(item.pointers.join(', '))})` : '';\n const edges = item.edges.map((edge) => `${edge.hash} (${edge.type})`).join(', ');\n return `${chalk.bold(item.node)}${pointers} ${edges}`;\n })\n .join('\\n');\n return output;\n }\n\n async json([id]: [string]) {\n return catVersionHistory(id);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA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;EAAuB,CAAC,EAAE;IACvD,MAAMoB,cAAc,GAAG,MAAM,IAAI,CAAC/C,kBAAkB,CAACgD,IAAI,CAACtB,EAAE,EAAE;MAAEC;IAAU,CAAC,CAAC;IAC5E,MAAMsB,MAAM,GAAGF,cAAc,CAC1BrC,GAAG,CAAEwC,IAAI,IAAK;MACb,MAAMC,QAAQ,GAAGD,IAAI,CAACC,QAAQ,CAAClC,MAAM,GAAG,KAAKrB,gBAAK,CAACwD,IAAI,CAACF,IAAI,CAACC,QAAQ,CAAC/B,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE;MACzF,MAAMiC,KAAK,GAAGH,IAAI,CAACG,KAAK,CAAC3C,GAAG,CAAE4C,IAAI,IAAK,GAAGA,IAAI,CAACC,IAAI,KAAKD,IAAI,CAACE,IAAI,GAAG,CAAC,CAACpC,IAAI,CAAC,IAAI,CAAC;MAChF,OAAO,GAAGxB,gBAAK,CAACuB,IAAI,CAAC+B,IAAI,CAACd,IAAI,CAAC,GAAGe,QAAQ,IAAIE,KAAK,EAAE;IACvD,CAAC,CAAC,CACDjC,IAAI,CAAC,IAAI,CAAC;IACb,OAAO6B,MAAM;EACf;EAEA,MAAMQ,IAAIA,CAAC,CAAC/B,EAAE,CAAW,EAAE;IACzB,OAAO,IAAAgC,sCAAiB,EAAChC,EAAE,CAAC;EAC9B;AACF;AAAC5B,OAAA,CAAAgD,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_legacy","data","require","_legacy2","_chalk","_interopRequireDefault","_catVersionHistory","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","VersionHistoryCmd","constructor","report","unrecognizedSubcommand","chalk","red","exports","VersionHistoryBuildCmd","versionHistoryMain","name","description","COMPONENT_PATTERN_HELP","pattern","opts","results","buildByPattern","resultsStr","keys","map","idStr","result","getMsg","err","message","added","length","msg","bold","join","green","colorPerEdgeType","unrelated","squashed","VersionHistoryGraphCmd","id","shortHash","mark","png","layout","limit","graphHistory","generateGraph","markIds","split","node","trim","undefined","config","visualDependencyGraph","VisualDependencyGraph","loadFromClearGraph","render","RangeError","Error","VersionHistoryShowCmd","versionHistory","show","output","item","pointers","cyan","edges","edge","hash","type","json","catVersionHistory"],"sources":["version-history-cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { GraphConfig } from '@teambit/legacy.dependency-graph';\nimport { VisualDependencyGraph } from '@teambit/legacy.dependency-graph';\nimport chalk from 'chalk';\nimport type { VersionHistoryMain } from './version-history.main.runtime';\nimport { catVersionHistory } from './cat-version-history';\n\nexport class VersionHistoryCmd implements Command {\n name = 'version-history <sub-command>';\n alias = 'vh';\n description = 'manage component version history data structures';\n extendedDescription = `tools for building and maintaining the internal version history data that tracks component evolution and relationships.\nincludes commands to rebuild corrupted version history, generate visual graphs, and inspect version relationships.\nmainly used for debugging and repair purposes when version history data becomes corrupted.`;\n options = [];\n group = 'version-control';\n private = true;\n commands: Command[] = [];\n\n async report([unrecognizedSubcommand]: [string]) {\n return chalk.red(\n `\"${unrecognizedSubcommand}\" is not a subcommand of \"version-history\", please run \"bit version-history --help\" to list the subcommands`\n );\n }\n}\n\nexport type BuildOptions = {\n fromSnap?: string;\n deleteExisting?: boolean;\n remote?: string;\n pattern?: string;\n fromAllLanes?: boolean;\n};\n\nexport class VersionHistoryBuildCmd implements Command {\n name = 'build <component-pattern>';\n description = 'rebuild the version history of a component. helpful when it got corrupted for some reason';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n options = [\n [\n '',\n 'from-snap <snap>',\n 'build the version history from a specific snap. the pattern must be a single component-id',\n ],\n ['', 'from-all-lanes', 'build the version history from the heads of all lanes that include this component'],\n ['', 'delete-existing', 'delete the existing version history before building it'],\n ['', 'remote <scope>', 'make the change on the remote scope'],\n ] as CommandOptions;\n group = 'version-control';\n private = true;\n\n constructor(private versionHistoryMain: VersionHistoryMain) {}\n\n async report([pattern]: [string], opts: BuildOptions) {\n const results = await this.versionHistoryMain.buildByPattern(pattern, opts);\n const resultsStr = Object.keys(results)\n .map((idStr) => {\n const result = results[idStr];\n const getMsg = () => {\n if (result.err) return `failed with an error: ${chalk.red(result.err.message)}`;\n if (!result.added) return 'no changes';\n return `successfully added ${result.added.length} hashes`;\n };\n const msg = getMsg();\n return `${chalk.bold(idStr)}: ${msg}`;\n })\n .join('\\n');\n\n return `${chalk.green('completed building version history for the following component(s)')}:\\n${resultsStr}`;\n }\n}\n\nconst colorPerEdgeType = {\n unrelated: 'red',\n squashed: 'blue',\n};\n\nexport class VersionHistoryGraphCmd implements Command {\n name = 'graph <component-id>';\n alias = '';\n description = 'generate a graph of the version history of a component and save as an SVG file';\n options = [\n ['s', 'short-hash', 'show only 9 chars of the hash'],\n ['m', 'mark <string>', 'paint the given node-ids in the graph in red color, for multiple, separate by commas'],\n ['', 'png', 'save the graph as a png file instead of svg. requires \"graphviz\" to be installed'],\n [\n 'l',\n 'layout <name>',\n 'GraphVis layout. default to \"dot\". options are [circo, dot, fdp, neato, osage, patchwork, sfdp, twopi]',\n ],\n ['', 'limit <number>', 'limit the number of nodes in the graph (starting from the heads)'],\n ] as CommandOptions;\n group = 'version-control';\n commands: Command[] = [];\n private = true;\n\n constructor(private versionHistoryMain: VersionHistoryMain) {}\n\n async report(\n [id]: [string],\n {\n shortHash,\n mark,\n png,\n layout,\n limit,\n }: {\n shortHash?: boolean;\n mark?: string;\n png?: boolean;\n layout?: string;\n limit?: number;\n }\n ) {\n const graphHistory = await this.versionHistoryMain.generateGraph(id, shortHash, limit);\n const markIds = mark ? mark.split(',').map((node) => node.trim()) : undefined;\n const config: GraphConfig = { colorPerEdgeType };\n if (layout) config.layout = layout;\n const visualDependencyGraph = await VisualDependencyGraph.loadFromClearGraph(graphHistory, config, markIds);\n\n try {\n return await visualDependencyGraph.render(png ? 'png' : 'svg');\n } catch (err) {\n if (err instanceof RangeError) {\n throw new Error(\n 'failed to render the graph, the graph is too big. try to limit the number of nodes by using \"--limit\" flag'\n );\n }\n throw err;\n }\n }\n}\n\nexport type ShowOptions = { shortHash?: boolean };\n\nexport class VersionHistoryShowCmd implements Command {\n name = 'show <component-id>';\n alias = 'vh';\n description = 'show the version-history of a component';\n options = [\n ['s', 'short-hash', 'show only 9 chars of the hash'],\n ['j', 'json', 'json format'],\n ] as CommandOptions;\n group = 'version-control';\n commands: Command[] = [];\n private = true;\n\n constructor(private versionHistoryMain: VersionHistoryMain) {}\n\n async report([id]: [string], { shortHash }: ShowOptions) {\n const versionHistory = await this.versionHistoryMain.show(id, { shortHash });\n const output = versionHistory\n .map((item) => {\n const pointers = item.pointers.length ? ` (${chalk.cyan(item.pointers.join(', '))})` : '';\n const edges = item.edges.map((edge) => `${edge.hash} (${edge.type})`).join(', ');\n return `${chalk.bold(item.node)}${pointers} ${edges}`;\n })\n .join('\\n');\n return output;\n }\n\n async json([id]: [string]) {\n return catVersionHistory(id);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,mBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,kBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,I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C,IAAI,IAAK;MACb,MAAMC,QAAQ,GAAGD,IAAI,CAACC,QAAQ,CAAClC,MAAM,GAAG,KAAKrB,gBAAK,CAACwD,IAAI,CAACF,IAAI,CAACC,QAAQ,CAAC/B,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE;MACzF,MAAMiC,KAAK,GAAGH,IAAI,CAACG,KAAK,CAAC3C,GAAG,CAAE4C,IAAI,IAAK,GAAGA,IAAI,CAACC,IAAI,KAAKD,IAAI,CAACE,IAAI,GAAG,CAAC,CAACpC,IAAI,CAAC,IAAI,CAAC;MAChF,OAAO,GAAGxB,gBAAK,CAACuB,IAAI,CAAC+B,IAAI,CAACd,IAAI,CAAC,GAAGe,QAAQ,IAAIE,KAAK,EAAE;IACvD,CAAC,CAAC,CACDjC,IAAI,CAAC,IAAI,CAAC;IACb,OAAO6B,MAAM;EACf;EAEA,MAAMQ,IAAIA,CAAC,CAAC/B,EAAE,CAAW,EAAE;IACzB,OAAO,IAAAgC,sCAAiB,EAAChC,EAAE,CAAC;EAC9B;AACF;AAAC5B,OAAA,CAAAgD,qBAAA,GAAAA,qBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
2
  "name": "@teambit/version-history",
3
- "version": "0.0.542",
3
+ "version": "0.0.544",
4
4
  "homepage": "https://bit.cloud/teambit/scope/version-history",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.scope",
8
8
  "name": "version-history",
9
- "version": "0.0.542"
9
+ "version": "0.0.544"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
13
13
  "lodash": "4.17.21",
14
- "@teambit/cli": "0.0.1272",
15
- "@teambit/legacy.scope": "0.0.73",
16
- "@teambit/legacy.constants": "0.0.17",
17
- "@teambit/legacy.dependency-graph": "0.0.76",
14
+ "@teambit/cli": "0.0.1273",
15
+ "@teambit/legacy.scope": "0.0.74",
16
+ "@teambit/legacy.constants": "0.0.18",
17
+ "@teambit/legacy.dependency-graph": "0.0.77",
18
18
  "@teambit/harmony": "0.4.7",
19
19
  "@teambit/bit-error": "0.0.404",
20
20
  "@teambit/component-id": "1.2.4",
21
- "@teambit/legacy.consumer": "0.0.73",
22
- "@teambit/legacy.scope-api": "0.0.128",
23
- "@teambit/logger": "0.0.1365",
24
- "@teambit/scope.remotes": "0.0.73",
25
- "@teambit/objects": "0.0.257",
26
- "@teambit/scope": "1.0.750"
21
+ "@teambit/legacy.consumer": "0.0.74",
22
+ "@teambit/legacy.scope-api": "0.0.129",
23
+ "@teambit/logger": "0.0.1366",
24
+ "@teambit/scope.remotes": "0.0.74",
25
+ "@teambit/objects": "0.0.259",
26
+ "@teambit/scope": "1.0.752"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/lodash": "4.14.165",