@teambit/cli 0.0.1395 → 0.0.1396

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/dist/index.d.ts CHANGED
@@ -10,6 +10,6 @@ export type { Command, CLIArgs, Flags, GenericObject, CommandOptions, Report } f
10
10
  export { getArgsData, getCommandName, getFlagsData } from './command-helper';
11
11
  export { canPromptUser } from './pager';
12
12
  export * from './exceptions';
13
- export { successSymbol, warnSymbol, errorSymbol, bulletSymbol, formatItem, formatSection, formatTitle, formatHint, formatDetailsHint, formatSuccessSummary, formatWarningSummary, joinSections, renderSections, } from './output-formatter';
13
+ export { successSymbol, warnSymbol, errorSymbol, bulletSymbol, arrowSymbol, formatBytes, formatItem, formatSection, formatTitle, formatHint, formatDetailsHint, formatSuccessSummary, formatWarningSummary, joinSections, renderSections, } from './output-formatter';
14
14
  export type { OutputSection } from './output-formatter';
15
15
  export { CLIAspect as default, MainRuntime, CLIAspect };
package/dist/index.js CHANGED
@@ -20,6 +20,8 @@ var _exportNames = {
20
20
  warnSymbol: true,
21
21
  errorSymbol: true,
22
22
  bulletSymbol: true,
23
+ arrowSymbol: true,
24
+ formatBytes: true,
23
25
  formatItem: true,
24
26
  formatSection: true,
25
27
  formatTitle: true,
@@ -48,6 +50,12 @@ Object.defineProperty(exports, "MainRuntime", {
48
50
  return _cli().MainRuntime;
49
51
  }
50
52
  });
53
+ Object.defineProperty(exports, "arrowSymbol", {
54
+ enumerable: true,
55
+ get: function () {
56
+ return _outputFormatter().arrowSymbol;
57
+ }
58
+ });
51
59
  Object.defineProperty(exports, "bulletSymbol", {
52
60
  enumerable: true,
53
61
  get: function () {
@@ -78,6 +86,12 @@ Object.defineProperty(exports, "errorSymbol", {
78
86
  return _outputFormatter().errorSymbol;
79
87
  }
80
88
  });
89
+ Object.defineProperty(exports, "formatBytes", {
90
+ enumerable: true,
91
+ get: function () {
92
+ return _outputFormatter().formatBytes;
93
+ }
94
+ });
81
95
  Object.defineProperty(exports, "formatDetailsHint", {
82
96
  enumerable: true,
83
97
  get: function () {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_globalFlags","_interopRequireDefault","_defaultErrorHandler","_cliParser","_handleErrors","_commandHelper","_pager","_exceptions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_outputFormatter","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import { CLIAspect, MainRuntime } from './cli.aspect';\nimport globalFlags from './global-flags';\nimport defaultErrorHandler from './default-error-handler';\nexport { CLIParser } from './cli-parser';\nexport type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';\nexport { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';\nexport { globalFlags };\nexport { defaultErrorHandler };\nexport type { Command, CLIArgs, Flags, GenericObject, CommandOptions, Report } from './command';\nexport { getArgsData, getCommandName, getFlagsData } from './command-helper';\nexport { canPromptUser } from './pager';\nexport * from './exceptions';\n\nexport {\n successSymbol,\n warnSymbol,\n errorSymbol,\n bulletSymbol,\n formatItem,\n formatSection,\n formatTitle,\n formatHint,\n formatDetailsHint,\n formatSuccessSummary,\n formatWarningSummary,\n joinSections,\n renderSections,\n} from './output-formatter';\nexport type { OutputSection } from './output-formatter';\n\nexport { CLIAspect as default, MainRuntime, CLIAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,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;AAAA;AAEA,SAAAS,iBAAA;EAAA,MAAAtB,IAAA,GAAAC,OAAA;EAAAqB,gBAAA,YAAAA,CAAA;IAAA,OAAAtB,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAc4B,SAAAG,uBAAAoB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_globalFlags","_interopRequireDefault","_defaultErrorHandler","_cliParser","_handleErrors","_commandHelper","_pager","_exceptions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_outputFormatter","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import { CLIAspect, MainRuntime } from './cli.aspect';\nimport globalFlags from './global-flags';\nimport defaultErrorHandler from './default-error-handler';\nexport { CLIParser } from './cli-parser';\nexport type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';\nexport { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';\nexport { globalFlags };\nexport { defaultErrorHandler };\nexport type { Command, CLIArgs, Flags, GenericObject, CommandOptions, Report } from './command';\nexport { getArgsData, getCommandName, getFlagsData } from './command-helper';\nexport { canPromptUser } from './pager';\nexport * from './exceptions';\n\nexport {\n successSymbol,\n warnSymbol,\n errorSymbol,\n bulletSymbol,\n arrowSymbol,\n formatBytes,\n formatItem,\n formatSection,\n formatTitle,\n formatHint,\n formatDetailsHint,\n formatSuccessSummary,\n formatWarningSummary,\n joinSections,\n renderSections,\n} from './output-formatter';\nexport type { OutputSection } from './output-formatter';\n\nexport { CLIAspect as default, MainRuntime, CLIAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,SAAAS,iBAAA;EAAA,MAAAtB,IAAA,GAAAC,OAAA;EAAAqB,gBAAA,YAAAA,CAAA;IAAA,OAAAtB,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAgB4B,SAAAG,uBAAAoB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -5,6 +5,10 @@ export declare const warnSymbol: string;
5
5
  export declare const errorSymbol: string;
6
6
  /** Neutral bullet for informational items (no success/failure connotation) */
7
7
  export declare const bulletSymbol: string;
8
+ /** Transition between a before and an after value, e.g. a size before and after a cleanup */
9
+ export declare const arrowSymbol: string;
10
+ /** Human-readable byte size, in 1024 steps, e.g. `1.5 MB` */
11
+ export declare function formatBytes(bytes: number): string;
8
12
  /** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */
9
13
  export declare function formatItem(text: string, symbol?: string): string;
10
14
  /**
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.errorSymbol = exports.bulletSymbol = void 0;
6
+ exports.errorSymbol = exports.bulletSymbol = exports.arrowSymbol = void 0;
7
+ exports.formatBytes = formatBytes;
7
8
  exports.formatDetailsHint = formatDetailsHint;
8
9
  exports.formatHint = formatHint;
9
10
  exports.formatItem = formatItem;
@@ -45,6 +46,17 @@ const errorSymbol = exports.errorSymbol = _chalk().default.red('\u2716');
45
46
  /** Neutral bullet for informational items (no success/failure connotation) */
46
47
  const bulletSymbol = exports.bulletSymbol = _chalk().default.dim('\u203A');
47
48
 
49
+ /** Transition between a before and an after value, e.g. a size before and after a cleanup */
50
+ const arrowSymbol = exports.arrowSymbol = _chalk().default.dim('\u2192');
51
+
52
+ /** Human-readable byte size, in 1024 steps, e.g. `1.5 MB` */
53
+ function formatBytes(bytes) {
54
+ if (!bytes) return '0 B';
55
+ const units = ['B', 'KB', 'MB', 'GB', 'TB'];
56
+ const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
57
+ return `${(bytes / 1024 ** i).toFixed(i === 0 ? 0 : 1)} ${units[i]}`;
58
+ }
59
+
48
60
  /** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */
49
61
  function formatItem(text, symbol) {
50
62
  const s = symbol ?? bulletSymbol;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_os","e","__esModule","default","_successSymbol","platform","chalk","green","successSymbol","warnSymbol","exports","yellow","errorSymbol","red","bulletSymbol","dim","formatItem","text","symbol","s","formatSection","title","description","items","length","lines","formatTitle","indented","split","map","l","join","push","bold","white","formatHint","formatDetailsHint","subject","what","formatSuccessSummary","msg","formatWarningSummary","joinSections","sections","filter","Boolean","renderSections","expand","parts","section","collapsible","summary","content"],"sources":["output-formatter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { platform } from 'os';\n\n/** Cross-platform green checkmark (mirrors Logger.successSymbol without importing Logger to avoid coupling) */\nconst _successSymbol = platform() === 'win32' ? chalk.green('\\u2713') : chalk.green('\\u2714');\nexport function successSymbol(): string {\n return _successSymbol;\n}\n\n/** Yellow warning symbol */\nexport const warnSymbol = chalk.yellow('\\u26A0');\n\n/** Red error symbol */\nexport const errorSymbol = chalk.red('\\u2716');\n\n/** Neutral bullet for informational items (no success/failure connotation) */\nexport const bulletSymbol = chalk.dim('\\u203A');\n\n/** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */\nexport function formatItem(text: string, symbol?: string): string {\n const s = symbol ?? bulletSymbol;\n return ` ${s} ${text}`;\n}\n\n/**\n * Format a section with bold white title (including item count), dim description, and items.\n * Returns empty string if items array is empty.\n */\nexport function formatSection(title: string, description: string, items: string[]): string {\n if (!items.length) return '';\n const lines: string[] = [formatTitle(`${title} (${items.length})`)];\n if (description) {\n const indented = description\n .split('\\n')\n .map((l) => ` ${l}`)\n .join('\\n');\n lines.push(chalk.dim(indented));\n }\n lines.push(...items);\n return lines.join('\\n');\n}\n\n/** Format a bold white section title */\nexport function formatTitle(text: string): string {\n return chalk.bold.white(text);\n}\n\n/** Format hint text in dim color */\nexport function formatHint(text: string): string {\n return chalk.dim(text);\n}\n\n/** Format a hint pointing the user to `bit details` for expanded output */\nexport function formatDetailsHint(subject?: string): string {\n const what = subject ? ` ${subject}` : '';\n return formatHint(`(run \"bit details\" to see${what})`);\n}\n\n/** Format a success summary: green checkmark + green message */\nexport function formatSuccessSummary(msg: string): string {\n return `${successSymbol()} ${chalk.green(msg)}`;\n}\n\n/** Format a warning summary: warning symbol + yellow message */\nexport function formatWarningSummary(msg: string): string {\n return `${warnSymbol} ${chalk.yellow(msg)}`;\n}\n\n/** Filter out empty strings and join remaining sections with double newlines */\nexport function joinSections(sections: string[]): string {\n return sections.filter(Boolean).join('\\n\\n');\n}\n\nexport interface OutputSection {\n /** The fully rendered section text */\n content: string;\n /** If set, this section starts collapsed. Use --expand to show full content. */\n collapsible?: {\n /** Summary line shown when collapsed */\n summary: string;\n };\n}\n\n/**\n * Render sections to a string, collapsing sections that are marked collapsible.\n * When expand is true, all sections are shown expanded.\n */\nexport function renderSections(sections: OutputSection[], expand = false): string {\n const parts: string[] = [];\n for (const section of sections) {\n if (section.collapsible && !expand) {\n parts.push(section.collapsible.summary);\n } else if (section.content) {\n parts.push(section.content);\n }\n }\n return parts.filter(Boolean).join('\\n\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IA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E;EAC1B,KAAK,MAAMC,OAAO,IAAIN,QAAQ,EAAE;IAC9B,IAAIM,OAAO,CAACC,WAAW,IAAI,CAACH,MAAM,EAAE;MAClCC,KAAK,CAAChB,IAAI,CAACiB,OAAO,CAACC,WAAW,CAACC,OAAO,CAAC;IACzC,CAAC,MAAM,IAAIF,OAAO,CAACG,OAAO,EAAE;MAC1BJ,KAAK,CAAChB,IAAI,CAACiB,OAAO,CAACG,OAAO,CAAC;IAC7B;EACF;EACA,OAAOJ,KAAK,CAACJ,MAAM,CAACC,OAAO,CAAC,CAACd,IAAI,CAAC,MAAM,CAAC;AAC3C","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_os","e","__esModule","default","_successSymbol","platform","chalk","green","successSymbol","warnSymbol","exports","yellow","errorSymbol","red","bulletSymbol","dim","arrowSymbol","formatBytes","bytes","units","i","Math","min","floor","log","length","toFixed","formatItem","text","symbol","s","formatSection","title","description","items","lines","formatTitle","indented","split","map","l","join","push","bold","white","formatHint","formatDetailsHint","subject","what","formatSuccessSummary","msg","formatWarningSummary","joinSections","sections","filter","Boolean","renderSections","expand","parts","section","collapsible","summary","content"],"sources":["output-formatter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { platform } from 'os';\n\n/** Cross-platform green checkmark (mirrors Logger.successSymbol without importing Logger to avoid coupling) */\nconst _successSymbol = platform() === 'win32' ? chalk.green('\\u2713') : chalk.green('\\u2714');\nexport function successSymbol(): string {\n return _successSymbol;\n}\n\n/** Yellow warning symbol */\nexport const warnSymbol = chalk.yellow('\\u26A0');\n\n/** Red error symbol */\nexport const errorSymbol = chalk.red('\\u2716');\n\n/** Neutral bullet for informational items (no success/failure connotation) */\nexport const bulletSymbol = chalk.dim('\\u203A');\n\n/** Transition between a before and an after value, e.g. a size before and after a cleanup */\nexport const arrowSymbol = chalk.dim('\\u2192');\n\n/** Human-readable byte size, in 1024 steps, e.g. `1.5 MB` */\nexport function formatBytes(bytes: number): string {\n if (!bytes) return '0 B';\n const units = ['B', 'KB', 'MB', 'GB', 'TB'];\n const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);\n return `${(bytes / 1024 ** i).toFixed(i === 0 ? 0 : 1)} ${units[i]}`;\n}\n\n/** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */\nexport function formatItem(text: string, symbol?: string): string {\n const s = symbol ?? bulletSymbol;\n return ` ${s} ${text}`;\n}\n\n/**\n * Format a section with bold white title (including item count), dim description, and items.\n * Returns empty string if items array is empty.\n */\nexport function formatSection(title: string, description: string, items: string[]): string {\n if (!items.length) return '';\n const lines: string[] = [formatTitle(`${title} (${items.length})`)];\n if (description) {\n const indented = description\n .split('\\n')\n .map((l) => ` ${l}`)\n .join('\\n');\n lines.push(chalk.dim(indented));\n }\n lines.push(...items);\n return lines.join('\\n');\n}\n\n/** Format a bold white section title */\nexport function formatTitle(text: string): string {\n return chalk.bold.white(text);\n}\n\n/** Format hint text in dim color */\nexport function formatHint(text: string): string {\n return chalk.dim(text);\n}\n\n/** Format a hint pointing the user to `bit details` for expanded output */\nexport function formatDetailsHint(subject?: string): string {\n const what = subject ? ` ${subject}` : '';\n return formatHint(`(run \"bit details\" to see${what})`);\n}\n\n/** Format a success summary: green checkmark + green message */\nexport function formatSuccessSummary(msg: string): string {\n return `${successSymbol()} ${chalk.green(msg)}`;\n}\n\n/** Format a warning summary: warning symbol + yellow message */\nexport function formatWarningSummary(msg: string): string {\n return `${warnSymbol} ${chalk.yellow(msg)}`;\n}\n\n/** Filter out empty strings and join remaining sections with double newlines */\nexport function joinSections(sections: string[]): string {\n return sections.filter(Boolean).join('\\n\\n');\n}\n\nexport interface OutputSection {\n /** The fully rendered section text */\n content: string;\n /** If set, this section starts collapsed. Use --expand to show full content. */\n collapsible?: {\n /** Summary line shown when collapsed */\n summary: string;\n };\n}\n\n/**\n * Render sections to a string, collapsing sections that are marked collapsible.\n * When expand is true, all sections are shown expanded.\n */\nexport function renderSections(sections: OutputSection[], expand = false): string {\n const parts: string[] = [];\n for (const section of sections) {\n if (section.collapsible && !expand) {\n parts.push(section.collapsible.summary);\n } else if (section.content) {\n parts.push(section.content);\n }\n }\n return parts.filter(Boolean).join('\\n\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8B,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B;AACA,MAAMG,cAAc,GAAG,IAAAC,cAAQ,EAAC,CAAC,KAAK,OAAO,GAAGC,gBAAK,CAACC,KAAK,CAAC,QAAQ,CAAC,GAAGD,gBAAK,CAACC,KAAK,CAAC,QAAQ,CAAC;AACtF,SAASC,aAAaA,CAAA,EAAW;EACtC,OAAOJ,cAAc;AACvB;;AAEA;AACO,MAAMK,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAGH,gBAAK,CAACK,MAAM,CAAC,QAAQ,CAAC;;AAEhD;AACO,MAAMC,WAAW,GAAAF,OAAA,CAAAE,WAAA,GAAGN,gBAAK,CAACO,GAAG,CAAC,QAAQ,CAAC;;AAE9C;AACO,MAAMC,YAAY,GAAAJ,OAAA,CAAAI,YAAA,GAAGR,gBAAK,CAACS,GAAG,CAAC,QAAQ,CAAC;;AAE/C;AACO,MAAMC,WAAW,GAAAN,OAAA,CAAAM,WAAA,GAAGV,gBAAK,CAACS,GAAG,CAAC,QAAQ,CAAC;;AAE9C;AACO,SAASE,WAAWA,CAACC,KAAa,EAAU;EACjD,IAAI,CAACA,K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ACA,OAAOJ,KAAK,CAACJ,MAAM,CAACC,OAAO,CAAC,CAACd,IAAI,CAAC,MAAM,CAAC;AAC3C","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1395/dist/cli.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1395/dist/cli.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1396/dist/cli.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1396/dist/cli.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/cli",
3
- "version": "0.0.1395",
3
+ "version": "0.0.1396",
4
4
  "homepage": "https://bit.cloud/teambit/harmony/cli",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "cli",
9
- "version": "0.0.1395"
9
+ "version": "0.0.1396"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -24,9 +24,9 @@
24
24
  "@teambit/legacy.constants": "0.0.45",
25
25
  "@teambit/bit-error": "0.0.404",
26
26
  "@teambit/legacy.cli.error": "0.0.62",
27
- "@teambit/legacy.consumer": "0.0.166",
28
- "@teambit/logger": "0.0.1488",
29
- "@teambit/legacy.utils": "0.0.52"
27
+ "@teambit/legacy.utils": "0.0.52",
28
+ "@teambit/legacy.consumer": "0.0.167",
29
+ "@teambit/logger": "0.0.1489"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/didyoumean": "1.2.0",