@teambit/merging 0.0.186 → 0.0.187
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/merge-cmd.js +2 -2
- package/dist/merge-cmd.js.map +1 -1
- package/dist/merging.main.runtime.js +6 -17
- package/dist/merging.main.runtime.js.map +1 -1
- package/package-tar/teambit-merging-0.0.187.tgz +0 -0
- package/package.json +5 -5
- /package/{preview-1664941100086.js → preview-1665027346119.js} +0 -0
- package/package-tar/teambit-merging-0.0.186.tgz +0 -0
package/dist/merge-cmd.js
CHANGED
|
@@ -207,7 +207,7 @@ ${mergeSnapError.message}
|
|
|
207
207
|
|
|
208
208
|
const getFailureOutput = () => {
|
|
209
209
|
if (!failedComponents || !failedComponents.length) return '';
|
|
210
|
-
const title = '\nthe merge has been
|
|
210
|
+
const title = '\nthe merge has been skipped on the following component(s)';
|
|
211
211
|
const body = (0, _lodash().compact)(failedComponents.map(failedComponent => {
|
|
212
212
|
if (!verbose && failedComponent.unchangedLegitimately) return null;
|
|
213
213
|
const color = failedComponent.unchangedLegitimately ? 'white' : 'red';
|
|
@@ -215,7 +215,7 @@ ${mergeSnapError.message}
|
|
|
215
215
|
})).join('\n');
|
|
216
216
|
|
|
217
217
|
if (!body) {
|
|
218
|
-
return `${_chalk().default.bold(`\nthe merge has been
|
|
218
|
+
return `${_chalk().default.bold(`\nthe merge has been skipped on ${failedComponents.length} component(s) legitimately`)}
|
|
219
219
|
(use --verbose to list them next time)`;
|
|
220
220
|
}
|
|
221
221
|
|
package/dist/merge-cmd.js.map
CHANGED
|
@@ -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","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","getSummary","merged","f","failedToMerge","autoSnapped","newLines","mergedStr","unchangedLegitimatelyStr","failedToMergeStr","autoSnappedStr"],"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 const getSummary = () => {\n const merged = components?.length || 0;\n const unchangedLegitimately = failedComponents?.filter((f) => f.unchangedLegitimately).length || 0;\n const failedToMerge = failedComponents?.filter((f) => !f.unchangedLegitimately).length || 0;\n const autoSnapped =\n (mergeSnapResults?.snappedComponents.length || 0) + (mergeSnapResults?.autoSnappedResults.length || 0);\n\n const newLines = '\\n\\n';\n const title = chalk.bold.underline('Merge Summary');\n const mergedStr = `\\nTotal Merged: ${chalk.bold(merged.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(unchangedLegitimately.toString())}`;\n const failedToMergeStr = `\\nTotal Failed: ${chalk.bold(failedToMerge.toString())}`;\n const autoSnappedStr = `\\nTotal Snapped: ${chalk.bold(autoSnapped.toString())}`;\n\n return newLines + title + mergedStr + unchangedLegitimatelyStr + failedToMergeStr + autoSnappedStr;\n };\n\n return getSuccessOutput() + getFailureOutput() + getSnapsOutput() + getConflictSummary() + getSummary();\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,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;;IACA,MAAMyC,SAAS,GAAI,mBAAkB1C,gBAAA,CAAMO,IAAN,CAAW8B,MAAM,CAACjB,QAAP,EAAX,CAA8B,EAAnE;IACA,MAAMuB,wBAAwB,GAAI,sBAAqB3C,gBAAA,CAAMO,IAAN,CAAW0B,qBAAqB,CAACb,QAAtB,EAAX,CAA6C,EAApG;IACA,MAAMwB,gBAAgB,GAAI,mBAAkB5C,gBAAA,CAAMO,IAAN,CAAWgC,aAAa,CAACnB,QAAd,EAAX,CAAqC,EAAjF;IACA,MAAMyB,cAAc,GAAI,oBAAmB7C,gBAAA,CAAMO,IAAN,CAAWiC,WAAW,CAACpB,QAAZ,EAAX,CAAmC,EAA9E;IAEA,OAAOqB,QAAQ,GAAGhD,KAAX,GAAmBiD,SAAnB,GAA+BC,wBAA/B,GAA0DC,gBAA1D,GAA6EC,cAApF;EACD,CAfD;;EAiBA,OAAOxC,gBAAgB,KAAKwB,gBAAgB,EAArC,GAA0ChB,cAAc,EAAxD,GAA6DJ,kBAAkB,EAA/E,GAAoF2B,UAAU,EAArG;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","getSummary","merged","f","failedToMerge","autoSnapped","newLines","mergedStr","unchangedLegitimatelyStr","failedToMergeStr","autoSnappedStr"],"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 skipped 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 skipped 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 const getSummary = () => {\n const merged = components?.length || 0;\n const unchangedLegitimately = failedComponents?.filter((f) => f.unchangedLegitimately).length || 0;\n const failedToMerge = failedComponents?.filter((f) => !f.unchangedLegitimately).length || 0;\n const autoSnapped =\n (mergeSnapResults?.snappedComponents.length || 0) + (mergeSnapResults?.autoSnappedResults.length || 0);\n\n const newLines = '\\n\\n';\n const title = chalk.bold.underline('Merge Summary');\n const mergedStr = `\\nTotal Merged: ${chalk.bold(merged.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(unchangedLegitimately.toString())}`;\n const failedToMergeStr = `\\nTotal Failed: ${chalk.bold(failedToMerge.toString())}`;\n const autoSnappedStr = `\\nTotal Snapped: ${chalk.bold(autoSnapped.toString())}`;\n\n return newLines + title + mergedStr + unchangedLegitimatelyStr + failedToMergeStr + autoSnappedStr;\n };\n\n return getSuccessOutput() + getFailureOutput() + getSnapsOutput() + getConflictSummary() + getSummary();\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,CAJ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c,GAAI,oBAAmB7C,gBAAA,CAAMO,IAAN,CAAWiC,WAAW,CAACpB,QAAZ,EAAX,CAAmC,EAA9E;IAEA,OAAOqB,QAAQ,GAAGhD,KAAX,GAAmBiD,SAAnB,GAA+BC,wBAA/B,GAA0DC,gBAA1D,GAA6EC,cAApF;EACD,CAfD;;EAiBA,OAAOxC,gBAAgB,KAAKwB,gBAAgB,EAArC,GAA0ChB,cAAc,EAAxD,GAA6DJ,kBAAkB,EAA/E,GAAoF2B,UAAU,EAArG;AACD"}
|
|
@@ -161,16 +161,6 @@ function _getDivergeData() {
|
|
|
161
161
|
return data;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
function _objects() {
|
|
165
|
-
const data = require("@teambit/legacy/dist/scope/objects");
|
|
166
|
-
|
|
167
|
-
_objects = function () {
|
|
168
|
-
return data;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
return data;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
164
|
function _chalk() {
|
|
175
165
|
const data = _interopRequireDefault(require("chalk"));
|
|
176
166
|
|
|
@@ -507,8 +497,6 @@ class MergingMain {
|
|
|
507
497
|
localLane, // currently checked out lane. if on main, then it's null.
|
|
508
498
|
otherLaneName, // the lane name we want to merged to our lane. (can be also "main").
|
|
509
499
|
options) {
|
|
510
|
-
var _modelComponent$laneH;
|
|
511
|
-
|
|
512
500
|
const consumer = this.workspace.consumer;
|
|
513
501
|
const componentStatus = {
|
|
514
502
|
id
|
|
@@ -600,10 +588,11 @@ class MergingMain {
|
|
|
600
588
|
|
|
601
589
|
if (isComponentModified) {
|
|
602
590
|
return returnUnmerged(`component is modified, please snap/tag it first`);
|
|
603
|
-
}
|
|
591
|
+
} // @todo: is it needed?
|
|
592
|
+
// const laneHeadIsDifferentThanCheckedOut =
|
|
593
|
+
// localLane && existingBitMapId?.version && modelComponent.laneHeadLocal?.toString() !== existingBitMapId?.version;
|
|
594
|
+
// const localHead = laneHeadIsDifferentThanCheckedOut ? Ref.from(existingBitMapId.version) : null;
|
|
604
595
|
|
|
605
|
-
const laneHeadIsDifferentThanCheckedOut = localLane && (existingBitMapId === null || existingBitMapId === void 0 ? void 0 : existingBitMapId.version) && ((_modelComponent$laneH = modelComponent.laneHeadLocal) === null || _modelComponent$laneH === void 0 ? void 0 : _modelComponent$laneH.toString()) !== (existingBitMapId === null || existingBitMapId === void 0 ? void 0 : existingBitMapId.version);
|
|
606
|
-
const localHead = laneHeadIsDifferentThanCheckedOut ? _objects().Ref.from(existingBitMapId.version) : null;
|
|
607
596
|
|
|
608
597
|
if (!otherLaneHead) {
|
|
609
598
|
throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);
|
|
@@ -613,7 +602,7 @@ class MergingMain {
|
|
|
613
602
|
repo,
|
|
614
603
|
modelComponent,
|
|
615
604
|
remoteHead: otherLaneHead,
|
|
616
|
-
checkedOutLocalHead: localHead,
|
|
605
|
+
// checkedOutLocalHead: localHead,
|
|
617
606
|
throws: false
|
|
618
607
|
});
|
|
619
608
|
|
|
@@ -633,7 +622,7 @@ class MergingMain {
|
|
|
633
622
|
return !(divergeDataFromMain.err instanceof _noCommonSnap().NoCommonSnap);
|
|
634
623
|
};
|
|
635
624
|
|
|
636
|
-
const hasResolvedLocally = await hasResolvedFromMain(
|
|
625
|
+
const hasResolvedLocally = await hasResolvedFromMain(modelComponent.getHeadRegardlessOfLane());
|
|
637
626
|
const hasResolvedRemotely = await hasResolvedFromMain(otherLaneHead);
|
|
638
627
|
|
|
639
628
|
if (!hasResolvedLocally && !hasResolvedRemotely) {
|
|
@@ -1 +1 @@
|
|
|
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","throws","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isModified","componentModificationStatus","getComponentStatusById","modified","baseComponent","ignoreConfigChanges","isComponentSourceCodeModified","isComponentModified","laneHeadIsDifferentThanCheckedOut","laneHeadLocal","localHead","Ref","Error","checkedOutLocalHead","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, remoteHead: otherLaneHead, throws: 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({\n repo,\n modelComponent,\n remoteHead: otherLaneHead,\n checkedOutLocalHead: localHead,\n throws: false,\n });\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({\n repo,\n modelComponent,\n remoteHead: mainHead,\n checkedOutLocalHead: hashToCompare,\n throws: false,\n });\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;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAUA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA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,CAACC,YAAX,CAAwBC,wBAAA,CAActN,EAAtC,CAAf;IACA,MAAMuN,OAAO,GAAG,IAAI3Q,WAAJ,CAAgBE,SAAhB,EAA2BC,OAA3B,EAAoCC,QAApC,EAA8CC,QAA9C,EAAwDC,MAAxD,CAAhB;IACAiQ,GAAG,CAACK,QAAJ,CAAa,KAAIC,oBAAJ,EAAaF,OAAb,CAAb;IACA,OAAOA,OAAP;EACD;;AA3mBsB;;;gCAAZ3Q,W,WA4lBI,E;gCA5lBJA,W,kBA6lBW,CAAC8Q,gBAAD,EAAYC,oBAAZ,EAA6BC,mBAA7B,EAA6CC,0BAA7C,EAA6DC,wBAA7D,EAA4EC,sBAA5E,C;gCA7lBXnR,W,aA8lBMoR,kB;;AAgBnBV,wBAAA,CAAcW,UAAd,CAAyBrR,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","throws","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","isModified","componentModificationStatus","getComponentStatusById","modified","baseComponent","ignoreConfigChanges","isComponentSourceCodeModified","isComponentModified","Error","mainHead","NoCommonSnap","resolveUnrelated","hasResolvedFromMain","hashToCompare","divergeDataFromMain","checkedOutLocalHead","hasResolvedLocally","getHeadRegardlessOfLane","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, remoteHead: otherLaneHead, throws: 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 // @todo: is it needed?\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({\n repo,\n modelComponent,\n remoteHead: otherLaneHead,\n // checkedOutLocalHead: localHead,\n throws: false,\n });\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({\n repo,\n modelComponent,\n remoteHead: mainHead,\n checkedOutLocalHead: hashToCompare,\n throws: false,\n });\n if (!divergeDataFromMain.err) return true;\n return !(divergeDataFromMain.err instanceof NoCommonSnap);\n };\n const hasResolvedLocally = await hasResolvedFromMain(modelComponent.getHeadRegardlessOfLane() as Ref);\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;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAUA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAA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,GAAG,KAAIC,yBAAJ,EAAmBzP,QAAnB,CAAvB;MACA,OAAOwP,cAAc,CAACE,+BAAf,CAA+CnO,GAA/C,CAAP;IACD;;IACD,OAAOA,GAAG,CAACkB,GAAJ,CAASI,EAAD,IAAQ7C,QAAQ,CAAC2P,WAAT,CAAqB9M,EAArB,CAAhB,CAAP;EACD;;EAKoB,aAAR+M,QAAQ,CAAC,CAACC,GAAD,EAAMlQ,SAAN,EAAiBE,QAAjB,EAA2BC,QAA3B,EAAqCF,OAArC,EAA8CkQ,UAA9C,CAAD,EAOlB;IACD,MAAM/P,MAAM,GAAG+P,UAAU,CAACC,YAAX,CAAwBC,wBAAA,CAAcnN,EAAtC,CAAf;IACA,MAAMoN,OAAO,GAAG,IAAIxQ,WAAJ,CAAgBE,SAAhB,EAA2BC,OAA3B,EAAoCC,QAApC,EAA8CC,QAA9C,EAAwDC,MAAxD,CAAhB;IACA8P,GAAG,CAACK,QAAJ,CAAa,KAAIC,oBAAJ,EAAaF,OAAb,CAAb;IACA,OAAOA,OAAP;EACD;;AA5mBsB;;;gCAAZxQ,W,WA6lBI,E;gCA7lBJA,W,kBA8lBW,CAAC2Q,gBAAD,EAAYC,oBAAZ,EAA6BC,mBAA7B,EAA6CC,0BAA7C,EAA6DC,wBAA7D,EAA4EC,sBAA5E,C;gCA9lBXhR,W,aA+lBMiR,kB;;AAgBnBV,wBAAA,CAAcW,UAAd,CAAyBlR,WAAzB"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/merging",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.187",
|
|
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.
|
|
9
|
+
"version": "0.0.187"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"@teambit/harmony": "0.3.3",
|
|
19
19
|
"@teambit/bit-error": "0.0.400",
|
|
20
20
|
"@teambit/cli": "0.0.582",
|
|
21
|
-
"@teambit/checkout": "0.0.
|
|
21
|
+
"@teambit/checkout": "0.0.41",
|
|
22
22
|
"@teambit/component-id": "0.0.417",
|
|
23
23
|
"@teambit/install": "0.0.19",
|
|
24
24
|
"@teambit/lane-id": "0.0.100",
|
|
25
25
|
"@teambit/logger": "0.0.675",
|
|
26
|
-
"@teambit/snapping": "0.0.
|
|
27
|
-
"@teambit/workspace": "0.0.
|
|
26
|
+
"@teambit/snapping": "0.0.187",
|
|
27
|
+
"@teambit/workspace": "0.0.872"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/lodash": "4.14.165",
|
|
File without changes
|
|
Binary file
|