@teambit/merging 0.0.126 → 0.0.129
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.d.ts +4 -2
- package/dist/merge-cmd.js +23 -8
- package/dist/merge-cmd.js.map +1 -1
- package/dist/merging.main.runtime.d.ts +4 -3
- package/dist/merging.main.runtime.js +59 -73
- package/dist/merging.main.runtime.js.map +1 -1
- package/package-tar/teambit-merging-0.0.129.tgz +0 -0
- package/package.json +9 -9
- /package/{preview-1660015726089.js → preview-1660275011373.js} +0 -0
- package/package-tar/teambit-merging-0.0.126.tgz +0 -0
package/dist/merge-cmd.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare class MergeCmd implements Command {
|
|
|
11
11
|
options: CommandOptions;
|
|
12
12
|
loader: boolean;
|
|
13
13
|
constructor(merging: MergingMain);
|
|
14
|
-
report([values]: [string[]], { ours, theirs, manual, abort, resolve, build, noSnap, message, }: {
|
|
14
|
+
report([values]: [string[]], { ours, theirs, manual, abort, resolve, build, noSnap, verbose, message, skipDependencyInstallation, }: {
|
|
15
15
|
ours?: boolean;
|
|
16
16
|
theirs?: boolean;
|
|
17
17
|
manual?: boolean;
|
|
@@ -19,7 +19,9 @@ export declare class MergeCmd implements Command {
|
|
|
19
19
|
resolve?: boolean;
|
|
20
20
|
build?: boolean;
|
|
21
21
|
noSnap?: boolean;
|
|
22
|
+
verbose?: boolean;
|
|
22
23
|
message: string;
|
|
24
|
+
skipDependencyInstallation?: boolean;
|
|
23
25
|
}): Promise<string>;
|
|
24
26
|
}
|
|
25
|
-
export declare function mergeReport({ components, failedComponents, version, mergeSnapResults, leftUnresolvedConflicts, }: ApplyVersionResults): string;
|
|
27
|
+
export declare function mergeReport({ components, failedComponents, version, mergeSnapResults, leftUnresolvedConflicts, verbose, }: ApplyVersionResults): string;
|
package/dist/merge-cmd.js
CHANGED
|
@@ -32,6 +32,16 @@ function _chalk() {
|
|
|
32
32
|
return data;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function _lodash() {
|
|
36
|
+
const data = require("lodash");
|
|
37
|
+
|
|
38
|
+
_lodash = function () {
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
function _constants() {
|
|
36
46
|
const data = require("@teambit/legacy/dist/constants");
|
|
37
47
|
|
|
@@ -83,7 +93,7 @@ class MergeCmd {
|
|
|
83
93
|
\`bit merge [ids...]\` => EXPERIMENTAL. merge changes of the remote head into local, optionally use '--abort' or '--resolve'
|
|
84
94
|
${(0, _constants().WILDCARD_HELP)('merge 0.0.1')}`);
|
|
85
95
|
(0, _defineProperty2().default)(this, "alias", '');
|
|
86
|
-
(0, _defineProperty2().default)(this, "options", [['', 'ours', 'in case of a conflict, override the used version with the current modification'], ['', 'theirs', 'in case of a conflict, override the current modification with the specified version'], ['', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'], ['', 'abort', 'EXPERIMENTAL. in case of an unresolved merge, revert to the state before the merge began'], ['', 'resolve', 'EXPERIMENTAL. mark an unresolved merge as resolved and create a new snap with the changes'], ['', 'no-snap', 'EXPERIMENTAL. do not auto snap in case the merge completed without conflicts'], ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'], ['m', 'message <message>', 'EXPERIMENTAL. override the default message for the auto snap']]);
|
|
96
|
+
(0, _defineProperty2().default)(this, "options", [['', 'ours', 'in case of a conflict, override the used version with the current modification'], ['', 'theirs', 'in case of a conflict, override the current modification with the specified version'], ['', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'], ['', 'abort', 'EXPERIMENTAL. in case of an unresolved merge, revert to the state before the merge began'], ['', 'resolve', 'EXPERIMENTAL. mark an unresolved merge as resolved and create a new snap with the changes'], ['', 'no-snap', 'EXPERIMENTAL. do not auto snap in case the merge completed without conflicts'], ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'], ['', 'verbose', 'show details of components that were not merged legitimately'], ['', 'skip-dependency-installation', 'do not install packages of the imported components'], ['m', 'message <message>', 'EXPERIMENTAL. override the default message for the auto snap']]);
|
|
87
97
|
(0, _defineProperty2().default)(this, "loader", true);
|
|
88
98
|
}
|
|
89
99
|
|
|
@@ -95,7 +105,9 @@ class MergeCmd {
|
|
|
95
105
|
resolve = false,
|
|
96
106
|
build = false,
|
|
97
107
|
noSnap = false,
|
|
98
|
-
|
|
108
|
+
verbose = false,
|
|
109
|
+
message,
|
|
110
|
+
skipDependencyInstallation = false
|
|
99
111
|
}) {
|
|
100
112
|
build = (0, _featureToggle().isFeatureEnabled)(_featureToggle().BUILD_ON_CI) ? Boolean(build) : true;
|
|
101
113
|
const mergeStrategy = (0, _mergeVersion().getMergeStrategy)(ours, theirs, manual);
|
|
@@ -108,7 +120,7 @@ class MergeCmd {
|
|
|
108
120
|
resolvedComponents,
|
|
109
121
|
abortedComponents,
|
|
110
122
|
mergeSnapResults
|
|
111
|
-
} = await this.merging.merge(values, mergeStrategy, abort, resolve, noSnap, message, build);
|
|
123
|
+
} = await this.merging.merge(values, mergeStrategy, abort, resolve, noSnap, message, build, skipDependencyInstallation);
|
|
112
124
|
|
|
113
125
|
if (resolvedComponents) {
|
|
114
126
|
const title = 'successfully resolved component(s)\n';
|
|
@@ -126,7 +138,8 @@ class MergeCmd {
|
|
|
126
138
|
components,
|
|
127
139
|
failedComponents,
|
|
128
140
|
version,
|
|
129
|
-
mergeSnapResults
|
|
141
|
+
mergeSnapResults,
|
|
142
|
+
verbose
|
|
130
143
|
});
|
|
131
144
|
}
|
|
132
145
|
|
|
@@ -139,7 +152,8 @@ function mergeReport({
|
|
|
139
152
|
failedComponents,
|
|
140
153
|
version,
|
|
141
154
|
mergeSnapResults,
|
|
142
|
-
leftUnresolvedConflicts
|
|
155
|
+
leftUnresolvedConflicts,
|
|
156
|
+
verbose
|
|
143
157
|
}) {
|
|
144
158
|
const getSuccessOutput = () => {
|
|
145
159
|
if (!components || !components.length) return ''; // @ts-ignore version is set in case of merge command
|
|
@@ -151,7 +165,7 @@ function mergeReport({
|
|
|
151
165
|
|
|
152
166
|
const getConflictSummary = () => {
|
|
153
167
|
if (!components || !components.length || !leftUnresolvedConflicts) return '';
|
|
154
|
-
const title =
|
|
168
|
+
const title = `\nfiles with conflicts summary\n`;
|
|
155
169
|
const suggestion = `\n\nthe merge process wasn't completed due to the conflicts above. fix them manually and then run "bit install".
|
|
156
170
|
once ready, snap/tag the components to complete the merge.`;
|
|
157
171
|
return _chalk().default.underline(title) + (0, _mergeVersion().conflictSummaryReport)(components) + _chalk().default.yellow(suggestion);
|
|
@@ -184,10 +198,11 @@ once ready, snap/tag the components to complete the merge.`;
|
|
|
184
198
|
const getFailureOutput = () => {
|
|
185
199
|
if (!failedComponents || !failedComponents.length) return '';
|
|
186
200
|
const title = '\nthe merge has been canceled on the following component(s)';
|
|
187
|
-
const body = failedComponents.map(failedComponent => {
|
|
201
|
+
const body = (0, _lodash().compact)(failedComponents.map(failedComponent => {
|
|
202
|
+
if (!verbose && failedComponent.unchangedLegitimately) return null;
|
|
188
203
|
const color = failedComponent.unchangedLegitimately ? 'white' : 'red';
|
|
189
204
|
return `${_chalk().default.bold(failedComponent.id.toString())} - ${_chalk().default[color](failedComponent.failureMessage)}`;
|
|
190
|
-
}).join('\n');
|
|
205
|
+
})).join('\n');
|
|
191
206
|
return `\n${_chalk().default.underline(title)}\n${body}\n\n`;
|
|
192
207
|
};
|
|
193
208
|
|
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","message","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","failedComponent","color","unchangedLegitimately","failureMessage"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\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 ['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 message,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n message: string;\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 );\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 });\n }\n}\n\nexport function mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n leftUnresolvedConflicts,\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 = `files 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 = failedComponents\n .map((failedComponent) => {\n const color = failedComponent.unchangedLegitimately ? 'white' : 'red';\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk[color](failedComponent.failureMessage)}`;\n })\n .join('\\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;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,QAAN,CAAkC;EAqBvCC,WAAW,CAASC,OAAT,EAA+B;IAAA,KAAtBA,OA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L,OAAO,CAAC1B,GAAR,CAAagC,CAAD,IAAOA,CAAC,CAACT,SAAF,CAAYrB,EAAZ,CAAeuB,QAAf,EAAnB,CAApB;UACAD,eAAe,IAAK,YAAWS,6BAAiB,KAAIF,WAAW,CAAC3B,IAAZ,CAAiB,IAAjB,CAAuB,EAA3E;QACD;;QACD,OAAOoB,eAAP;MACD,CAXI,EAYJpB,IAZI,CAYC,IAZD,CAAP;IAaD,CAdD;;IAgBA,OAAQ,KAAIC,gBAAA,CAAMC,SAAN,CACV,0BADU,CAEV,MAAK,kDAAmD,MAAKe,gBAAgB,CAACF,iBAAD,CAAoB,IAFnG;EAGD,CAtBD;;EAwBA,MAAMe,gBAAgB,GAAG,MAAM;IAC7B,IAAI,CAAC1C,gBAAD,IAAqB,CAACA,gBAAgB,CAACmB,MAA3C,EAAmD,OAAO,EAAP;IACnD,MAAMb,KAAK,GAAG,6DAAd;IACA,MAAMqC,IAAI,GAAG3C,gBAAgB,CAC1BQ,GADU,CACLoC,eAAD,IAAqB;MACxB,MAAMC,KAAK,GAAGD,eAAe,CAACE,qBAAhB,GAAwC,OAAxC,GAAkD,KAAhE;MACA,OAAQ,GAAEjC,gBAAA,CAAMO,IAAN,CAAWwB,eAAe,CAAClC,EAAhB,CAAmBuB,QAAnB,EAAX,CAA0C,MAAKpB,gBAAA,CAAMgC,KAAN,EAAaD,eAAe,CAACG,cAA7B,CAA6C,EAAtG;IACD,CAJU,EAKVnC,IALU,CAKL,IALK,CAAb;IAMA,OAAQ,KAAIC,gBAAA,CAAMC,SAAN,CAAgBR,KAAhB,CAAuB,KAAIqC,IAAK,MAA5C;EACD,CAVD;;EAYA,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","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 return `\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n };\n\n return getSuccessOutput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AC,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,OAAQ,KAAIC,gBAAA,CAAMC,SAAN,CAAgBR,KAAhB,CAAuB,KAAIqC,IAAK,MAA5C;EACD,CAXD;;EAaA,OAAOzB,gBAAgB,KAAKwB,gBAAgB,EAArC,GAA0ChB,cAAc,EAAxD,GAA6DJ,kBAAkB,EAAtF;AACD"}
|
|
@@ -28,16 +28,16 @@ export declare class MergingMain {
|
|
|
28
28
|
* if the first param is a version, then merge the component ids to that version.
|
|
29
29
|
* otherwise, merge from the remote head to the local.
|
|
30
30
|
*/
|
|
31
|
-
merge(values: string[], mergeStrategy: MergeStrategy, abort: boolean, resolve: boolean, noSnap: boolean, message: string, build: boolean): Promise<ApplyVersionResults>;
|
|
31
|
+
merge(values: string[], mergeStrategy: MergeStrategy, abort: boolean, resolve: boolean, noSnap: boolean, message: string, build: boolean, skipDependencyInstallation: boolean): Promise<ApplyVersionResults>;
|
|
32
32
|
/**
|
|
33
33
|
* when user is on main, it merges the remote main components into local.
|
|
34
34
|
* when user is on a lane, it merges the remote lane components into the local lane.
|
|
35
35
|
*/
|
|
36
|
-
mergeComponentsFromRemote(consumer: Consumer, bitIds: BitId[], mergeStrategy: MergeStrategy, noSnap: boolean, snapMessage: string, build: boolean): Promise<ApplyVersionResults>;
|
|
36
|
+
mergeComponentsFromRemote(consumer: Consumer, bitIds: BitId[], mergeStrategy: MergeStrategy, noSnap: boolean, snapMessage: string, build: boolean, skipDependencyInstallation: boolean): Promise<ApplyVersionResults>;
|
|
37
37
|
/**
|
|
38
38
|
* merge multiple components according to the "allComponentsStatus".
|
|
39
39
|
*/
|
|
40
|
-
mergeSnaps({ mergeStrategy, allComponentsStatus, remoteName, laneId, localLane, noSnap, snapMessage, build, }: {
|
|
40
|
+
mergeSnaps({ mergeStrategy, allComponentsStatus, remoteName, laneId, localLane, noSnap, snapMessage, build, skipDependencyInstallation, }: {
|
|
41
41
|
mergeStrategy: MergeStrategy;
|
|
42
42
|
allComponentsStatus: ComponentMergeStatus[];
|
|
43
43
|
remoteName: string | null;
|
|
@@ -46,6 +46,7 @@ export declare class MergingMain {
|
|
|
46
46
|
noSnap: boolean;
|
|
47
47
|
snapMessage: string;
|
|
48
48
|
build: boolean;
|
|
49
|
+
skipDependencyInstallation?: boolean;
|
|
49
50
|
}): Promise<ApplyVersionResults>;
|
|
50
51
|
/**
|
|
51
52
|
* this function gets called from two different commands:
|
|
@@ -101,16 +101,6 @@ function _hasWildcard() {
|
|
|
101
101
|
return data;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function _fsExtra() {
|
|
105
|
-
const data = _interopRequireDefault(require("fs-extra"));
|
|
106
|
-
|
|
107
|
-
_fsExtra = function () {
|
|
108
|
-
return data;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
return data;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
104
|
function _pMapSeries() {
|
|
115
105
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
116
106
|
|
|
@@ -121,16 +111,6 @@ function _pMapSeries() {
|
|
|
121
111
|
return data;
|
|
122
112
|
}
|
|
123
113
|
|
|
124
|
-
function _path() {
|
|
125
|
-
const data = _interopRequireDefault(require("path"));
|
|
126
|
-
|
|
127
|
-
_path = function () {
|
|
128
|
-
return data;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
return data;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
114
|
function _bitId() {
|
|
135
115
|
const data = require("@teambit/legacy/dist/bit-id");
|
|
136
116
|
|
|
@@ -141,16 +121,6 @@ function _bitId() {
|
|
|
141
121
|
return data;
|
|
142
122
|
}
|
|
143
123
|
|
|
144
|
-
function _constants() {
|
|
145
|
-
const data = require("@teambit/legacy/dist/constants");
|
|
146
|
-
|
|
147
|
-
_constants = function () {
|
|
148
|
-
return data;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
return data;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
124
|
function _bitError() {
|
|
155
125
|
const data = require("@teambit/bit-error");
|
|
156
126
|
|
|
@@ -315,7 +285,7 @@ class MergingMain {
|
|
|
315
285
|
*/
|
|
316
286
|
|
|
317
287
|
|
|
318
|
-
async merge(values, mergeStrategy, abort, resolve, noSnap, message, build) {
|
|
288
|
+
async merge(values, mergeStrategy, abort, resolve, noSnap, message, build, skipDependencyInstallation) {
|
|
319
289
|
if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
|
|
320
290
|
const consumer = this.workspace.consumer;
|
|
321
291
|
let mergeResults;
|
|
@@ -329,7 +299,7 @@ class MergingMain {
|
|
|
329
299
|
} else if (!_bitId().BitId.isValidVersion(firstValue)) {
|
|
330
300
|
const bitIds = this.getComponentsToMerge(consumer, values); // @todo: version could be the lane only or remote/lane
|
|
331
301
|
|
|
332
|
-
mergeResults = await this.mergeComponentsFromRemote(consumer, bitIds, mergeStrategy, noSnap, message, build);
|
|
302
|
+
mergeResults = await this.mergeComponentsFromRemote(consumer, bitIds, mergeStrategy, noSnap, message, build, skipDependencyInstallation);
|
|
333
303
|
} else {
|
|
334
304
|
const version = firstValue;
|
|
335
305
|
|
|
@@ -348,7 +318,7 @@ class MergingMain {
|
|
|
348
318
|
*/
|
|
349
319
|
|
|
350
320
|
|
|
351
|
-
async mergeComponentsFromRemote(consumer, bitIds, mergeStrategy, noSnap, snapMessage, build) {
|
|
321
|
+
async mergeComponentsFromRemote(consumer, bitIds, mergeStrategy, noSnap, snapMessage, build, skipDependencyInstallation) {
|
|
352
322
|
const currentLaneId = consumer.getCurrentLaneId();
|
|
353
323
|
const currentLaneObject = await consumer.getCurrentLaneObject();
|
|
354
324
|
const allComponentsStatus = await this.getAllComponentsStatus(bitIds, currentLaneId, currentLaneObject);
|
|
@@ -367,7 +337,8 @@ class MergingMain {
|
|
|
367
337
|
localLane: currentLaneObject,
|
|
368
338
|
noSnap,
|
|
369
339
|
snapMessage,
|
|
370
|
-
build
|
|
340
|
+
build,
|
|
341
|
+
skipDependencyInstallation
|
|
371
342
|
});
|
|
372
343
|
}
|
|
373
344
|
/**
|
|
@@ -383,7 +354,8 @@ class MergingMain {
|
|
|
383
354
|
localLane,
|
|
384
355
|
noSnap,
|
|
385
356
|
snapMessage,
|
|
386
|
-
build
|
|
357
|
+
build,
|
|
358
|
+
skipDependencyInstallation
|
|
387
359
|
}) {
|
|
388
360
|
const consumer = this.workspace.consumer;
|
|
389
361
|
const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
|
|
@@ -419,6 +391,15 @@ class MergingMain {
|
|
|
419
391
|
});
|
|
420
392
|
});
|
|
421
393
|
const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';
|
|
394
|
+
|
|
395
|
+
if (!skipDependencyInstallation && !leftUnresolvedConflicts) {
|
|
396
|
+
await this.workspace.install(undefined, {
|
|
397
|
+
dedupe: true,
|
|
398
|
+
updateExisting: false,
|
|
399
|
+
import: false
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
|
|
422
403
|
if (localLane) consumer.scope.objects.add(localLane);
|
|
423
404
|
await consumer.scope.objects.persist(); // persist anyway, if localLane is null it should save all main heads
|
|
424
405
|
|
|
@@ -480,10 +461,30 @@ class MergingMain {
|
|
|
480
461
|
const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, {
|
|
481
462
|
ignoreVersion: true
|
|
482
463
|
});
|
|
483
|
-
const existOnCurrentLane = existingBitMapId && consumer.bitMap.isIdAvailableOnCurrentLane(existingBitMapId);
|
|
484
464
|
const componentOnLane = await modelComponent.loadVersion(version, consumer.scope.objects);
|
|
485
465
|
|
|
486
|
-
|
|
466
|
+
const getCurrentId = () => {
|
|
467
|
+
if (existingBitMapId) return existingBitMapId;
|
|
468
|
+
|
|
469
|
+
if (localLane) {
|
|
470
|
+
const idOnLane = localLane.getComponent(id);
|
|
471
|
+
if (!idOnLane) return null;
|
|
472
|
+
return idOnLane.id.changeVersion(idOnLane.head.toString());
|
|
473
|
+
} // it's on main
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
const head = modelComponent.getHeadAsTagIfExist();
|
|
477
|
+
|
|
478
|
+
if (head) {
|
|
479
|
+
return id.changeVersion(head);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return null;
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
const currentId = getCurrentId();
|
|
486
|
+
|
|
487
|
+
if (!currentId) {
|
|
487
488
|
const divergeData = await (0, _getDivergeData().getDivergeData)(repo, modelComponent, otherLaneHead, null, false);
|
|
488
489
|
return {
|
|
489
490
|
componentFromFS: null,
|
|
@@ -492,26 +493,29 @@ class MergingMain {
|
|
|
492
493
|
mergeResults: null,
|
|
493
494
|
divergeData
|
|
494
495
|
};
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
496
|
+
} // const currentlyUsedVersion = existingBitMapId.version;
|
|
497
|
+
// if (currentlyUsedVersion === version) {
|
|
498
|
+
// // @todo: maybe this check is not needed as we check for diverge later on
|
|
499
|
+
// if (localLane || modelComponent.hasHead()) {
|
|
500
|
+
// return returnUnmerged(`component ${id.toStringWithoutVersion()} is already merged`, true);
|
|
501
|
+
// }
|
|
502
|
+
// }
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
const getCurrentComponent = () => {
|
|
506
|
+
if (existingBitMapId) return consumer.loadComponent(existingBitMapId);
|
|
507
|
+
return consumer.scope.getConsumerComponent(currentId);
|
|
508
|
+
};
|
|
505
509
|
|
|
506
|
-
const component = await
|
|
510
|
+
const component = await getCurrentComponent();
|
|
507
511
|
const componentModificationStatus = await consumer.getComponentStatusById(component.id);
|
|
508
512
|
|
|
509
513
|
if (componentModificationStatus.modified) {
|
|
510
514
|
return returnUnmerged(`unable to merge ${id.toStringWithoutVersion()}, the component is modified, please snap/tag it first`);
|
|
511
515
|
}
|
|
512
516
|
|
|
513
|
-
const laneHeadIsDifferentThanCheckedOut = localLane &&
|
|
514
|
-
const localHead = laneHeadIsDifferentThanCheckedOut ? _objects().Ref.from(
|
|
517
|
+
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);
|
|
518
|
+
const localHead = laneHeadIsDifferentThanCheckedOut ? _objects().Ref.from(existingBitMapId.version) : null;
|
|
515
519
|
|
|
516
520
|
if (!otherLaneHead) {
|
|
517
521
|
throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);
|
|
@@ -548,13 +552,13 @@ class MergingMain {
|
|
|
548
552
|
|
|
549
553
|
const baseComponent = await modelComponent.loadVersion(baseSnap.toString(), repo);
|
|
550
554
|
const otherComponent = await modelComponent.loadVersion(otherLaneHead.toString(), repo);
|
|
555
|
+
const currentLaneName = (localLane === null || localLane === void 0 ? void 0 : localLane.toLaneId().toString()) || 'main';
|
|
551
556
|
const mergeResults = await (0, _threeWayMerge().default)({
|
|
552
557
|
consumer,
|
|
553
558
|
otherComponent,
|
|
554
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
555
559
|
otherLabel: `${otherLaneHead.toString()} (${otherLaneName})`,
|
|
556
560
|
currentComponent: component,
|
|
557
|
-
currentLabel: `${
|
|
561
|
+
currentLabel: `${currentId.version} (${currentLaneName})`,
|
|
558
562
|
baseComponent
|
|
559
563
|
});
|
|
560
564
|
return {
|
|
@@ -610,30 +614,12 @@ class MergingMain {
|
|
|
610
614
|
const remoteId = id.changeVersion(remoteHead.toString());
|
|
611
615
|
const idToLoad = !mergeResults || mergeStrategy === _mergeVersion().MergeOptions.theirs ? remoteId : id;
|
|
612
616
|
const componentWithDependencies = await consumer.loadComponentWithDependenciesFromModel(idToLoad);
|
|
613
|
-
const componentMap = componentFromFS && componentFromFS.componentMap;
|
|
614
|
-
if (componentFromFS && !componentMap) throw new (_generalError().default)('applyVersion: componentMap was not found');
|
|
615
617
|
|
|
616
|
-
if (
|
|
618
|
+
if (!id.scope) {
|
|
617
619
|
componentWithDependencies.dependencies = [];
|
|
618
620
|
componentWithDependencies.devDependencies = [];
|
|
619
621
|
}
|
|
620
622
|
|
|
621
|
-
const shouldWritePackageJson = async () => {
|
|
622
|
-
if (!componentMap) return true;
|
|
623
|
-
const rootDir = componentMap && componentMap.rootDir;
|
|
624
|
-
if (!rootDir) return false;
|
|
625
|
-
|
|
626
|
-
const packageJsonPath = _path().default.join(consumer.getPath(), rootDir, 'package.json');
|
|
627
|
-
|
|
628
|
-
return _fsExtra().default.pathExists(packageJsonPath);
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
const shouldInstallNpmPackages = () => {
|
|
632
|
-
if (componentMap && componentMap.origin === _constants().COMPONENT_ORIGINS.AUTHORED) return false;
|
|
633
|
-
return true;
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
const writePackageJson = await shouldWritePackageJson();
|
|
637
623
|
const files = componentWithDependencies.component.files;
|
|
638
624
|
files.forEach(file => {
|
|
639
625
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
@@ -655,7 +641,7 @@ class MergingMain {
|
|
|
655
641
|
const manyComponentsWriter = new (_manyComponentsWriter().default)({
|
|
656
642
|
consumer,
|
|
657
643
|
componentsWithDependencies: [componentWithDependencies],
|
|
658
|
-
installNpmPackages:
|
|
644
|
+
installNpmPackages: false,
|
|
659
645
|
override: true,
|
|
660
646
|
writeConfig: false,
|
|
661
647
|
// @todo: should write if config exists before, needs to figure out how to do it.
|
|
@@ -663,7 +649,7 @@ class MergingMain {
|
|
|
663
649
|
// @todo: do we need a flag here?
|
|
664
650
|
writeDists: true,
|
|
665
651
|
// @todo: do we need a flag here?
|
|
666
|
-
writePackageJson
|
|
652
|
+
writePackageJson: false
|
|
667
653
|
});
|
|
668
654
|
await manyComponentsWriter.writeAll(); // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents
|
|
669
655
|
// otherwise, update the head of the current lane or main
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MergingMain","constructor","workspace","snapping","consumer","merge","values","mergeStrategy","abort","resolve","noSnap","message","build","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","remoteName","isDefault","scope","laneId","localLane","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","componentsResults","mapSeries","componentFromFS","modelComponent","getModelComponent","applyVersion","remoteHead","getRef","leftUnresolvedConflicts","objects","add","persist","unmergedComponents","write","mergeSnapResults","snapResolvedComponents","components","getComponentMergeStatus","otherLaneName","returnUnmerged","msg","getModelComponentIfExist","unmerged","getEntry","name","resolved","toStringWithoutVersion","repo","otherLaneHead","existingBitMapId","bitMap","getBitIdIfExist","ignoreVersion","existOnCurrentLane","isIdAvailableOnCurrentLane","componentOnLane","loadVersion","divergeData","getDivergeData","componentFromModel","currentlyUsedVersion","hasHead","loadComponent","componentModificationStatus","getComponentStatusById","modified","laneHeadIsDifferentThanCheckedOut","laneHeadLocal","localHead","Ref","from","Error","err","isDiverged","isLocalAhead","isRemoteAhead","baseSnap","commonSnapBeforeDiverge","baseComponent","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","filesStatus","unmergedComponent","remote","lane","MergeOptions","ours","files","forEach","file","pathNormalizeToLinux","relative","FileStatus","unchanged","addEntry","remoteId","changeVersion","idToLoad","theirs","componentWithDependencies","loadComponentWithDependenciesFromModel","componentMap","GeneralError","origin","COMPONENT_ORIGINS","AUTHORED","dependencies","devDependencies","shouldWritePackageJson","rootDir","packageJsonPath","path","getPath","fs","pathExists","shouldInstallNpmPackages","writePackageJson","updated","modifiedStatus","modifiedFiles","applyModifiedVersion","shouldDependenciesSaveAsComponents","shouldDependenciesSavedAsComponents","dependenciesSavedAsComponents","saveDependenciesAsComponents","manyComponentsWriter","ManyComponentsWriter","componentsWithDependencies","installNpmPackages","override","writeConfig","verbose","writeDists","writeAll","manual","unmergedPaths","f","conflict","filePath","addComponent","setHead","markVersionAsLocal","getIdsForUnresolved","results","checkoutVersion","reset","removeComponent","abortedComponents","snappedComponents","snap","legacyBitIds","BitIds","fromArray","resolvedComponents","localLaneObject","tmp","Tmp","componentsStatus","Promise","all","bitId","remoteScopeName","remoteLaneId","LaneId","remoteLanes","laneIdStr","clear","getResolvedComponents","logger","debug","r","idsStr","getParsedId","entry","unresolvedComponents","getComponents","u","hasWildcard","componentsList","ComponentsList","listComponentsByIdsWithWildcard","provider","cli","merging","register","MergeCmd","CLIAspect","WorkspaceAspect","SnappingAspect","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 fs from 'fs-extra';\nimport mapSeries from 'p-map-series';\nimport path from 'path';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport { COMPONENT_ORIGINS } from '@teambit/legacy/dist/constants';\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 Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport checkoutVersion, { 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 { DivergeData } from '@teambit/legacy/dist/scope/component-ops/diverge-data';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\n\nexport type ComponentMergeStatus = {\n componentFromFS?: Component | 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};\n\nexport class MergingMain {\n private consumer: Consumer;\n constructor(private workspace: Workspace, private snapping: SnappingMain) {\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 ): 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(consumer, values, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(consumer, 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(consumer, bitIds, mergeStrategy, noSnap, message, build);\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 ): 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 remoteName: currentLaneId.isDefault() ? null : currentLaneId.scope,\n laneId: currentLaneId,\n localLane: currentLaneObject,\n noSnap,\n snapMessage,\n build,\n });\n }\n\n /**\n * merge multiple components according to the \"allComponentsStatus\".\n */\n async mergeSnaps({\n mergeStrategy,\n allComponentsStatus,\n remoteName,\n laneId,\n localLane,\n noSnap,\n snapMessage,\n build,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n remoteName: string | null;\n laneId: LaneId;\n localLane: Lane | null;\n noSnap: boolean;\n snapMessage: string;\n build: 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(succeededComponents, async ({ componentFromFS, id, mergeResults }) => {\n const modelComponent = await consumer.scope.getModelComponent(id);\n return this.applyVersion({\n consumer,\n componentFromFS,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead: modelComponent.getRef(id.version as string) as Ref,\n remoteName: remoteName || componentFromFS?.scope || null,\n laneId,\n localLane,\n });\n });\n\n const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';\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 // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged\n // and some not. except the fact that it could by mistake tag dependent, it's a confusing state. better not snap.\n const mergeSnapResults =\n noSnap || leftUnresolvedConflicts ? null : await this.snapResolvedComponents(consumer, snapMessage, build);\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 ): 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 && unmerged.resolved === false) {\n return returnUnmerged(\n `component ${id.toStringWithoutVersion()} has conflicts that need to be resolved first, please 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 existOnCurrentLane = existingBitMapId && consumer.bitMap.isIdAvailableOnCurrentLane(existingBitMapId);\n const componentOnLane: Version = await modelComponent.loadVersion(version, consumer.scope.objects);\n if (!existingBitMapId || !existOnCurrentLane) {\n const divergeData = await getDivergeData(repo, modelComponent, otherLaneHead, null, false);\n return { componentFromFS: null, componentFromModel: componentOnLane, id, mergeResults: null, divergeData };\n }\n const currentlyUsedVersion = existingBitMapId.version;\n if (currentlyUsedVersion === version) {\n // @todo: maybe this check is not needed as we check for diverge later on\n if (localLane || modelComponent.hasHead()) {\n return returnUnmerged(`component ${id.toStringWithoutVersion()} is already merged`, true);\n }\n }\n const component = await consumer.loadComponent(existingBitMapId);\n const componentModificationStatus = await consumer.getComponentStatusById(component.id);\n if (componentModificationStatus.modified) {\n return returnUnmerged(\n `unable to merge ${id.toStringWithoutVersion()}, the component is modified, please snap/tag it first`\n );\n }\n const laneHeadIsDifferentThanCheckedOut =\n localLane && currentlyUsedVersion && modelComponent.laneHeadLocal?.toString() !== currentlyUsedVersion;\n const localHead = laneHeadIsDifferentThanCheckedOut ? Ref.from(currentlyUsedVersion) : 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 return returnUnmerged(`unable to traverse ${component.id.toString()} history. error: ${divergeData.err.message}`);\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isLocalAhead()) {\n // do nothing!\n return returnUnmerged(`component ${component.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isRemoteAhead()) {\n // just override with the model data\n return {\n componentFromFS: component,\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 ${component.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 mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n otherLabel: `${otherLaneHead.toString()} (${otherLaneName})`,\n currentComponent: component,\n currentLabel: `${currentlyUsedVersion} (local)`,\n baseComponent,\n });\n return { componentFromFS: component, id, mergeResults, divergeData };\n }\n\n private async applyVersion({\n consumer,\n componentFromFS,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead,\n remoteName,\n laneId,\n localLane,\n }: {\n consumer: Consumer;\n componentFromFS: Component | null | undefined;\n id: BitId;\n mergeResults: MergeResultsThreeWay | null | undefined;\n mergeStrategy: MergeStrategy;\n remoteHead: Ref;\n remoteName: string | null;\n laneId: LaneId;\n localLane: Lane | null;\n }): Promise<ApplyVersionResult> {\n let filesStatus = {};\n const unmergedComponent: UnmergedComponent = {\n // @ts-ignore\n id: { name: id.name, scope: id.scope },\n // @ts-ignore\n head: remoteHead,\n // @ts-ignore\n remote: remoteName,\n lane: laneId.name,\n resolved: false, // could be changed later\n };\n id = componentFromFS ? componentFromFS.id : id;\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n if (!componentFromFS) throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n componentFromFS.files.forEach((file) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n unmergedComponent.resolved = true;\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n\n return { id, filesStatus };\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 componentMap = componentFromFS && componentFromFS.componentMap;\n if (componentFromFS && !componentMap) throw new GeneralError('applyVersion: componentMap was not found');\n if (componentMap && componentMap.origin === COMPONENT_ORIGINS.AUTHORED && !id.scope) {\n componentWithDependencies.dependencies = [];\n componentWithDependencies.devDependencies = [];\n }\n const shouldWritePackageJson = async (): Promise<boolean> => {\n if (!componentMap) return true;\n const rootDir = componentMap && componentMap.rootDir;\n if (!rootDir) return false;\n const packageJsonPath = path.join(consumer.getPath(), rootDir, 'package.json');\n return fs.pathExists(packageJsonPath);\n };\n const shouldInstallNpmPackages = (): boolean => {\n if (componentMap && componentMap.origin === COMPONENT_ORIGINS.AUTHORED) return false;\n return true;\n };\n const writePackageJson = await shouldWritePackageJson();\n\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 const shouldDependenciesSaveAsComponents = await consumer.shouldDependenciesSavedAsComponents([id]);\n componentWithDependencies.component.dependenciesSavedAsComponents =\n shouldDependenciesSaveAsComponents[0].saveDependenciesAsComponents;\n\n const manyComponentsWriter = new ManyComponentsWriter({\n consumer,\n componentsWithDependencies: [componentWithDependencies],\n installNpmPackages: shouldInstallNpmPackages(),\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 writeDists: true, // @todo: do we need a flag here?\n writePackageJson,\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.resolved = false;\n unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter((f) => f.conflict).map((f) => f.filePath);\n } else {\n unmergedComponent.resolved = true;\n }\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n } else if (localLane) {\n localLane.addComponent({ id, head: remoteHead });\n } else {\n // this is main\n const modelComponent = await consumer.scope.getModelComponent(id);\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(consumer: Consumer, values: string[]): Promise<ApplyVersionResults> {\n const ids = this.getIdsForUnresolved(consumer, values);\n // @ts-ignore not clear yet what to do with other flags\n const results = await checkoutVersion(consumer, { ids, reset: true });\n ids.forEach((id) => consumer.scope.objects.unmergedComponents.removeComponent(id.name));\n await consumer.scope.objects.unmergedComponents.write();\n return { abortedComponents: results.components };\n }\n\n private async resolveMerge(\n consumer: Consumer,\n values: string[],\n snapMessage: string,\n build: boolean\n ): Promise<ApplyVersionResults> {\n const ids = this.getIdsForUnresolved(consumer, values);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const { snappedComponents } = await this.snapping.snap({\n legacyBitIds: BitIds.fromArray(ids),\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: Component[]; autoSnappedResults: AutoTagResult[] }> {\n const resolvedComponents = consumer.scope.objects.unmergedComponents.getResolvedComponents();\n logger.debug(`merge-snaps, snapResolvedComponents, total ${resolvedComponents.length.toString()} components`);\n if (!resolvedComponents.length) return null;\n const ids = BitIds.fromArray(resolvedComponents.map((r) => new BitId(r.id)));\n return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\n });\n }\n\n private getIdsForUnresolved(consumer: Consumer, idsStr?: string[]): BitId[] {\n if (idsStr && idsStr.length) {\n const bitIds = idsStr.map((id) => consumer.getParsedId(id));\n bitIds.forEach((id) => {\n const entry = consumer.scope.objects.unmergedComponents.getEntry(id.name);\n if (!entry) {\n throw new GeneralError(`unable to merge-resolve ${id.toString()}, it is not marked as unresolved`);\n }\n });\n return bitIds;\n }\n const unresolvedComponents = 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) => 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];\n static runtime = MainRuntime;\n static async provider([cli, workspace, snapping]: [CLIMain, Workspace, SnappingMain]) {\n const merging = new MergingMain(workspace, snapping);\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;;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;;AAGA;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;;AACA;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,IAAO,KAAI/M,cAAJ,EAAU+M,CAAC,CAACnL,EAAZ,CAAhC,CAAP;EACD;;EAEOzB,oBAAoB,CAACnB,QAAD,EAAqBsB,GAArB,EAA6C;IACvE,IAAI,IAAA0M,sBAAA,EAAY1M,GAAZ,CAAJ,EAAsB;MACpB,MAAM2M,cAAc,GAAG,KAAIC,yBAAJ,EAAmBlO,QAAnB,CAAvB;MACA,OAAOiO,cAAc,CAACE,+BAAf,CAA+C7M,GAA/C,CAAP;IACD;;IACD,OAAOA,GAAG,CAACkB,GAAJ,CAASI,EAAD,IAAQ5C,QAAQ,CAAC2N,WAAT,CAAqB/K,EAArB,CAAhB,CAAP;EACD;;EAKoB,aAARwL,QAAQ,CAAC,CAACC,GAAD,EAAMvO,SAAN,EAAiBC,QAAjB,CAAD,EAAiE;IACpF,MAAMuO,OAAO,GAAG,IAAI1O,WAAJ,CAAgBE,SAAhB,EAA2BC,QAA3B,CAAhB;IACAsO,GAAG,CAACE,QAAJ,CAAa,KAAIC,oBAAJ,EAAaF,OAAb,CAAb;IACA,OAAOA,OAAP;EACD;;AA1dsB;;;gCAAZ1O,W,WAmdI,E;gCAndJA,W,kBAodW,CAAC6O,gBAAD,EAAYC,oBAAZ,EAA6BC,mBAA7B,C;gCApdX/O,W,aAqdMgP,kB;;AAQnBC,wBAAA,CAAcC,UAAd,CAAyBlP,WAAzB"}
|
|
1
|
+
{"version":3,"names":["MergingMain","constructor","workspace","snapping","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","remoteName","isDefault","scope","laneId","localLane","componentWithConflict","find","component","hasConflicts","getMergeStrategyInteractive","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","componentsResults","mapSeries","componentFromFS","modelComponent","getModelComponent","applyVersion","remoteHead","getRef","leftUnresolvedConflicts","install","undefined","dedupe","updateExisting","import","objects","add","persist","unmergedComponents","write","mergeSnapResults","snapResolvedComponents","components","getComponentMergeStatus","otherLaneName","returnUnmerged","msg","getModelComponentIfExist","unmerged","getEntry","name","resolved","toStringWithoutVersion","repo","otherLaneHead","existingBitMapId","bitMap","getBitIdIfExist","ignoreVersion","componentOnLane","loadVersion","getCurrentId","idOnLane","getComponent","changeVersion","getHeadAsTagIfExist","currentId","divergeData","getDivergeData","componentFromModel","getCurrentComponent","loadComponent","getConsumerComponent","componentModificationStatus","getComponentStatusById","modified","laneHeadIsDifferentThanCheckedOut","laneHeadLocal","localHead","Ref","from","Error","err","isDiverged","isLocalAhead","isRemoteAhead","baseSnap","commonSnapBeforeDiverge","baseComponent","otherComponent","currentLaneName","toLaneId","threeWayMerge","otherLabel","currentComponent","currentLabel","filesStatus","unmergedComponent","remote","lane","MergeOptions","ours","files","forEach","file","pathNormalizeToLinux","relative","FileStatus","unchanged","addEntry","remoteId","idToLoad","theirs","componentWithDependencies","loadComponentWithDependenciesFromModel","dependencies","devDependencies","updated","modifiedStatus","modifiedFiles","applyModifiedVersion","shouldDependenciesSaveAsComponents","shouldDependenciesSavedAsComponents","dependenciesSavedAsComponents","saveDependenciesAsComponents","manyComponentsWriter","ManyComponentsWriter","componentsWithDependencies","installNpmPackages","override","writeConfig","verbose","writeDists","writePackageJson","writeAll","manual","unmergedPaths","f","conflict","filePath","addComponent","setHead","markVersionAsLocal","getIdsForUnresolved","results","checkoutVersion","reset","removeComponent","abortedComponents","snappedComponents","snap","legacyBitIds","BitIds","fromArray","resolvedComponents","localLaneObject","tmp","Tmp","componentsStatus","Promise","all","bitId","remoteScopeName","remoteLaneId","LaneId","remoteLanes","laneIdStr","clear","getResolvedComponents","logger","debug","r","idsStr","getParsedId","entry","GeneralError","unresolvedComponents","getComponents","u","hasWildcard","componentsList","ComponentsList","listComponentsByIdsWithWildcard","provider","cli","merging","register","MergeCmd","CLIAspect","WorkspaceAspect","SnappingAspect","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 Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport checkoutVersion, { 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 { DivergeData } from '@teambit/legacy/dist/scope/component-ops/diverge-data';\nimport { MergeCmd } from './merge-cmd';\nimport { MergingAspect } from './merging.aspect';\n\nexport type ComponentMergeStatus = {\n componentFromFS?: Component | 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};\n\nexport class MergingMain {\n private consumer: Consumer;\n constructor(private workspace: Workspace, private snapping: SnappingMain) {\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(consumer, values, message, build);\n } else if (abort) {\n mergeResults = await this.abortMerge(consumer, 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 remoteName: currentLaneId.isDefault() ? null : currentLaneId.scope,\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 remoteName,\n laneId,\n localLane,\n noSnap,\n snapMessage,\n build,\n skipDependencyInstallation,\n }: {\n mergeStrategy: MergeStrategy;\n allComponentsStatus: ComponentMergeStatus[];\n remoteName: string | null;\n laneId: LaneId;\n localLane: Lane | null;\n noSnap: 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(succeededComponents, async ({ componentFromFS, id, mergeResults }) => {\n const modelComponent = await consumer.scope.getModelComponent(id);\n return this.applyVersion({\n consumer,\n componentFromFS,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead: modelComponent.getRef(id.version as string) as Ref,\n remoteName: remoteName || componentFromFS?.scope || null,\n laneId,\n localLane,\n });\n });\n\n const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';\n\n if (!skipDependencyInstallation && !leftUnresolvedConflicts) {\n await this.workspace.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 // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged\n // and some not. except the fact that it could by mistake tag dependent, it's a confusing state. better not snap.\n const mergeSnapResults =\n noSnap || leftUnresolvedConflicts ? null : await this.snapResolvedComponents(consumer, snapMessage, build);\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 ): 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 && unmerged.resolved === false) {\n return returnUnmerged(\n `component ${id.toStringWithoutVersion()} has conflicts that need to be resolved first, please 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 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 { componentFromFS: null, componentFromModel: componentOnLane, id, mergeResults: null, divergeData };\n }\n\n // const currentlyUsedVersion = existingBitMapId.version;\n // if (currentlyUsedVersion === version) {\n // // @todo: maybe this check is not needed as we check for diverge later on\n // if (localLane || modelComponent.hasHead()) {\n // return returnUnmerged(`component ${id.toStringWithoutVersion()} is already merged`, true);\n // }\n // }\n const getCurrentComponent = () => {\n if (existingBitMapId) return consumer.loadComponent(existingBitMapId);\n return consumer.scope.getConsumerComponent(currentId);\n };\n const component = await getCurrentComponent();\n const componentModificationStatus = await consumer.getComponentStatusById(component.id);\n if (componentModificationStatus.modified) {\n return returnUnmerged(\n `unable to merge ${id.toStringWithoutVersion()}, the component is modified, please snap/tag it first`\n );\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 return returnUnmerged(`unable to traverse ${component.id.toString()} history. error: ${divergeData.err.message}`);\n }\n if (!divergeData.isDiverged()) {\n if (divergeData.isLocalAhead()) {\n // do nothing!\n return returnUnmerged(`component ${component.id.toString()} is ahead, nothing to merge`, true);\n }\n if (divergeData.isRemoteAhead()) {\n // just override with the model data\n return {\n componentFromFS: component,\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 ${component.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: component,\n currentLabel: `${currentId.version} (${currentLaneName})`,\n baseComponent,\n });\n return { componentFromFS: component, id, mergeResults, divergeData };\n }\n\n private async applyVersion({\n consumer,\n componentFromFS,\n id,\n mergeResults,\n mergeStrategy,\n remoteHead,\n remoteName,\n laneId,\n localLane,\n }: {\n consumer: Consumer;\n componentFromFS: Component | null | undefined;\n id: BitId;\n mergeResults: MergeResultsThreeWay | null | undefined;\n mergeStrategy: MergeStrategy;\n remoteHead: Ref;\n remoteName: string | null;\n laneId: LaneId;\n localLane: Lane | null;\n }): Promise<ApplyVersionResult> {\n let filesStatus = {};\n const unmergedComponent: UnmergedComponent = {\n // @ts-ignore\n id: { name: id.name, scope: id.scope },\n // @ts-ignore\n head: remoteHead,\n // @ts-ignore\n remote: remoteName,\n lane: laneId.name,\n resolved: false, // could be changed later\n };\n id = componentFromFS ? componentFromFS.id : id;\n if (mergeResults && mergeResults.hasConflicts && mergeStrategy === MergeOptions.ours) {\n if (!componentFromFS) throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n componentFromFS.files.forEach((file) => {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n unmergedComponent.resolved = true;\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n\n return { id, filesStatus };\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 if (!id.scope) {\n componentWithDependencies.dependencies = [];\n componentWithDependencies.devDependencies = [];\n }\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 const shouldDependenciesSaveAsComponents = await consumer.shouldDependenciesSavedAsComponents([id]);\n componentWithDependencies.component.dependenciesSavedAsComponents =\n shouldDependenciesSaveAsComponents[0].saveDependenciesAsComponents;\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 writeDists: true, // @todo: do we need a flag here?\n writePackageJson: false,\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.resolved = false;\n unmergedComponent.unmergedPaths = mergeResults.modifiedFiles.filter((f) => f.conflict).map((f) => f.filePath);\n } else {\n unmergedComponent.resolved = true;\n }\n consumer.scope.objects.unmergedComponents.addEntry(unmergedComponent);\n } else if (localLane) {\n localLane.addComponent({ id, head: remoteHead });\n } else {\n // this is main\n const modelComponent = await consumer.scope.getModelComponent(id);\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(consumer: Consumer, values: string[]): Promise<ApplyVersionResults> {\n const ids = this.getIdsForUnresolved(consumer, values);\n // @ts-ignore not clear yet what to do with other flags\n const results = await checkoutVersion(consumer, { ids, reset: true });\n ids.forEach((id) => consumer.scope.objects.unmergedComponents.removeComponent(id.name));\n await consumer.scope.objects.unmergedComponents.write();\n return { abortedComponents: results.components };\n }\n\n private async resolveMerge(\n consumer: Consumer,\n values: string[],\n snapMessage: string,\n build: boolean\n ): Promise<ApplyVersionResults> {\n const ids = this.getIdsForUnresolved(consumer, values);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const { snappedComponents } = await this.snapping.snap({\n legacyBitIds: BitIds.fromArray(ids),\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: Component[]; autoSnappedResults: AutoTagResult[] }> {\n const resolvedComponents = consumer.scope.objects.unmergedComponents.getResolvedComponents();\n logger.debug(`merge-snaps, snapResolvedComponents, total ${resolvedComponents.length.toString()} components`);\n if (!resolvedComponents.length) return null;\n const ids = BitIds.fromArray(resolvedComponents.map((r) => new BitId(r.id)));\n return this.snapping.snap({\n legacyBitIds: ids,\n build,\n message: snapMessage,\n });\n }\n\n private getIdsForUnresolved(consumer: Consumer, idsStr?: string[]): BitId[] {\n if (idsStr && idsStr.length) {\n const bitIds = idsStr.map((id) => consumer.getParsedId(id));\n bitIds.forEach((id) => {\n const entry = consumer.scope.objects.unmergedComponents.getEntry(id.name);\n if (!entry) {\n throw new GeneralError(`unable to merge-resolve ${id.toString()}, it is not marked as unresolved`);\n }\n });\n return bitIds;\n }\n const unresolvedComponents = 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) => 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];\n static runtime = MainRuntime;\n static async provider([cli, workspace, snapping]: [CLIMain, Workspace, SnappingMain]) {\n const merging = new MergingMain(workspace, snapping);\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;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;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;EAA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": "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.129"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
13
|
-
"
|
|
13
|
+
"lodash": "4.17.21",
|
|
14
14
|
"p-map-series": "2.1.0",
|
|
15
15
|
"ramda": "0.27.1",
|
|
16
16
|
"@babel/runtime": "7.12.18",
|
|
17
17
|
"core-js": "^3.0.0",
|
|
18
18
|
"@teambit/harmony": "0.3.3",
|
|
19
19
|
"@teambit/bit-error": "0.0.394",
|
|
20
|
-
"@teambit/cli": "0.0.
|
|
21
|
-
"@teambit/lane-id": "0.0.
|
|
22
|
-
"@teambit/snapping": "0.0.
|
|
23
|
-
"@teambit/workspace": "0.0.
|
|
20
|
+
"@teambit/cli": "0.0.544",
|
|
21
|
+
"@teambit/lane-id": "0.0.63",
|
|
22
|
+
"@teambit/snapping": "0.0.129",
|
|
23
|
+
"@teambit/workspace": "0.0.814"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/
|
|
26
|
+
"@types/lodash": "4.14.165",
|
|
27
27
|
"@types/mocha": "9.1.0",
|
|
28
28
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
29
29
|
"@types/jest": "^26.0.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/node": "12.20.4"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@teambit/legacy": "1.0.
|
|
35
|
+
"@teambit/legacy": "1.0.327",
|
|
36
36
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
37
37
|
"react": "^16.8.0 || ^17.0.0"
|
|
38
38
|
},
|
|
File without changes
|
|
Binary file
|