@teambit/merging 0.0.177 → 0.0.179

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.
@@ -24,4 +24,4 @@ export declare class MergeCmd implements Command {
24
24
  skipDependencyInstallation?: boolean;
25
25
  }): Promise<string>;
26
26
  }
27
- export declare function mergeReport({ components, failedComponents, version, mergeSnapResults, leftUnresolvedConflicts, verbose, }: ApplyVersionResults): string;
27
+ export declare function mergeReport({ components, failedComponents, version, mergeSnapResults, mergeSnapError, leftUnresolvedConflicts, verbose, }: ApplyVersionResults): string;
package/dist/merge-cmd.js CHANGED
@@ -119,7 +119,8 @@ class MergeCmd {
119
119
  version,
120
120
  resolvedComponents,
121
121
  abortedComponents,
122
- mergeSnapResults
122
+ mergeSnapResults,
123
+ mergeSnapError
123
124
  } = await this.merging.merge(values, mergeStrategy, abort, resolve, noSnap, message, build, skipDependencyInstallation);
124
125
 
125
126
  if (resolvedComponents) {
@@ -139,6 +140,7 @@ class MergeCmd {
139
140
  failedComponents,
140
141
  version,
141
142
  mergeSnapResults,
143
+ mergeSnapError,
142
144
  verbose
143
145
  });
144
146
  }
@@ -152,6 +154,7 @@ function mergeReport({
152
154
  failedComponents,
153
155
  version,
154
156
  mergeSnapResults,
157
+ mergeSnapError,
155
158
  leftUnresolvedConflicts,
156
159
  verbose
157
160
  }) {
@@ -172,6 +175,13 @@ once ready, snap/tag the components to complete the merge.`;
172
175
  };
173
176
 
174
177
  const getSnapsOutput = () => {
178
+ if (mergeSnapError) {
179
+ return `
180
+ ${_chalk().default.bold('snapping the merged components had failed with the following error, please fix the issues and snap manually')}
181
+ ${mergeSnapError.message}
182
+ `;
183
+ }
184
+
175
185
  if (!mergeSnapResults || !mergeSnapResults.snappedComponents) return '';
176
186
  const {
177
187
  snappedComponents,
@@ -1 +1 @@
1
- {"version":3,"names":["MergeCmd","constructor","merging","WILDCARD_HELP","report","values","ours","theirs","manual","abort","resolve","build","noSnap","verbose","message","skipDependencyInstallation","isFeatureEnabled","BUILD_ON_CI","Boolean","mergeStrategy","getMergeStrategy","BitError","components","failedComponents","version","resolvedComponents","abortedComponents","mergeSnapResults","merge","title","componentsStr","map","c","id","toStringWithoutVersion","join","chalk","underline","green","mergeReport","leftUnresolvedConflicts","getSuccessOutput","length","bold","applyVersionReport","getConflictSummary","suggestion","conflictSummaryReport","yellow","getSnapsOutput","snappedComponents","autoSnappedResults","outputComponents","comps","component","componentOutput","toString","autoTag","filter","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_SNAPPED_MSG","getFailureOutput","body","compact","failedComponent","unchangedLegitimately","color","failureMessage"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport { WILDCARD_HELP, AUTO_SNAPPED_MSG } from '@teambit/legacy/dist/constants';\nimport {\n ApplyVersionResults,\n conflictSummaryReport,\n getMergeStrategy,\n applyVersionReport,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { BitError } from '@teambit/bit-error';\nimport { MergingMain } from './merging.main.runtime';\n\nexport class MergeCmd implements Command {\n name = 'merge [values...]';\n description = 'merge changes of different component versions';\n group = 'development';\n extendedDescription = `merge changes of different component versions\n \\`bit merge <version> [ids...]\\` => merge changes of the given version into the checked out version\n \\`bit merge [ids...]\\` => EXPERIMENTAL. merge changes of the remote head into local, optionally use '--abort' or '--resolve'\n ${WILDCARD_HELP('merge 0.0.1')}`;\n alias = '';\n options = [\n ['', 'ours', 'in case of a conflict, override the used version with the current modification'],\n ['', 'theirs', 'in case of a conflict, override the current modification with the specified version'],\n ['', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'],\n ['', 'abort', 'EXPERIMENTAL. in case of an unresolved merge, revert to the state before the merge began'],\n ['', 'resolve', 'EXPERIMENTAL. mark an unresolved merge as resolved and create a new snap with the changes'],\n ['', 'no-snap', 'EXPERIMENTAL. do not auto snap in case the merge completed without conflicts'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['', 'verbose', 'show details of components that were not merged legitimately'],\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ['m', 'message <message>', 'EXPERIMENTAL. override the default message for the auto snap'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private merging: MergingMain) {}\n\n async report(\n [values = []]: [string[]],\n {\n ours = false,\n theirs = false,\n manual = false,\n abort = false,\n resolve = false,\n build = false,\n noSnap = false,\n verbose = false,\n message,\n skipDependencyInstallation = false,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n verbose?: boolean;\n message: string;\n skipDependencyInstallation?: boolean;\n }\n ) {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const mergeStrategy = getMergeStrategy(ours, theirs, manual);\n if (abort && resolve) throw new BitError('unable to use \"abort\" and \"resolve\" flags together');\n if (noSnap && message) throw new BitError('unable to use \"noSnap\" and \"message\" flags together');\n const {\n components,\n failedComponents,\n version,\n resolvedComponents,\n abortedComponents,\n mergeSnapResults,\n }: ApplyVersionResults = await this.merging.merge(\n values,\n mergeStrategy as any,\n abort,\n resolve,\n noSnap,\n message,\n build,\n skipDependencyInstallation\n );\n if (resolvedComponents) {\n const title = 'successfully resolved component(s)\\n';\n const componentsStr = resolvedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n if (abortedComponents) {\n const title = 'successfully aborted the merge of the following component(s)\\n';\n const componentsStr = abortedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n\n return mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n verbose,\n });\n }\n}\n\nexport function mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n leftUnresolvedConflicts,\n verbose,\n}: ApplyVersionResults): string {\n const getSuccessOutput = () => {\n if (!components || !components.length) return '';\n // @ts-ignore version is set in case of merge command\n const title = `successfully merged components${version ? `from version ${chalk.bold(version)}` : ''}\\n`;\n // @ts-ignore components is set in case of merge command\n return chalk.underline(title) + chalk.green(applyVersionReport(components));\n };\n\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `\\nfiles with conflicts summary\\n`;\n const suggestion = `\\n\\nthe merge process wasn't completed due to the conflicts above. fix them manually and then run \"bit install\".\nonce ready, snap/tag the components to complete the merge.`;\n return chalk.underline(title) + conflictSummaryReport(components) + chalk.yellow(suggestion);\n };\n\n const getSnapsOutput = () => {\n if (!mergeSnapResults || !mergeSnapResults.snappedComponents) return '';\n const { snappedComponents, autoSnappedResults } = mergeSnapResults;\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoSnappedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_SNAPPED_MSG}: ${autoTagComp.join(', ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n return `\\n${chalk.underline(\n 'merge-snapped components'\n )}\\n(${'components that snapped as a result of the merge'})\\n${outputComponents(snappedComponents)}\\n`;\n };\n\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = '\\nthe merge has been canceled on the following component(s)';\n const body = compact(\n failedComponents.map((failedComponent) => {\n if (!verbose && failedComponent.unchangedLegitimately) return null;\n const color = failedComponent.unchangedLegitimately ? 'white' : 'red';\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk[color](failedComponent.failureMessage)}`;\n })\n ).join('\\n');\n if (!body) {\n return `${chalk.bold(`\\nthe merge has been canceled on ${failedComponents.length} component(s) legitimately`)}\n(use --verbose to list them next time)`;\n }\n return `\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n };\n\n return getSuccessOutput() + getFailureOutput() + getSnapsOutput() + getConflictSummary();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,QAAN,CAAkC;EAuBvCC,WAAW,CAASC,OAAT,EAA+B;IAAA,KAAtBA,OAAsB,GAAtBA,OAAsB;IAAA,8CAtBnC,mBAsBmC;IAAA,qDArB5B,+CAqB4B;IAAA,+CApBlC,aAoBkC;IAAA,6DAnBnB;AACzB;AACA;AACA,IAAI,IAAAC,0BAAA,EAAc,aAAd,CAA6B,EAgBW;IAAA,+CAflC,EAekC;IAAA,iDAdhC,CACR,CAAC,EAAD,EAAK,MAAL,EAAa,gFAAb,CADQ,EAER,CAAC,EAAD,EAAK,QAAL,EAAe,qFAAf,CAFQ,EAGR,CAAC,EAAD,EAAK,QAAL,EAAe,6FAAf,CAHQ,EAIR,CAAC,EAAD,EAAK,OAAL,EAAc,0FAAd,CAJQ,EAKR,CAAC,EAAD,EAAK,SAAL,EAAgB,2FAAhB,CALQ,EAMR,CAAC,EAAD,EAAK,SAAL,EAAgB,8EAAhB,CANQ,EAOR,CAAC,EAAD,EAAK,OAAL,EAAc,wFAAd,CAPQ,EAQR,CAAC,EAAD,EAAK,SAAL,EAAgB,8DAAhB,CARQ,EASR,CAAC,EAAD,EAAK,8BAAL,EAAqC,oDAArC,CATQ,EAUR,CAAC,GAAD,EAAM,mBAAN,EAA2B,8DAA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BAAgB,CAACmB,MAA3C,EAAmD,OAAO,EAAP;IACnD,MAAMb,KAAK,GAAG,6DAAd;IACA,MAAMqC,IAAI,GAAG,IAAAC,iBAAA,EACX5C,gBAAgB,CAACQ,GAAjB,CAAsBqC,eAAD,IAAqB;MACxC,IAAI,CAACvD,OAAD,IAAYuD,eAAe,CAACC,qBAAhC,EAAuD,OAAO,IAAP;MACvD,MAAMC,KAAK,GAAGF,eAAe,CAACC,qBAAhB,GAAwC,OAAxC,GAAkD,KAAhE;MACA,OAAQ,GAAEjC,gBAAA,CAAMO,IAAN,CAAWyB,eAAe,CAACnC,EAAhB,CAAmBuB,QAAnB,EAAX,CAA0C,MAAKpB,gBAAA,CAAMkC,KAAN,EAAaF,eAAe,CAACG,cAA7B,CAA6C,EAAtG;IACD,CAJD,CADW,EAMXpC,IANW,CAMN,IANM,CAAb;;IAOA,IAAI,CAAC+B,IAAL,EAAW;MACT,OAAQ,GAAE9B,gBAAA,CAAMO,IAAN,CAAY,oCAAmCpB,gBAAgB,CAACmB,MAAO,4BAAvE,CAAoG;AACpH,uCADM;IAED;;IACD,OAAQ,KAAIN,gBAAA,CAAMC,SAAN,CAAgBR,KAAhB,CAAuB,KAAIqC,IAAK,MAA5C;EACD,CAfD;;EAiBA,OAAOzB,gBAAgB,KAAKwB,gBAAgB,EAArC,GAA0ChB,cAAc,EAAxD,GAA6DJ,kBAAkB,EAAtF;AACD"}
1
+ {"version":3,"names":["MergeCmd","constructor","merging","WILDCARD_HELP","report","values","ours","theirs","manual","abort","resolve","build","noSnap","verbose","message","skipDependencyInstallation","isFeatureEnabled","BUILD_ON_CI","Boolean","mergeStrategy","getMergeStrategy","BitError","components","failedComponents","version","resolvedComponents","abortedComponents","mergeSnapResults","mergeSnapError","merge","title","componentsStr","map","c","id","toStringWithoutVersion","join","chalk","underline","green","mergeReport","leftUnresolvedConflicts","getSuccessOutput","length","bold","applyVersionReport","getConflictSummary","suggestion","conflictSummaryReport","yellow","getSnapsOutput","snappedComponents","autoSnappedResults","outputComponents","comps","component","componentOutput","toString","autoTag","filter","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_SNAPPED_MSG","getFailureOutput","body","compact","failedComponent","unchangedLegitimately","color","failureMessage"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport { WILDCARD_HELP, AUTO_SNAPPED_MSG } from '@teambit/legacy/dist/constants';\nimport {\n ApplyVersionResults,\n conflictSummaryReport,\n getMergeStrategy,\n applyVersionReport,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { BitError } from '@teambit/bit-error';\nimport { MergingMain } from './merging.main.runtime';\n\nexport class MergeCmd implements Command {\n name = 'merge [values...]';\n description = 'merge changes of different component versions';\n group = 'development';\n extendedDescription = `merge changes of different component versions\n \\`bit merge <version> [ids...]\\` => merge changes of the given version into the checked out version\n \\`bit merge [ids...]\\` => EXPERIMENTAL. merge changes of the remote head into local, optionally use '--abort' or '--resolve'\n ${WILDCARD_HELP('merge 0.0.1')}`;\n alias = '';\n options = [\n ['', 'ours', 'in case of a conflict, override the used version with the current modification'],\n ['', 'theirs', 'in case of a conflict, override the current modification with the specified version'],\n ['', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'],\n ['', 'abort', 'EXPERIMENTAL. in case of an unresolved merge, revert to the state before the merge began'],\n ['', 'resolve', 'EXPERIMENTAL. mark an unresolved merge as resolved and create a new snap with the changes'],\n ['', 'no-snap', 'EXPERIMENTAL. do not auto snap in case the merge completed without conflicts'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['', 'verbose', 'show details of components that were not merged legitimately'],\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ['m', 'message <message>', 'EXPERIMENTAL. override the default message for the auto snap'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private merging: MergingMain) {}\n\n async report(\n [values = []]: [string[]],\n {\n ours = false,\n theirs = false,\n manual = false,\n abort = false,\n resolve = false,\n build = false,\n noSnap = false,\n verbose = false,\n message,\n skipDependencyInstallation = false,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n verbose?: boolean;\n message: string;\n skipDependencyInstallation?: boolean;\n }\n ) {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const mergeStrategy = getMergeStrategy(ours, theirs, manual);\n if (abort && resolve) throw new BitError('unable to use \"abort\" and \"resolve\" flags together');\n if (noSnap && message) throw new BitError('unable to use \"noSnap\" and \"message\" flags together');\n const {\n components,\n failedComponents,\n version,\n resolvedComponents,\n abortedComponents,\n mergeSnapResults,\n mergeSnapError,\n }: ApplyVersionResults = await this.merging.merge(\n values,\n mergeStrategy as any,\n abort,\n resolve,\n noSnap,\n message,\n build,\n skipDependencyInstallation\n );\n if (resolvedComponents) {\n const title = 'successfully resolved component(s)\\n';\n const componentsStr = resolvedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n if (abortedComponents) {\n const title = 'successfully aborted the merge of the following component(s)\\n';\n const componentsStr = abortedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n\n return mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n verbose,\n });\n }\n}\n\nexport function mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n leftUnresolvedConflicts,\n verbose,\n}: ApplyVersionResults): string {\n const getSuccessOutput = () => {\n if (!components || !components.length) return '';\n // @ts-ignore version is set in case of merge command\n const title = `successfully merged components${version ? `from version ${chalk.bold(version)}` : ''}\\n`;\n // @ts-ignore components is set in case of merge command\n return chalk.underline(title) + chalk.green(applyVersionReport(components));\n };\n\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `\\nfiles with conflicts summary\\n`;\n const suggestion = `\\n\\nthe merge process wasn't completed due to the conflicts above. fix them manually and then run \"bit install\".\nonce ready, snap/tag the components to complete the merge.`;\n return chalk.underline(title) + conflictSummaryReport(components) + chalk.yellow(suggestion);\n };\n\n const getSnapsOutput = () => {\n if (mergeSnapError) {\n return `\n${chalk.bold(\n 'snapping the merged components had failed with the following error, please fix the issues and snap manually'\n)}\n${mergeSnapError.message}\n`;\n }\n if (!mergeSnapResults || !mergeSnapResults.snappedComponents) return '';\n const { snappedComponents, autoSnappedResults } = mergeSnapResults;\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoSnappedResults.filter((result) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_SNAPPED_MSG}: ${autoTagComp.join(', ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n return `\\n${chalk.underline(\n 'merge-snapped components'\n )}\\n(${'components that snapped as a result of the merge'})\\n${outputComponents(snappedComponents)}\\n`;\n };\n\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = '\\nthe merge has been canceled on the following component(s)';\n const body = compact(\n failedComponents.map((failedComponent) => {\n if (!verbose && failedComponent.unchangedLegitimately) return null;\n const color = failedComponent.unchangedLegitimately ? 'white' : 'red';\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk[color](failedComponent.failureMessage)}`;\n })\n ).join('\\n');\n if (!body) {\n return `${chalk.bold(`\\nthe merge has been canceled on ${failedComponents.length} component(s) legitimately`)}\n(use --verbose to list them next time)`;\n }\n return `\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n };\n\n return getSuccessOutput() + getFailureOutput() + get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gB,GAAG,MAAM;IAC7B,IAAI,CAAC3C,gBAAD,IAAqB,CAACA,gBAAgB,CAACoB,MAA3C,EAAmD,OAAO,EAAP;IACnD,MAAMb,KAAK,GAAG,6DAAd;IACA,MAAMqC,IAAI,GAAG,IAAAC,iBAAA,EACX7C,gBAAgB,CAACS,GAAjB,CAAsBqC,eAAD,IAAqB;MACxC,IAAI,CAACxD,OAAD,IAAYwD,eAAe,CAACC,qBAAhC,EAAuD,OAAO,IAAP;MACvD,MAAMC,KAAK,GAAGF,eAAe,CAACC,qBAAhB,GAAwC,OAAxC,GAAkD,KAAhE;MACA,OAAQ,GAAEjC,gBAAA,CAAMO,IAAN,CAAWyB,eAAe,CAACnC,EAAhB,CAAmBuB,QAAnB,EAAX,CAA0C,MAAKpB,gBAAA,CAAMkC,KAAN,EAAaF,eAAe,CAACG,cAA7B,CAA6C,EAAtG;IACD,CAJD,CADW,EAMXpC,IANW,CAMN,IANM,CAAb;;IAOA,IAAI,CAAC+B,IAAL,EAAW;MACT,OAAQ,GAAE9B,gBAAA,CAAMO,IAAN,CAAY,oCAAmCrB,gBAAgB,CAACoB,MAAO,4BAAvE,CAAoG;AACpH,uCADM;IAED;;IACD,OAAQ,KAAIN,gBAAA,CAAMC,SAAN,CAAgBR,KAAhB,CAAuB,KAAIqC,IAAK,MAA5C;EACD,CAfD;;EAiBA,OAAOzB,gBAAgB,KAAKwB,gBAAgB,EAArC,GAA0ChB,cAAc,EAAxD,GAA6DJ,kBAAkB,EAAtF;AACD"}
@@ -8,6 +8,7 @@ import { LaneId } from '@teambit/lane-id';
8
8
  import { Lane, Version } from '@teambit/legacy/dist/scope/models';
9
9
  import { Ref } from '@teambit/legacy/dist/scope/objects';
10
10
  import ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';
11
+ import { Logger, LoggerMain } from '@teambit/logger';
11
12
  import { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';
12
13
  import { CheckoutMain } from '@teambit/checkout';
13
14
  import { DivergeData } from '@teambit/legacy/dist/scope/component-ops/diverge-data';
@@ -31,8 +32,9 @@ export declare class MergingMain {
31
32
  private install;
32
33
  private snapping;
33
34
  private checkout;
35
+ private logger;
34
36
  private consumer;
35
- constructor(workspace: Workspace, install: InstallMain, snapping: SnappingMain, checkout: CheckoutMain);
37
+ constructor(workspace: Workspace, install: InstallMain, snapping: SnappingMain, checkout: CheckoutMain, logger: Logger);
36
38
  /**
37
39
  * merge components according to the "values" param.
38
40
  * if the first param is a version, then merge the component ids to that version.
@@ -87,12 +89,13 @@ export declare class MergingMain {
87
89
  static slots: never[];
88
90
  static dependencies: import("@teambit/harmony").Aspect[];
89
91
  static runtime: import("@teambit/harmony").RuntimeDefinition;
90
- static provider([cli, workspace, snapping, checkout, install]: [
92
+ static provider([cli, workspace, snapping, checkout, install, loggerMain]: [
91
93
  CLIMain,
92
94
  Workspace,
93
95
  SnappingMain,
94
96
  CheckoutMain,
95
- InstallMain
97
+ InstallMain,
98
+ LoggerMain
96
99
  ]): Promise<MergingMain>;
97
100
  }
98
101
  export {};
@@ -151,16 +151,6 @@ function _laneId() {
151
151
  return data;
152
152
  }
153
153
 
154
- function _logger() {
155
- const data = _interopRequireDefault(require("@teambit/legacy/dist/logger/logger"));
156
-
157
- _logger = function () {
158
- return data;
159
- };
160
-
161
- return data;
162
- }
163
-
164
154
  function _getDivergeData() {
165
155
  const data = require("@teambit/legacy/dist/scope/component-ops/get-diverge-data");
166
156
 
@@ -221,6 +211,16 @@ function _manyComponentsWriter() {
221
211
  return data;
222
212
  }
223
213
 
214
+ function _logger() {
215
+ const data = require("@teambit/logger");
216
+
217
+ _logger = function () {
218
+ return data;
219
+ };
220
+
221
+ return data;
222
+ }
223
+
224
224
  function _checkoutVersion() {
225
225
  const data = require("@teambit/legacy/dist/consumer/versions-ops/checkout-version");
226
226
 
@@ -306,13 +306,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
306
306
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
307
307
 
308
308
  class MergingMain {
309
- constructor(workspace, install, snapping, checkout) {
309
+ constructor(workspace, install, snapping, checkout, logger) {
310
310
  var _this$workspace;
311
311
 
312
312
  this.workspace = workspace;
313
313
  this.install = install;
314
314
  this.snapping = snapping;
315
315
  this.checkout = checkout;
316
+ this.logger = logger;
316
317
  (0, _defineProperty2().default)(this, "consumer", void 0);
317
318
  this.consumer = (_this$workspace = this.workspace) === null || _this$workspace === void 0 ? void 0 : _this$workspace.consumer;
318
319
  }
@@ -428,20 +429,25 @@ class MergingMain {
428
429
  resolvedUnrelated
429
430
  });
430
431
  });
431
- const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';
432
-
433
- if (!skipDependencyInstallation && !leftUnresolvedConflicts) {
434
- await this.install.install(undefined, {
435
- dedupe: true,
436
- updateExisting: false,
437
- import: false
438
- });
439
- }
440
-
441
432
  if (localLane) consumer.scope.objects.add(localLane);
442
433
  await consumer.scope.objects.persist(); // persist anyway, if localLane is null it should save all main heads
443
434
 
444
435
  await consumer.scope.objects.unmergedComponents.write();
436
+ await consumer.writeBitMap();
437
+ const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';
438
+
439
+ if (!skipDependencyInstallation && !leftUnresolvedConflicts) {
440
+ try {
441
+ await this.install.install(undefined, {
442
+ dedupe: true,
443
+ updateExisting: false,
444
+ import: false
445
+ });
446
+ } catch (err) {
447
+ this.logger.error(`failed installing packages`, err);
448
+ this.logger.consoleError(`failed installing packages, see the log for full stacktrace. error: ${err.message}`);
449
+ }
450
+ }
445
451
 
446
452
  const getSnapOrTagResults = async () => {
447
453
  // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged
@@ -467,11 +473,20 @@ class MergingMain {
467
473
  return this.snapResolvedComponents(consumer, snapMessage, build);
468
474
  };
469
475
 
470
- const mergeSnapResults = await getSnapOrTagResults();
476
+ let mergeSnapResults = null;
477
+ let mergeSnapError;
478
+
479
+ try {
480
+ mergeSnapResults = await getSnapOrTagResults();
481
+ } catch (err) {
482
+ mergeSnapError = err;
483
+ }
484
+
471
485
  return {
472
486
  components: componentsResults,
473
487
  failedComponents,
474
488
  mergeSnapResults,
489
+ mergeSnapError,
475
490
  leftUnresolvedConflicts
476
491
  };
477
492
  }
@@ -872,9 +887,7 @@ class MergingMain {
872
887
 
873
888
  async snapResolvedComponents(consumer, snapMessage, build) {
874
889
  const unmergedComponents = consumer.scope.objects.unmergedComponents.getComponents();
875
-
876
- _logger().default.debug(`merge-snaps, snapResolvedComponents, total ${unmergedComponents.length.toString()} components`);
877
-
890
+ this.logger.debug(`merge-snaps, snapResolvedComponents, total ${unmergedComponents.length.toString()} components`);
878
891
  if (!unmergedComponents.length) return null;
879
892
 
880
893
  const ids = _bitId().BitIds.fromArray(unmergedComponents.map(r => new (_bitId().BitId)(r.id)));
@@ -890,9 +903,7 @@ class MergingMain {
890
903
  const ids = idsToTag.map(id => {
891
904
  return id.toStringWithoutVersion();
892
905
  });
893
-
894
- _logger().default.debug(`merge-snaps, tagResolvedComponents, total ${idsToTag.length.toString()} components`);
895
-
906
+ this.logger.debug(`merge-snaps, tagResolvedComponents, total ${idsToTag.length.toString()} components`);
896
907
  return this.snapping.tag({
897
908
  ids,
898
909
  build,
@@ -928,8 +939,9 @@ class MergingMain {
928
939
  return ids.map(id => consumer.getParsedId(id));
929
940
  }
930
941
 
931
- static async provider([cli, workspace, snapping, checkout, install]) {
932
- const merging = new MergingMain(workspace, install, snapping, checkout);
942
+ static async provider([cli, workspace, snapping, checkout, install, loggerMain]) {
943
+ const logger = loggerMain.createLogger(_merging().MergingAspect.id);
944
+ const merging = new MergingMain(workspace, install, snapping, checkout, logger);
933
945
  cli.register(new (_mergeCmd().MergeCmd)(merging));
934
946
  return merging;
935
947
  }
@@ -938,7 +950,7 @@ class MergingMain {
938
950
 
939
951
  exports.MergingMain = MergingMain;
940
952
  (0, _defineProperty2().default)(MergingMain, "slots", []);
941
- (0, _defineProperty2().default)(MergingMain, "dependencies", [_cli().CLIAspect, _workspace().default, _snapping().default, _checkout().CheckoutAspect, _install().InstallAspect]);
953
+ (0, _defineProperty2().default)(MergingMain, "dependencies", [_cli().CLIAspect, _workspace().default, _snapping().default, _checkout().CheckoutAspect, _install().InstallAspect, _logger().LoggerAspect]);
942
954
  (0, _defineProperty2().default)(MergingMain, "runtime", _cli().MainRuntime);
943
955
 
944
956
  _merging().MergingAspect.addRuntime(MergingMain);
@@ -1 +1 @@
1
- {"version":3,"names":["MergingMain","constructor","workspace","install","snapping","checkout","consumer","merge","values","mergeStrategy","abort","resolve","noSnap","message","build","skipDependencyInstallation","ConsumerNotFound","mergeResults","firstValue","R","head","resolveMerge","abortMerge","BitId","isValidVersion","bitIds","getComponentsToMerge","mergeComponentsFromRemote","version","ids","tail","mergeVersion","onDestroy","snapMessage","currentLaneId","getCurrentLaneId","currentLaneObject","getCurrentLaneObject","allComponentsStatus","getAllComponentsStatus","failedComponents","filter","c","unmergedMessage","unmergedLegitimately","length","failureMsgs","map","failedComponent","chalk","bold","id","toString","red","join","BitError","mergeSnaps","laneId","localLane","tag","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","componentsResults","mapSeries","currentComponent","resolvedUnrelated","modelComponent","scope","getModelComponent","updatedLaneId","isDefault","LaneId","from","name","applyVersion","remoteHead","getRef","leftUnresolvedConflicts","undefined","dedupe","updateExisting","import","objects","add","persist","unmergedComponents","write","getSnapOrTagResults","idsToTag","results","tagAllLaneComponent","taggedComponents","autoTaggedResults","snappedComponents","autoSnappedResults","snapResolvedComponents","mergeSnapResults","components","getComponentMergeStatus","otherLaneName","options","returnUnmerged","msg","getModelComponentIfExist","unmerged","getEntry","toStringWithoutVersion","repo","otherLaneHead","existingBitMapId","bitMap","getBitIdIfExist","ignoreVersion","componentOnLane","loadVersion","isRemoved","getCurrentId","idOnLane","getComponent","changeVersion","getHeadAsTagIfExist","currentId","divergeData","getDivergeData","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isModified","componentModificationStatus","getComponentStatusById","modified","baseComponent","ignoreConfigChanges","isComponentSourceCodeModified","isComponentModified","laneHeadIsDifferentThanCheckedOut","laneHeadLocal","localHead","Ref","Error","err","mainHead","NoCommonSnap","resolveUnrelated","hasResolvedFromMain","hashToCompare","divergeDataFromMain","hasResolvedLocally","hasResolvedRemotely","versionToSaveInLane","resolvedRef","strategy","isDiverged","isLocalAhead","isRemoteAhead","baseSnap","commonSnapBeforeDiverge","otherComponent","currentLaneName","toLaneId","threeWayMerge","otherLabel","currentLabel","filesStatus","unmergedComponent","remote","lane","handleResolveUnrelated","addComponent","unrelated","addEntry","markAllFilesAsUnchanged","files","forEach","file","pathNormalizeToLinux","relative","FileStatus","unchanged","MergeOptions","ours","remoteId","idToLoad","theirs","componentWithDependencies","loadComponentWithDependenciesFromModel","updated","modifiedStatus","modifiedFiles","applyModifiedVersion","manyComponentsWriter","ManyComponentsWriter","componentsWithDependencies","installNpmPackages","override","writeConfig","verbose","writeAll","manual","unmergedPaths","f","conflict","filePath","setHead","markVersionAsLocal","getIdsForUnmerged","reset","removeComponent","fullName","abortedComponents","snap","legacyBitIds","BitIds","fromArray","_legacy","resolvedComponents","localLaneObject","tmp","Tmp","componentsStatus","Promise","all","bitId","remoteScopeName","remoteLaneId","remoteLanes","laneIdStr","clear","getComponents","logger","debug","r","tagMessage","unmodified","idsStr","componentIds","resolveMultipleComponentIds","entry","GeneralError","unresolvedComponents","u","ComponentID","fromLegacy","hasWildcard","componentsList","ComponentsList","listComponentsByIdsWithWildcard","getParsedId","provider","cli","merging","register","MergeCmd","CLIAspect","WorkspaceAspect","SnappingAspect","CheckoutAspect","InstallAspect","MainRuntime","MergingAspect","addRuntime"],"sources":["merging.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport R from 'ramda';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport {\n ApplyVersionResults,\n MergeStrategy,\n mergeVersion,\n ApplyVersionResult,\n FailedComponents,\n FileStatus,\n getMergeStrategyInteractive,\n MergeOptions,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport SnappingAspect, { SnappingMain } from '@teambit/snapping';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport mapSeries from 'p-map-series';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { LaneId } from '@teambit/lane-id';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { UnmergedComponent } from '@teambit/legacy/dist/scope/lanes/unmerged-components';\nimport { Lane, Version } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport chalk from 'chalk';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { applyModifiedVersion } from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport threeWayMerge, {\n MergeResultsThreeWay,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { CheckoutAspect, CheckoutMain } from '@teambit/checkout';\nimport { ComponentID } from '@teambit/component-id';\nimport { DivergeData } from '@teambit/legacy/dist/scope/component-ops/diverge-data';\nimport { TagResults } from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\n\ntype ResolveUnrelatedData = { strategy: MergeStrategy; head: Ref };\n\nexport type ComponentMergeStatus = {\n currentComponent?: ConsumerComponent | null;\n componentFromModel?: Version;\n id: BitId;\n unmergedMessage?: string;\n unmergedLegitimately?: boolean; // failed to merge but for a legitimate reason, such as, up-to-date\n mergeResults?: MergeResultsThreeWay | null;\n divergeData?: DivergeData;\n resolvedUnrelated?: ResolveUnrelatedData;\n};\n\nexport class MergingMain {\n private consumer: Consumer;\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private snapping: SnappingMain,\n private checkout: CheckoutMain\n ) {\n this.consumer = this.workspace?.consumer;\n }\n\n /**\n * merge components according to the \"values\" param.\n * if the first param is a version, then merge the component ids to that version.\n * otherwise, merge from the remote head to the local.\n */\n async merge(\n values: string[],\n mergeStrategy: MergeStrategy,\n abort: boolean,\n resolve: boolean,\n noSnap: boolean,\n message: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n if (!this.workspace) throw new ConsumerNotFound();\n const consumer: Consumer = this.workspace.consumer;\n let mergeResults;\n const firstValue = R.head(values);\n if (resolve) {\n mergeResults = await this.resolveMerge(values, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(values);\n } else if (!BitId.isValidVersion(firstValue)) {\n const bitIds = this.getComponentsToMerge(consumer, values);\n // @todo: version could be the lane only or remote/lane\n mergeResults = await this.mergeComponentsFromRemote(\n consumer,\n bitIds,\n mergeStrategy,\n noSnap,\n message,\n build,\n skipDependencyInstallation\n );\n } else {\n const version = firstValue;\n const ids = R.tail(values);\n const bitIds = this.getComponentsToMerge(consumer, ids);\n mergeResults = await mergeVersion(consumer, version, bitIds, mergeStrategy);\n }\n await consumer.onDestroy();\n return mergeResults;\n }\n\n /**\n * when user is on main, it merges the remote main components into local.\n * when user is on a lane, it merges the remote lane components into the local lane.\n */\n async mergeComponentsFromRemote(\n consumer: Consumer,\n bitIds: BitId[],\n mergeStrategy: MergeStrategy,\n noSnap: boolean,\n snapMessage: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n const currentLaneId = consumer.getCurrentLaneId();\n const currentLaneObject = await consumer.getCurrentLaneObject();\n const allComponentsStatus = await this.getAllComponentsStatus(bitIds, currentLaneId, currentLaneObject);\n const failedComponents = allComponentsStatus.filter((c) => c.unmergedMessage && !c.unmergedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unmergedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to merge due to the following failures:\\n${failureMsgs}`);\n }\n\n return this.mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n laneId: currentLaneId,\n localLane: currentLaneObject,\n noSnap,\n snapMessage,\n build,\n skipDependencyInstallation,\n });\n }\n\n /**\n * merge multiple components according to the \"allComponentsStatus\".\n */\n async mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n laneId,\n localLane,\n noSnap,\n tag,\n snapMessage,\n build,\n skipDependencyInstallation,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n laneId: LaneId;\n localLane: Lane | null;\n noSnap: boolean;\n tag?: boolean;\n snapMessage: string;\n build: boolean;\n skipDependencyInstallation?: boolean;\n }): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict && !mergeStrategy) {\n mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unmergedMessage)\n .map((componentStatus) => ({\n id: componentStatus.id,\n failureMessage: componentStatus.unmergedMessage as string,\n unchangedLegitimately: componentStatus.unmergedLegitimately,\n }));\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unmergedMessage);\n // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,\n // which can be an issue when some components are also dependencies of others\n const componentsResults = await mapSeries(\n succeededComponents,\n async ({ currentComponent, id, mergeResults, resolvedUnrelated }) => {\n const modelComponent = await consumer.scope.getModelComponent(id);\n const updatedLaneId = laneId.isDefault() ? LaneId.from(laneId.name, id.scope as string) : laneId;\n return this.applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead: modelComponent.getRef(id.version as string) as Ref,\n laneId: updatedLaneId,\n localLane,\n resolvedUnrelated,\n });\n }\n );\n\n const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';\n\n if (!skipDependencyInstallation && !leftUnresolvedConflicts) {\n await this.install.install(undefined, {\n dedupe: true,\n updateExisting: false,\n import: false,\n });\n }\n\n if (localLane) consumer.scope.objects.add(localLane);\n\n await consumer.scope.objects.persist(); // persist anyway, if localLane is null it should save all main heads\n\n await consumer.scope.objects.unmergedComponents.write();\n\n const getSnapOrTagResults = async () => {\n // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged\n // and some not. besides the fact that it could by mistake tag dependent, it's a confusing state. better not snap.\n if (noSnap || leftUnresolvedConflicts) {\n return null;\n }\n if (tag) {\n const idsToTag = allComponentsStatus.map((c) => c.id);\n const results = await this.tagAllLaneComponent(idsToTag, snapMessage, build);\n if (!results) return null;\n const { taggedComponents, autoTaggedResults } = results;\n return { snappedComponents: taggedComponents, autoSnappedResults: autoTaggedResults };\n }\n return this.snapResolvedComponents(consumer, snapMessage, build);\n };\n const mergeSnapResults = await getSnapOrTagResults();\n\n return {\n components: componentsResults,\n failedComponents,\n mergeSnapResults,\n leftUnresolvedConflicts,\n };\n }\n\n /**\n * this function gets called from two different commands:\n * 1. \"bit merge <ids...>\", when merging a component from a remote to the local.\n * in this case, the remote and local are on the same lane or both on main.\n * 2. \"bit lane merge\", when merging from one lane to another.\n * @param id\n * @param localLane\n * @param otherLaneName\n * @param existingOnWorkspaceOnly\n * @returns\n */\n async getComponentMergeStatus(\n id: BitId, // the id.version is the version we want to merge to the current component\n localLane: Lane | null, // currently checked out lane. if on main, then it's null.\n otherLaneName: string, // the lane name we want to merged to our lane. (can be also \"main\").\n options?: { resolveUnrelated?: MergeStrategy; ignoreConfigChanges?: boolean }\n ): Promise<ComponentMergeStatus> {\n const consumer = this.workspace.consumer;\n const componentStatus: ComponentMergeStatus = { id };\n const returnUnmerged = (msg: string, unmergedLegitimately = false) => {\n componentStatus.unmergedMessage = msg;\n componentStatus.unmergedLegitimately = unmergedLegitimately;\n return componentStatus;\n };\n const modelComponent = await consumer.scope.getModelComponentIfExist(id);\n if (!modelComponent) {\n return returnUnmerged(\n `component ${id.toString()} is on the lane/main but its objects were not found, please re-import the lane`\n );\n }\n const unmerged = consumer.scope.objects.unmergedComponents.getEntry(id.name);\n if (unmerged) {\n return returnUnmerged(\n `component ${id.toStringWithoutVersion()} is in during-merge state a previous merge, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n const repo = consumer.scope.objects;\n const version = id.version as string;\n const otherLaneHead = modelComponent.getRef(version);\n const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, { ignoreVersion: true });\n const componentOnLane: Version = await modelComponent.loadVersion(version, consumer.scope.objects);\n if (componentOnLane.isRemoved()) {\n return returnUnmerged(`component has been removed`, true);\n }\n const getCurrentId = () => {\n if (existingBitMapId) return existingBitMapId;\n if (localLane) {\n const idOnLane = localLane.getComponent(id);\n if (!idOnLane) return null;\n return idOnLane.id.changeVersion(idOnLane.head.toString());\n }\n // it's on main\n const head = modelComponent.getHeadAsTagIfExist();\n if (head) {\n return id.changeVersion(head);\n }\n return null;\n };\n const currentId = getCurrentId();\n if (!currentId) {\n const divergeData = await getDivergeData(repo, modelComponent, otherLaneHead, null, false);\n return { currentComponent: null, componentFromModel: componentOnLane, id, mergeResults: null, divergeData };\n }\n const getCurrentComponent = () => {\n if (existingBitMapId) return consumer.loadComponent(existingBitMapId);\n return consumer.scope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n const isModified = async () => {\n const componentModificationStatus = await consumer.getComponentStatusById(currentComponent.id);\n if (!componentModificationStatus.modified) return false;\n if (!existingBitMapId) return false;\n const baseComponent = await modelComponent.loadVersion(\n existingBitMapId.version as string,\n consumer.scope.objects\n );\n return options?.ignoreConfigChanges\n ? consumer.isComponentSourceCodeModified(baseComponent, currentComponent)\n : true;\n };\n\n const isComponentModified = await isModified();\n\n if (isComponentModified) {\n return returnUnmerged(`component is modified, please snap/tag it first`);\n }\n const laneHeadIsDifferentThanCheckedOut =\n localLane && existingBitMapId?.version && modelComponent.laneHeadLocal?.toString() !== existingBitMapId?.version;\n const localHead = laneHeadIsDifferentThanCheckedOut ? Ref.from(existingBitMapId.version) : null;\n\n if (!otherLaneHead) {\n throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);\n }\n const divergeData = await getDivergeData(repo, modelComponent, otherLaneHead, localHead, false);\n if (divergeData.err) {\n const mainHead = modelComponent.head;\n if (divergeData.err instanceof NoCommonSnap && options?.resolveUnrelated && mainHead) {\n const hasResolvedFromMain = async (hashToCompare: Ref | null) => {\n const divergeDataFromMain = await getDivergeData(repo, modelComponent, mainHead, hashToCompare, false);\n if (!divergeDataFromMain.err) return true;\n return !(divergeDataFromMain.err instanceof NoCommonSnap);\n };\n const hasResolvedLocally = await hasResolvedFromMain(localHead);\n const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);\n if (!hasResolvedLocally && !hasResolvedRemotely) {\n return returnUnmerged(\n `unable to traverse ${currentComponent.id.toString()} history. the main-head ${mainHead.toString()} doesn't appear in both lanes, it was probably created in each lane separately`\n );\n }\n const versionToSaveInLane = hasResolvedLocally ? currentComponent.id.version : id.version;\n const resolvedRef = modelComponent.getRef(versionToSaveInLane as string);\n if (!resolvedRef) throw new Error(`unable to get ref of \"${versionToSaveInLane}\" for \"${id.toString()}\"`);\n if (options?.resolveUnrelated === 'theirs') {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnLane,\n id,\n mergeResults: null,\n divergeData,\n resolvedUnrelated: { strategy: 'theirs', head: resolvedRef },\n };\n }\n if (options?.resolveUnrelated === 'ours') {\n return {\n currentComponent,\n id,\n mergeResults: null,\n divergeData,\n resolvedUnrelated: { strategy: 'ours', head: resolvedRef },\n };\n }\n throw new Error(\n `unsupported strategy \"${options?.resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n return returnUnmerged(\n `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`\n );\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isLocalAhead()) {\n // do nothing!\n return returnUnmerged(`component ${currentComponent.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isRemoteAhead()) {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnLane,\n id,\n mergeResults: null,\n divergeData,\n };\n }\n // we know that localHead and remoteHead are set, so if none of them is ahead they must be equal\n return returnUnmerged(`component ${currentComponent.id.toString()} is already merged`, true);\n }\n const baseSnap = divergeData.commonSnapBeforeDiverge as Ref; // must be set when isTrueMerge\n const baseComponent: Version = await modelComponent.loadVersion(baseSnap.toString(), repo);\n const otherComponent: Version = await modelComponent.loadVersion(otherLaneHead.toString(), repo);\n const currentLaneName = localLane?.toLaneId().toString() || 'main';\n const mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: `${otherLaneHead.toString()} (${otherLaneName})`,\n currentComponent,\n currentLabel: `${currentId.version} (${currentLaneName})`,\n baseComponent,\n });\n return { currentComponent, id, mergeResults, divergeData };\n }\n\n private async applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead,\n laneId,\n localLane,\n resolvedUnrelated,\n }: {\n currentComponent: ConsumerComponent | null | undefined;\n id: BitId;\n mergeResults: MergeResultsThreeWay | null | undefined;\n mergeStrategy: MergeStrategy;\n remoteHead: Ref;\n laneId: LaneId;\n localLane: Lane | null;\n resolvedUnrelated?: ResolveUnrelatedData;\n }): Promise<ApplyVersionResult> {\n const consumer = this.workspace.consumer;\n let filesStatus = {};\n const unmergedComponent: UnmergedComponent = {\n // @ts-ignore\n id: { name: id.name, scope: id.scope },\n head: remoteHead,\n remote: laneId.scope, // @todo: remove. it has been deprecated around 0.0.832\n lane: laneId.name, // @todo: remove. it has been deprecated around 0.0.832\n laneId,\n };\n id = currentComponent ? currentComponent.id : id;\n\n const modelComponent = await consumer.scope.getModelComponent(id);\n const handleResolveUnrelated = () => {\n if (!currentComponent) throw new Error('currentComponent must be defined when resolvedUnrelated');\n if (!localLane) throw new Error('localLane must be defined when resolvedUnrelated');\n if (!resolvedUnrelated?.head) throw new Error('resolvedUnrelated must have head prop');\n localLane.addComponent({ id, head: resolvedUnrelated.head });\n const head = modelComponent.getRef(currentComponent.id.version as string);\n if (!head) throw new Error(`unable to get the head for resolved-unrelated ${id.toString()}`);\n unmergedComponent.laneId = localLane.toLaneId();\n unmergedComponent.head = head;\n unmergedComponent.unrelated = true;\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { id, filesStatus };\n };\n\n const markAllFilesAsUnchanged = () => {\n if (!currentComponent) throw new Error(`applyVersion expect to get currentComponent for ${id.toString()}`);\n currentComponent.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n };\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n markAllFilesAsUnchanged();\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { id, filesStatus };\n }\n if (resolvedUnrelated?.strategy === 'ours') {\n markAllFilesAsUnchanged();\n return handleResolveUnrelated();\n }\n const remoteId = id.changeVersion(remoteHead.toString());\n const idToLoad = !mergeResults || mergeStrategy === MergeOptions.theirs ? remoteId : id;\n const componentWithDependencies = await consumer.loadComponentWithDependenciesFromModel(idToLoad);\n const files = componentWithDependencies.component.files;\n files.forEach((file) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.updated;\n });\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n componentWithDependencies.component.files = modifiedFiles;\n filesStatus = { ...filesStatus, ...modifiedStatus };\n }\n\n const manyComponentsWriter = new ManyComponentsWriter({\n consumer,\n componentsWithDependencies: [componentWithDependencies],\n installNpmPackages: false,\n override: true,\n writeConfig: false, // @todo: should write if config exists before, needs to figure out how to do it.\n verbose: false, // @todo: do we need a flag here?\n });\n await manyComponentsWriter.writeAll();\n\n // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents\n // otherwise, update the head of the current lane or main\n if (mergeResults) {\n if (mergeResults.hasConflicts && mergeStrategy === MergeOptions.manual) {\n unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter((f) => f.conflict).map((f) => f.filePath);\n }\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n } else if (localLane) {\n if (resolvedUnrelated) {\n // must be \"theirs\"\n return handleResolveUnrelated();\n }\n localLane.addComponent({ id, head: remoteHead });\n } else {\n // this is main\n modelComponent.setHead(remoteHead);\n // mark it as local, otherwise, when importing this component from a remote, it'll override it.\n modelComponent.markVersionAsLocal(remoteHead.toString());\n consumer.scope.objects.add(modelComponent);\n }\n\n return { id, filesStatus };\n }\n\n private async abortMerge(values: string[]): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const ids = await this.getIdsForUnmerged(values);\n const results = await this.checkout.checkout({ ids, reset: true });\n ids.forEach((id) => consumer.scope.objects.unmergedComponents.removeComponent(id.fullName));\n await consumer.scope.objects.unmergedComponents.write();\n return { abortedComponents: results.components };\n }\n\n private async resolveMerge(values: string[], snapMessage: string, build: boolean): Promise<ApplyVersionResults> {\n const ids = await this.getIdsForUnmerged(values);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const { snappedComponents } = await this.snapping.snap({\n legacyBitIds: BitIds.fromArray(ids.map((id) => id._legacy)),\n build,\n message: snapMessage,\n });\n return { resolvedComponents: snappedComponents };\n }\n\n private async getAllComponentsStatus(\n bitIds: BitId[],\n laneId: LaneId,\n localLaneObject: Lane | null\n ): Promise<ComponentMergeStatus[]> {\n const tmp = new Tmp(this.consumer.scope);\n try {\n const componentsStatus = await Promise.all(\n bitIds.map(async (bitId) => {\n const remoteScopeName = laneId.isDefault() ? bitId.scope : laneId.scope;\n const remoteLaneId = LaneId.from(laneId.name, remoteScopeName as string);\n const remoteHead = await this.consumer.scope.objects.remoteLanes.getRef(remoteLaneId, bitId);\n const laneIdStr = remoteLaneId.toString();\n if (!remoteHead)\n throw new BitError(`unable to find a remote head of \"${bitId.toStringWithoutVersion()}\" in \"${laneIdStr}\"`);\n return this.getComponentMergeStatus(bitId.changeVersion(remoteHead.toString()), localLaneObject, laneIdStr);\n })\n );\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n }\n\n private async snapResolvedComponents(\n consumer: Consumer,\n snapMessage: string,\n build: boolean\n ): Promise<null | { snappedComponents: ConsumerComponent[]; autoSnappedResults: AutoTagResult[] }> {\n const unmergedComponents = consumer.scope.objects.unmergedComponents.getComponents();\n logger.debug(`merge-snaps, snapResolvedComponents, total ${unmergedComponents.length.toString()} components`);\n if (!unmergedComponents.length) return null;\n const ids = BitIds.fromArray(unmergedComponents.map((r) => new BitId(r.id)));\n return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\n });\n }\n\n private async tagAllLaneComponent(idsToTag: BitId[], tagMessage: string, build: boolean): Promise<TagResults | null> {\n const ids = idsToTag.map((id) => {\n return id.toStringWithoutVersion();\n });\n logger.debug(`merge-snaps, tagResolvedComponents, total ${idsToTag.length.toString()} components`);\n return this.snapping.tag({\n ids,\n build,\n message: tagMessage,\n unmodified: true,\n });\n }\n\n private async getIdsForUnmerged(idsStr?: string[]): Promise<ComponentID[]> {\n if (idsStr && idsStr.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(idsStr);\n componentIds.forEach((id) => {\n const entry = this.workspace.consumer.scope.objects.unmergedComponents.getEntry(id.fullName);\n if (!entry) {\n throw new GeneralError(`unable to merge-resolve ${id.toString()}, it is not marked as unresolved`);\n }\n });\n return componentIds;\n }\n const unresolvedComponents = this.workspace.consumer.scope.objects.unmergedComponents.getComponents();\n if (!unresolvedComponents.length) throw new GeneralError(`all components are resolved already, nothing to do`);\n return unresolvedComponents.map((u) => ComponentID.fromLegacy(new BitId(u.id)));\n }\n\n private getComponentsToMerge(consumer: Consumer, ids: string[]): BitId[] {\n if (hasWildcard(ids)) {\n const componentsList = new ComponentsList(consumer);\n return componentsList.listComponentsByIdsWithWildcard(ids);\n }\n return ids.map((id) => consumer.getParsedId(id));\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, SnappingAspect, CheckoutAspect, InstallAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace, snapping, checkout, install]: [\n CLIMain,\n Workspace,\n SnappingMain,\n CheckoutMain,\n InstallMain\n ]) {\n const merging = new MergingMain(workspace, install, snapping, checkout);\n cli.register(new MergeCmd(merging));\n return merging;\n }\n}\n\nMergingAspect.addRuntime(MergingMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;I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AnkBXzQ,W,aAokBM0Q,kB;;AAcnBC,wBAAA,CAAcC,UAAd,CAAyB5Q,WAAzB"}
1
+ {"version":3,"names":["MergingMain","constructor","workspace","install","snapping","checkout","logger","consumer","merge","values","mergeStrategy","abort","resolve","noSnap","message","build","skipDependencyInstallation","ConsumerNotFound","mergeResults","firstValue","R","head","resolveMerge","abortMerge","BitId","isValidVersion","bitIds","getComponentsToMerge","mergeComponentsFromRemote","version","ids","tail","mergeVersion","onDestroy","snapMessage","currentLaneId","getCurrentLaneId","currentLaneObject","getCurrentLaneObject","allComponentsStatus","getAllComponentsStatus","failedComponents","filter","c","unmergedMessage","unmergedLegitimately","length","failureMsgs","map","failedComponent","chalk","bold","id","toString","red","join","BitError","mergeSnaps","laneId","localLane","tag","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","componentsResults","mapSeries","currentComponent","resolvedUnrelated","modelComponent","scope","getModelComponent","updatedLaneId","isDefault","LaneId","from","name","applyVersion","remoteHead","getRef","objects","add","persist","unmergedComponents","write","writeBitMap","leftUnresolvedConflicts","undefined","dedupe","updateExisting","import","err","error","consoleError","getSnapOrTagResults","idsToTag","results","tagAllLaneComponent","taggedComponents","autoTaggedResults","snappedComponents","autoSnappedResults","snapResolvedComponents","mergeSnapResults","mergeSnapError","components","getComponentMergeStatus","otherLaneName","options","returnUnmerged","msg","getModelComponentIfExist","unmerged","getEntry","toStringWithoutVersion","repo","otherLaneHead","existingBitMapId","bitMap","getBitIdIfExist","ignoreVersion","componentOnLane","loadVersion","isRemoved","getCurrentId","idOnLane","getComponent","changeVersion","getHeadAsTagIfExist","currentId","divergeData","getDivergeData","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isModified","componentModificationStatus","getComponentStatusById","modified","baseComponent","ignoreConfigChanges","isComponentSourceCodeModified","isComponentModified","laneHeadIsDifferentThanCheckedOut","laneHeadLocal","localHead","Ref","Error","mainHead","NoCommonSnap","resolveUnrelated","hasResolvedFromMain","hashToCompare","divergeDataFromMain","hasResolvedLocally","hasResolvedRemotely","versionToSaveInLane","resolvedRef","strategy","isDiverged","isLocalAhead","isRemoteAhead","baseSnap","commonSnapBeforeDiverge","otherComponent","currentLaneName","toLaneId","threeWayMerge","otherLabel","currentLabel","filesStatus","unmergedComponent","remote","lane","handleResolveUnrelated","addComponent","unrelated","addEntry","markAllFilesAsUnchanged","files","forEach","file","pathNormalizeToLinux","relative","FileStatus","unchanged","MergeOptions","ours","remoteId","idToLoad","theirs","componentWithDependencies","loadComponentWithDependenciesFromModel","updated","modifiedStatus","modifiedFiles","applyModifiedVersion","manyComponentsWriter","ManyComponentsWriter","componentsWithDependencies","installNpmPackages","override","writeConfig","verbose","writeAll","manual","unmergedPaths","f","conflict","filePath","setHead","markVersionAsLocal","getIdsForUnmerged","reset","removeComponent","fullName","abortedComponents","snap","legacyBitIds","BitIds","fromArray","_legacy","resolvedComponents","localLaneObject","tmp","Tmp","componentsStatus","Promise","all","bitId","remoteScopeName","remoteLaneId","remoteLanes","laneIdStr","clear","getComponents","debug","r","tagMessage","unmodified","idsStr","componentIds","resolveMultipleComponentIds","entry","GeneralError","unresolvedComponents","u","ComponentID","fromLegacy","hasWildcard","componentsList","ComponentsList","listComponentsByIdsWithWildcard","getParsedId","provider","cli","loggerMain","createLogger","MergingAspect","merging","register","MergeCmd","CLIAspect","WorkspaceAspect","SnappingAspect","CheckoutAspect","InstallAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["merging.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport R from 'ramda';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport {\n ApplyVersionResults,\n MergeStrategy,\n mergeVersion,\n ApplyVersionResult,\n FailedComponents,\n FileStatus,\n getMergeStrategyInteractive,\n MergeOptions,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport SnappingAspect, { SnappingMain } from '@teambit/snapping';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport mapSeries from 'p-map-series';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { LaneId } from '@teambit/lane-id';\nimport { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag';\nimport { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data';\nimport { UnmergedComponent } from '@teambit/legacy/dist/scope/lanes/unmerged-components';\nimport { Lane, Version } from '@teambit/legacy/dist/scope/models';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport chalk from 'chalk';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { applyModifiedVersion } from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport threeWayMerge, {\n MergeResultsThreeWay,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';\nimport { CheckoutAspect, CheckoutMain } from '@teambit/checkout';\nimport { ComponentID } from '@teambit/component-id';\nimport { DivergeData } from '@teambit/legacy/dist/scope/component-ops/diverge-data';\nimport { TagResults } from '@teambit/legacy/dist/api/consumer/lib/tag';\nimport { InstallMain, InstallAspect } from '@teambit/install';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\n\ntype ResolveUnrelatedData = { strategy: MergeStrategy; head: Ref };\n\nexport type ComponentMergeStatus = {\n currentComponent?: ConsumerComponent | null;\n componentFromModel?: Version;\n id: BitId;\n unmergedMessage?: string;\n unmergedLegitimately?: boolean; // failed to merge but for a legitimate reason, such as, up-to-date\n mergeResults?: MergeResultsThreeWay | null;\n divergeData?: DivergeData;\n resolvedUnrelated?: ResolveUnrelatedData;\n};\n\nexport class MergingMain {\n private consumer: Consumer;\n constructor(\n private workspace: Workspace,\n private install: InstallMain,\n private snapping: SnappingMain,\n private checkout: CheckoutMain,\n private logger: Logger\n ) {\n this.consumer = this.workspace?.consumer;\n }\n\n /**\n * merge components according to the \"values\" param.\n * if the first param is a version, then merge the component ids to that version.\n * otherwise, merge from the remote head to the local.\n */\n async merge(\n values: string[],\n mergeStrategy: MergeStrategy,\n abort: boolean,\n resolve: boolean,\n noSnap: boolean,\n message: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n if (!this.workspace) throw new ConsumerNotFound();\n const consumer: Consumer = this.workspace.consumer;\n let mergeResults;\n const firstValue = R.head(values);\n if (resolve) {\n mergeResults = await this.resolveMerge(values, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(values);\n } else if (!BitId.isValidVersion(firstValue)) {\n const bitIds = this.getComponentsToMerge(consumer, values);\n // @todo: version could be the lane only or remote/lane\n mergeResults = await this.mergeComponentsFromRemote(\n consumer,\n bitIds,\n mergeStrategy,\n noSnap,\n message,\n build,\n skipDependencyInstallation\n );\n } else {\n const version = firstValue;\n const ids = R.tail(values);\n const bitIds = this.getComponentsToMerge(consumer, ids);\n mergeResults = await mergeVersion(consumer, version, bitIds, mergeStrategy);\n }\n await consumer.onDestroy();\n return mergeResults;\n }\n\n /**\n * when user is on main, it merges the remote main components into local.\n * when user is on a lane, it merges the remote lane components into the local lane.\n */\n async mergeComponentsFromRemote(\n consumer: Consumer,\n bitIds: BitId[],\n mergeStrategy: MergeStrategy,\n noSnap: boolean,\n snapMessage: string,\n build: boolean,\n skipDependencyInstallation: boolean\n ): Promise<ApplyVersionResults> {\n const currentLaneId = consumer.getCurrentLaneId();\n const currentLaneObject = await consumer.getCurrentLaneObject();\n const allComponentsStatus = await this.getAllComponentsStatus(bitIds, currentLaneId, currentLaneObject);\n const failedComponents = allComponentsStatus.filter((c) => c.unmergedMessage && !c.unmergedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unmergedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to merge due to the following failures:\\n${failureMsgs}`);\n }\n\n return this.mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n laneId: currentLaneId,\n localLane: currentLaneObject,\n noSnap,\n snapMessage,\n build,\n skipDependencyInstallation,\n });\n }\n\n /**\n * merge multiple components according to the \"allComponentsStatus\".\n */\n async mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n laneId,\n localLane,\n noSnap,\n tag,\n snapMessage,\n build,\n skipDependencyInstallation,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n laneId: LaneId;\n localLane: Lane | null;\n noSnap: boolean;\n tag?: boolean;\n snapMessage: string;\n build: boolean;\n skipDependencyInstallation?: boolean;\n }): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict && !mergeStrategy) {\n mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unmergedMessage)\n .map((componentStatus) => ({\n id: componentStatus.id,\n failureMessage: componentStatus.unmergedMessage as string,\n unchangedLegitimately: componentStatus.unmergedLegitimately,\n }));\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unmergedMessage);\n // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,\n // which can be an issue when some components are also dependencies of others\n const componentsResults = await mapSeries(\n succeededComponents,\n async ({ currentComponent, id, mergeResults, resolvedUnrelated }) => {\n const modelComponent = await consumer.scope.getModelComponent(id);\n const updatedLaneId = laneId.isDefault() ? LaneId.from(laneId.name, id.scope as string) : laneId;\n return this.applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead: modelComponent.getRef(id.version as string) as Ref,\n laneId: updatedLaneId,\n localLane,\n resolvedUnrelated,\n });\n }\n );\n\n if (localLane) consumer.scope.objects.add(localLane);\n\n await consumer.scope.objects.persist(); // persist anyway, if localLane is null it should save all main heads\n\n await consumer.scope.objects.unmergedComponents.write();\n\n await consumer.writeBitMap();\n\n const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';\n if (!skipDependencyInstallation && !leftUnresolvedConflicts) {\n try {\n await this.install.install(undefined, {\n dedupe: true,\n updateExisting: false,\n import: false,\n });\n } catch (err: any) {\n this.logger.error(`failed installing packages`, err);\n this.logger.consoleError(`failed installing packages, see the log for full stacktrace. error: ${err.message}`);\n }\n }\n\n const getSnapOrTagResults = async () => {\n // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged\n // and some not. besides the fact that it could by mistake tag dependent, it's a confusing state. better not snap.\n if (noSnap || leftUnresolvedConflicts) {\n return null;\n }\n if (tag) {\n const idsToTag = allComponentsStatus.map((c) => c.id);\n const results = await this.tagAllLaneComponent(idsToTag, snapMessage, build);\n if (!results) return null;\n const { taggedComponents, autoTaggedResults } = results;\n return { snappedComponents: taggedComponents, autoSnappedResults: autoTaggedResults };\n }\n return this.snapResolvedComponents(consumer, snapMessage, build);\n };\n let mergeSnapResults: ApplyVersionResults['mergeSnapResults'] = null;\n let mergeSnapError: Error | undefined;\n try {\n mergeSnapResults = await getSnapOrTagResults();\n } catch (err: any) {\n mergeSnapError = err;\n }\n\n return {\n components: componentsResults,\n failedComponents,\n mergeSnapResults,\n mergeSnapError,\n leftUnresolvedConflicts,\n };\n }\n\n /**\n * this function gets called from two different commands:\n * 1. \"bit merge <ids...>\", when merging a component from a remote to the local.\n * in this case, the remote and local are on the same lane or both on main.\n * 2. \"bit lane merge\", when merging from one lane to another.\n * @param id\n * @param localLane\n * @param otherLaneName\n * @param existingOnWorkspaceOnly\n * @returns\n */\n async getComponentMergeStatus(\n id: BitId, // the id.version is the version we want to merge to the current component\n localLane: Lane | null, // currently checked out lane. if on main, then it's null.\n otherLaneName: string, // the lane name we want to merged to our lane. (can be also \"main\").\n options?: { resolveUnrelated?: MergeStrategy; ignoreConfigChanges?: boolean }\n ): Promise<ComponentMergeStatus> {\n const consumer = this.workspace.consumer;\n const componentStatus: ComponentMergeStatus = { id };\n const returnUnmerged = (msg: string, unmergedLegitimately = false) => {\n componentStatus.unmergedMessage = msg;\n componentStatus.unmergedLegitimately = unmergedLegitimately;\n return componentStatus;\n };\n const modelComponent = await consumer.scope.getModelComponentIfExist(id);\n if (!modelComponent) {\n return returnUnmerged(\n `component ${id.toString()} is on the lane/main but its objects were not found, please re-import the lane`\n );\n }\n const unmerged = consumer.scope.objects.unmergedComponents.getEntry(id.name);\n if (unmerged) {\n return returnUnmerged(\n `component ${id.toStringWithoutVersion()} is in during-merge state a previous merge, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n const repo = consumer.scope.objects;\n const version = id.version as string;\n const otherLaneHead = modelComponent.getRef(version);\n const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, { ignoreVersion: true });\n const componentOnLane: Version = await modelComponent.loadVersion(version, consumer.scope.objects);\n if (componentOnLane.isRemoved()) {\n return returnUnmerged(`component has been removed`, true);\n }\n const getCurrentId = () => {\n if (existingBitMapId) return existingBitMapId;\n if (localLane) {\n const idOnLane = localLane.getComponent(id);\n if (!idOnLane) return null;\n return idOnLane.id.changeVersion(idOnLane.head.toString());\n }\n // it's on main\n const head = modelComponent.getHeadAsTagIfExist();\n if (head) {\n return id.changeVersion(head);\n }\n return null;\n };\n const currentId = getCurrentId();\n if (!currentId) {\n const divergeData = await getDivergeData(repo, modelComponent, otherLaneHead, null, false);\n return { currentComponent: null, componentFromModel: componentOnLane, id, mergeResults: null, divergeData };\n }\n const getCurrentComponent = () => {\n if (existingBitMapId) return consumer.loadComponent(existingBitMapId);\n return consumer.scope.getConsumerComponent(currentId);\n };\n const currentComponent = await getCurrentComponent();\n const isModified = async () => {\n const componentModificationStatus = await consumer.getComponentStatusById(currentComponent.id);\n if (!componentModificationStatus.modified) return false;\n if (!existingBitMapId) return false;\n const baseComponent = await modelComponent.loadVersion(\n existingBitMapId.version as string,\n consumer.scope.objects\n );\n return options?.ignoreConfigChanges\n ? consumer.isComponentSourceCodeModified(baseComponent, currentComponent)\n : true;\n };\n\n const isComponentModified = await isModified();\n\n if (isComponentModified) {\n return returnUnmerged(`component is modified, please snap/tag it first`);\n }\n const laneHeadIsDifferentThanCheckedOut =\n localLane && existingBitMapId?.version && modelComponent.laneHeadLocal?.toString() !== existingBitMapId?.version;\n const localHead = laneHeadIsDifferentThanCheckedOut ? Ref.from(existingBitMapId.version) : null;\n\n if (!otherLaneHead) {\n throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);\n }\n const divergeData = await getDivergeData(repo, modelComponent, otherLaneHead, localHead, false);\n if (divergeData.err) {\n const mainHead = modelComponent.head;\n if (divergeData.err instanceof NoCommonSnap && options?.resolveUnrelated && mainHead) {\n const hasResolvedFromMain = async (hashToCompare: Ref | null) => {\n const divergeDataFromMain = await getDivergeData(repo, modelComponent, mainHead, hashToCompare, false);\n if (!divergeDataFromMain.err) return true;\n return !(divergeDataFromMain.err instanceof NoCommonSnap);\n };\n const hasResolvedLocally = await hasResolvedFromMain(localHead);\n const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);\n if (!hasResolvedLocally && !hasResolvedRemotely) {\n return returnUnmerged(\n `unable to traverse ${currentComponent.id.toString()} history. the main-head ${mainHead.toString()} doesn't appear in both lanes, it was probably created in each lane separately`\n );\n }\n const versionToSaveInLane = hasResolvedLocally ? currentComponent.id.version : id.version;\n const resolvedRef = modelComponent.getRef(versionToSaveInLane as string);\n if (!resolvedRef) throw new Error(`unable to get ref of \"${versionToSaveInLane}\" for \"${id.toString()}\"`);\n if (options?.resolveUnrelated === 'theirs') {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnLane,\n id,\n mergeResults: null,\n divergeData,\n resolvedUnrelated: { strategy: 'theirs', head: resolvedRef },\n };\n }\n if (options?.resolveUnrelated === 'ours') {\n return {\n currentComponent,\n id,\n mergeResults: null,\n divergeData,\n resolvedUnrelated: { strategy: 'ours', head: resolvedRef },\n };\n }\n throw new Error(\n `unsupported strategy \"${options?.resolveUnrelated}\" of resolve-unrelated. supported strategies are: [ours, theirs]`\n );\n }\n return returnUnmerged(\n `unable to traverse ${currentComponent.id.toString()} history. error: ${divergeData.err.message}`\n );\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isLocalAhead()) {\n // do nothing!\n return returnUnmerged(`component ${currentComponent.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isRemoteAhead()) {\n // just override with the model data\n return {\n currentComponent,\n componentFromModel: componentOnLane,\n id,\n mergeResults: null,\n divergeData,\n };\n }\n // we know that localHead and remoteHead are set, so if none of them is ahead they must be equal\n return returnUnmerged(`component ${currentComponent.id.toString()} is already merged`, true);\n }\n const baseSnap = divergeData.commonSnapBeforeDiverge as Ref; // must be set when isTrueMerge\n const baseComponent: Version = await modelComponent.loadVersion(baseSnap.toString(), repo);\n const otherComponent: Version = await modelComponent.loadVersion(otherLaneHead.toString(), repo);\n const currentLaneName = localLane?.toLaneId().toString() || 'main';\n const mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: `${otherLaneHead.toString()} (${otherLaneName})`,\n currentComponent,\n currentLabel: `${currentId.version} (${currentLaneName})`,\n baseComponent,\n });\n return { currentComponent, id, mergeResults, divergeData };\n }\n\n private async applyVersion({\n currentComponent,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead,\n laneId,\n localLane,\n resolvedUnrelated,\n }: {\n currentComponent: ConsumerComponent | null | undefined;\n id: BitId;\n mergeResults: MergeResultsThreeWay | null | undefined;\n mergeStrategy: MergeStrategy;\n remoteHead: Ref;\n laneId: LaneId;\n localLane: Lane | null;\n resolvedUnrelated?: ResolveUnrelatedData;\n }): Promise<ApplyVersionResult> {\n const consumer = this.workspace.consumer;\n let filesStatus = {};\n const unmergedComponent: UnmergedComponent = {\n // @ts-ignore\n id: { name: id.name, scope: id.scope },\n head: remoteHead,\n remote: laneId.scope, // @todo: remove. it has been deprecated around 0.0.832\n lane: laneId.name, // @todo: remove. it has been deprecated around 0.0.832\n laneId,\n };\n id = currentComponent ? currentComponent.id : id;\n\n const modelComponent = await consumer.scope.getModelComponent(id);\n const handleResolveUnrelated = () => {\n if (!currentComponent) throw new Error('currentComponent must be defined when resolvedUnrelated');\n if (!localLane) throw new Error('localLane must be defined when resolvedUnrelated');\n if (!resolvedUnrelated?.head) throw new Error('resolvedUnrelated must have head prop');\n localLane.addComponent({ id, head: resolvedUnrelated.head });\n const head = modelComponent.getRef(currentComponent.id.version as string);\n if (!head) throw new Error(`unable to get the head for resolved-unrelated ${id.toString()}`);\n unmergedComponent.laneId = localLane.toLaneId();\n unmergedComponent.head = head;\n unmergedComponent.unrelated = true;\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { id, filesStatus };\n };\n\n const markAllFilesAsUnchanged = () => {\n if (!currentComponent) throw new Error(`applyVersion expect to get currentComponent for ${id.toString()}`);\n currentComponent.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n };\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n markAllFilesAsUnchanged();\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n return { id, filesStatus };\n }\n if (resolvedUnrelated?.strategy === 'ours') {\n markAllFilesAsUnchanged();\n return handleResolveUnrelated();\n }\n const remoteId = id.changeVersion(remoteHead.toString());\n const idToLoad = !mergeResults || mergeStrategy === MergeOptions.theirs ? remoteId : id;\n const componentWithDependencies = await consumer.loadComponentWithDependenciesFromModel(idToLoad);\n const files = componentWithDependencies.component.files;\n files.forEach((file) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.updated;\n });\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n componentWithDependencies.component.files = modifiedFiles;\n filesStatus = { ...filesStatus, ...modifiedStatus };\n }\n\n const manyComponentsWriter = new ManyComponentsWriter({\n consumer,\n componentsWithDependencies: [componentWithDependencies],\n installNpmPackages: false,\n override: true,\n writeConfig: false, // @todo: should write if config exists before, needs to figure out how to do it.\n verbose: false, // @todo: do we need a flag here?\n });\n await manyComponentsWriter.writeAll();\n\n // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents\n // otherwise, update the head of the current lane or main\n if (mergeResults) {\n if (mergeResults.hasConflicts && mergeStrategy === MergeOptions.manual) {\n unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter((f) => f.conflict).map((f) => f.filePath);\n }\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n } else if (localLane) {\n if (resolvedUnrelated) {\n // must be \"theirs\"\n return handleResolveUnrelated();\n }\n localLane.addComponent({ id, head: remoteHead });\n } else {\n // this is main\n modelComponent.setHead(remoteHead);\n // mark it as local, otherwise, when importing this component from a remote, it'll override it.\n modelComponent.markVersionAsLocal(remoteHead.toString());\n consumer.scope.objects.add(modelComponent);\n }\n\n return { id, filesStatus };\n }\n\n private async abortMerge(values: string[]): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const ids = await this.getIdsForUnmerged(values);\n const results = await this.checkout.checkout({ ids, reset: true });\n ids.forEach((id) => consumer.scope.objects.unmergedComponents.removeComponent(id.fullName));\n await consumer.scope.objects.unmergedComponents.write();\n return { abortedComponents: results.components };\n }\n\n private async resolveMerge(values: string[], snapMessage: string, build: boolean): Promise<ApplyVersionResults> {\n const ids = await this.getIdsForUnmerged(values);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const { snappedComponents } = await this.snapping.snap({\n legacyBitIds: BitIds.fromArray(ids.map((id) => id._legacy)),\n build,\n message: snapMessage,\n });\n return { resolvedComponents: snappedComponents };\n }\n\n private async getAllComponentsStatus(\n bitIds: BitId[],\n laneId: LaneId,\n localLaneObject: Lane | null\n ): Promise<ComponentMergeStatus[]> {\n const tmp = new Tmp(this.consumer.scope);\n try {\n const componentsStatus = await Promise.all(\n bitIds.map(async (bitId) => {\n const remoteScopeName = laneId.isDefault() ? bitId.scope : laneId.scope;\n const remoteLaneId = LaneId.from(laneId.name, remoteScopeName as string);\n const remoteHead = await this.consumer.scope.objects.remoteLanes.getRef(remoteLaneId, bitId);\n const laneIdStr = remoteLaneId.toString();\n if (!remoteHead)\n throw new BitError(`unable to find a remote head of \"${bitId.toStringWithoutVersion()}\" in \"${laneIdStr}\"`);\n return this.getComponentMergeStatus(bitId.changeVersion(remoteHead.toString()), localLaneObject, laneIdStr);\n })\n );\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n }\n\n private async snapResolvedComponents(\n consumer: Consumer,\n snapMessage: string,\n build: boolean\n ): Promise<null | { snappedComponents: ConsumerComponent[]; autoSnappedResults: AutoTagResult[] }> {\n const unmergedComponents = consumer.scope.objects.unmergedComponents.getComponents();\n this.logger.debug(`merge-snaps, snapResolvedComponents, total ${unmergedComponents.length.toString()} components`);\n if (!unmergedComponents.length) return null;\n const ids = BitIds.fromArray(unmergedComponents.map((r) => new BitId(r.id)));\n return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\n });\n }\n\n private async tagAllLaneComponent(idsToTag: BitId[], tagMessage: string, build: boolean): Promise<TagResults | null> {\n const ids = idsToTag.map((id) => {\n return id.toStringWithoutVersion();\n });\n this.logger.debug(`merge-snaps, tagResolvedComponents, total ${idsToTag.length.toString()} components`);\n return this.snapping.tag({\n ids,\n build,\n message: tagMessage,\n unmodified: true,\n });\n }\n\n private async getIdsForUnmerged(idsStr?: string[]): Promise<ComponentID[]> {\n if (idsStr && idsStr.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(idsStr);\n componentIds.forEach((id) => {\n const entry = this.workspace.consumer.scope.objects.unmergedComponents.getEntry(id.fullName);\n if (!entry) {\n throw new GeneralError(`unable to merge-resolve ${id.toString()}, it is not marked as unresolved`);\n }\n });\n return componentIds;\n }\n const unresolvedComponents = this.workspace.consumer.scope.objects.unmergedComponents.getComponents();\n if (!unresolvedComponents.length) throw new GeneralError(`all components are resolved already, nothing to do`);\n return unresolvedComponents.map((u) => ComponentID.fromLegacy(new BitId(u.id)));\n }\n\n private getComponentsToMerge(consumer: Consumer, ids: string[]): BitId[] {\n if (hasWildcard(ids)) {\n const componentsList = new ComponentsList(consumer);\n return componentsList.listComponentsByIdsWithWildcard(ids);\n }\n return ids.map((id) => consumer.getParsedId(id));\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, SnappingAspect, CheckoutAspect, InstallAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([cli, workspace, snapping, checkout, install, loggerMain]: [\n CLIMain,\n Workspace,\n SnappingMain,\n CheckoutMain,\n InstallMain,\n LoggerMain\n ]) {\n const logger = loggerMain.createLogger(MergingAspect.id);\n const merging = new MergingMain(workspace, install, snapping, checkout, logger);\n cli.register(new MergeCmd(merging));\n return merging;\n }\n}\n\nMergingAspect.addRuntime(MergingMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA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C,CAAD,EAOlB;IACD,MAAMhQ,MAAM,GAAGgQ,UAAU,CAACC,YAAX,CAAwBC,wBAAA,CAAcpN,EAAtC,CAAf;IACA,MAAMqN,OAAO,GAAG,IAAIzQ,WAAJ,CAAgBE,SAAhB,EAA2BC,OAA3B,EAAoCC,QAApC,EAA8CC,QAA9C,EAAwDC,MAAxD,CAAhB;IACA+P,GAAG,CAACK,QAAJ,CAAa,KAAIC,oBAAJ,EAAaF,OAAb,CAAb;IACA,OAAOA,OAAP;EACD;;AA/lBsB;;;gCAAZzQ,W,WAglBI,E;gCAhlBJA,W,kBAilBW,CAAC4Q,gBAAD,EAAYC,oBAAZ,EAA6BC,mBAA7B,EAA6CC,0BAA7C,EAA6DC,wBAA7D,EAA4EC,sBAA5E,C;gCAjlBXjR,W,aAklBMkR,kB;;AAgBnBV,wBAAA,CAAcW,UAAd,CAAyBnR,WAAzB"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/merging",
3
- "version": "0.0.177",
3
+ "version": "0.0.179",
4
4
  "homepage": "https://bit.dev/teambit/component/merging",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "merging",
9
- "version": "0.0.177"
9
+ "version": "0.0.179"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,13 +17,14 @@
17
17
  "core-js": "^3.0.0",
18
18
  "@teambit/harmony": "0.3.3",
19
19
  "@teambit/bit-error": "0.0.400",
20
- "@teambit/cli": "0.0.573",
21
- "@teambit/checkout": "0.0.31",
20
+ "@teambit/cli": "0.0.575",
21
+ "@teambit/checkout": "0.0.33",
22
22
  "@teambit/component-id": "0.0.417",
23
- "@teambit/install": "0.0.10",
24
- "@teambit/lane-id": "0.0.91",
25
- "@teambit/snapping": "0.0.177",
26
- "@teambit/workspace": "0.0.862"
23
+ "@teambit/install": "0.0.12",
24
+ "@teambit/lane-id": "0.0.93",
25
+ "@teambit/logger": "0.0.668",
26
+ "@teambit/snapping": "0.0.179",
27
+ "@teambit/workspace": "0.0.864"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/lodash": "4.14.165",
@@ -35,7 +36,7 @@
35
36
  "@types/node": "12.20.4"
36
37
  },
37
38
  "peerDependencies": {
38
- "@teambit/legacy": "1.0.354",
39
+ "@teambit/legacy": "1.0.356",
39
40
  "react-dom": "^16.8.0 || ^17.0.0",
40
41
  "react": "^16.8.0 || ^17.0.0"
41
42
  },