@teambit/merging 0.0.128 → 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 +3 -2
- package/dist/merge-cmd.js +20 -6
- package/dist/merge-cmd.js.map +1 -1
- package/dist/merging.main.runtime.js +42 -62
- 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-1660188657912.js → preview-1660275011373.js} +0 -0
- package/package-tar/teambit-merging-0.0.128.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, skipDependencyInstallation, }: {
|
|
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,8 +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;
|
|
23
24
|
skipDependencyInstallation?: boolean;
|
|
24
25
|
}): Promise<string>;
|
|
25
26
|
}
|
|
26
|
-
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)'], ['', 'skip-dependency-installation', 'do not install packages of the imported components'], ['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,6 +105,7 @@ class MergeCmd {
|
|
|
95
105
|
resolve = false,
|
|
96
106
|
build = false,
|
|
97
107
|
noSnap = false,
|
|
108
|
+
verbose = false,
|
|
98
109
|
message,
|
|
99
110
|
skipDependencyInstallation = false
|
|
100
111
|
}) {
|
|
@@ -127,7 +138,8 @@ class MergeCmd {
|
|
|
127
138
|
components,
|
|
128
139
|
failedComponents,
|
|
129
140
|
version,
|
|
130
|
-
mergeSnapResults
|
|
141
|
+
mergeSnapResults,
|
|
142
|
+
verbose
|
|
131
143
|
});
|
|
132
144
|
}
|
|
133
145
|
|
|
@@ -140,7 +152,8 @@ function mergeReport({
|
|
|
140
152
|
failedComponents,
|
|
141
153
|
version,
|
|
142
154
|
mergeSnapResults,
|
|
143
|
-
leftUnresolvedConflicts
|
|
155
|
+
leftUnresolvedConflicts,
|
|
156
|
+
verbose
|
|
144
157
|
}) {
|
|
145
158
|
const getSuccessOutput = () => {
|
|
146
159
|
if (!components || !components.length) return ''; // @ts-ignore version is set in case of merge command
|
|
@@ -152,7 +165,7 @@ function mergeReport({
|
|
|
152
165
|
|
|
153
166
|
const getConflictSummary = () => {
|
|
154
167
|
if (!components || !components.length || !leftUnresolvedConflicts) return '';
|
|
155
|
-
const title =
|
|
168
|
+
const title = `\nfiles with conflicts summary\n`;
|
|
156
169
|
const suggestion = `\n\nthe merge process wasn't completed due to the conflicts above. fix them manually and then run "bit install".
|
|
157
170
|
once ready, snap/tag the components to complete the merge.`;
|
|
158
171
|
return _chalk().default.underline(title) + (0, _mergeVersion().conflictSummaryReport)(components) + _chalk().default.yellow(suggestion);
|
|
@@ -185,10 +198,11 @@ once ready, snap/tag the components to complete the merge.`;
|
|
|
185
198
|
const getFailureOutput = () => {
|
|
186
199
|
if (!failedComponents || !failedComponents.length) return '';
|
|
187
200
|
const title = '\nthe merge has been canceled on the following component(s)';
|
|
188
|
-
const body = failedComponents.map(failedComponent => {
|
|
201
|
+
const body = (0, _lodash().compact)(failedComponents.map(failedComponent => {
|
|
202
|
+
if (!verbose && failedComponent.unchangedLegitimately) return null;
|
|
189
203
|
const color = failedComponent.unchangedLegitimately ? 'white' : 'red';
|
|
190
204
|
return `${_chalk().default.bold(failedComponent.id.toString())} - ${_chalk().default[color](failedComponent.failureMessage)}`;
|
|
191
|
-
}).join('\n');
|
|
205
|
+
})).join('\n');
|
|
192
206
|
return `\n${_chalk().default.underline(title)}\n${body}\n\n`;
|
|
193
207
|
};
|
|
194
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","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","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 ['', '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 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 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 });\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;EAsBvCC,WAAW,CAASC,OAAT,EAA+B;IAAA,KAAtBA,OAAsB,GAAtBA,OAAsB;IAAA,8CArBnC,mBAqBmC;IAAA,qDApB5B,+CAoB4B;IAAA,+CAnBlC,aAmBkC;IAAA,6DAlBnB;AACzB;AACA;AACA,IAAI,IAAAC,0BAAA,EAAc,aAAd,CAA6B,EAeW;IAAA,+CAdlC,EAckC;IAAA,iDAbhC,CACR,CAAC,EAAD,EAAK,MAAL,EAAa,gFAAb,CADQ,EAER,CAAC,EAAD,EAAK,QAAL,EAAe,qFAAf,CAFQ,EAGR,CAAC,EAAD,EAAK,QAAL,E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B,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() + getFailureOutput() + getSnapsOutput() + getConflictSummary();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;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A,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"}
|
|
@@ -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
|
|
|
@@ -491,10 +461,30 @@ class MergingMain {
|
|
|
491
461
|
const existingBitMapId = consumer.bitMap.getBitIdIfExist(id, {
|
|
492
462
|
ignoreVersion: true
|
|
493
463
|
});
|
|
494
|
-
const existOnCurrentLane = existingBitMapId && consumer.bitMap.isIdAvailableOnCurrentLane(existingBitMapId);
|
|
495
464
|
const componentOnLane = await modelComponent.loadVersion(version, consumer.scope.objects);
|
|
496
465
|
|
|
497
|
-
|
|
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) {
|
|
498
488
|
const divergeData = await (0, _getDivergeData().getDivergeData)(repo, modelComponent, otherLaneHead, null, false);
|
|
499
489
|
return {
|
|
500
490
|
componentFromFS: null,
|
|
@@ -503,26 +493,29 @@ class MergingMain {
|
|
|
503
493
|
mergeResults: null,
|
|
504
494
|
divergeData
|
|
505
495
|
};
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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
|
+
};
|
|
516
509
|
|
|
517
|
-
const component = await
|
|
510
|
+
const component = await getCurrentComponent();
|
|
518
511
|
const componentModificationStatus = await consumer.getComponentStatusById(component.id);
|
|
519
512
|
|
|
520
513
|
if (componentModificationStatus.modified) {
|
|
521
514
|
return returnUnmerged(`unable to merge ${id.toStringWithoutVersion()}, the component is modified, please snap/tag it first`);
|
|
522
515
|
}
|
|
523
516
|
|
|
524
|
-
const laneHeadIsDifferentThanCheckedOut = localLane &&
|
|
525
|
-
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;
|
|
526
519
|
|
|
527
520
|
if (!otherLaneHead) {
|
|
528
521
|
throw new Error(`merging: unable finding a hash for the version ${version} of ${id.toString()}`);
|
|
@@ -559,13 +552,13 @@ class MergingMain {
|
|
|
559
552
|
|
|
560
553
|
const baseComponent = await modelComponent.loadVersion(baseSnap.toString(), repo);
|
|
561
554
|
const otherComponent = await modelComponent.loadVersion(otherLaneHead.toString(), repo);
|
|
555
|
+
const currentLaneName = (localLane === null || localLane === void 0 ? void 0 : localLane.toLaneId().toString()) || 'main';
|
|
562
556
|
const mergeResults = await (0, _threeWayMerge().default)({
|
|
563
557
|
consumer,
|
|
564
558
|
otherComponent,
|
|
565
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
566
559
|
otherLabel: `${otherLaneHead.toString()} (${otherLaneName})`,
|
|
567
560
|
currentComponent: component,
|
|
568
|
-
currentLabel: `${
|
|
561
|
+
currentLabel: `${currentId.version} (${currentLaneName})`,
|
|
569
562
|
baseComponent
|
|
570
563
|
});
|
|
571
564
|
return {
|
|
@@ -621,25 +614,12 @@ class MergingMain {
|
|
|
621
614
|
const remoteId = id.changeVersion(remoteHead.toString());
|
|
622
615
|
const idToLoad = !mergeResults || mergeStrategy === _mergeVersion().MergeOptions.theirs ? remoteId : id;
|
|
623
616
|
const componentWithDependencies = await consumer.loadComponentWithDependenciesFromModel(idToLoad);
|
|
624
|
-
const componentMap = componentFromFS && componentFromFS.componentMap;
|
|
625
|
-
if (componentFromFS && !componentMap) throw new (_generalError().default)('applyVersion: componentMap was not found');
|
|
626
617
|
|
|
627
|
-
if (
|
|
618
|
+
if (!id.scope) {
|
|
628
619
|
componentWithDependencies.dependencies = [];
|
|
629
620
|
componentWithDependencies.devDependencies = [];
|
|
630
621
|
}
|
|
631
622
|
|
|
632
|
-
const shouldWritePackageJson = async () => {
|
|
633
|
-
if (!componentMap) return true;
|
|
634
|
-
const rootDir = componentMap && componentMap.rootDir;
|
|
635
|
-
if (!rootDir) return false;
|
|
636
|
-
|
|
637
|
-
const packageJsonPath = _path().default.join(consumer.getPath(), rootDir, 'package.json');
|
|
638
|
-
|
|
639
|
-
return _fsExtra().default.pathExists(packageJsonPath);
|
|
640
|
-
};
|
|
641
|
-
|
|
642
|
-
const writePackageJson = await shouldWritePackageJson();
|
|
643
623
|
const files = componentWithDependencies.component.files;
|
|
644
624
|
files.forEach(file => {
|
|
645
625
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
@@ -669,7 +649,7 @@ class MergingMain {
|
|
|
669
649
|
// @todo: do we need a flag here?
|
|
670
650
|
writeDists: true,
|
|
671
651
|
// @todo: do we need a flag here?
|
|
672
|
-
writePackageJson
|
|
652
|
+
writePackageJson: false
|
|
673
653
|
});
|
|
674
654
|
await manyComponentsWriter.writeAll(); // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents
|
|
675
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","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","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","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 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 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 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: 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,\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;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AAC3L,MAA1B,EAAkC,MAAM,KAAIoH,uBAAJ,EAAkB,oDAAlB,CAAN;IAClC,OAAOuE,oBAAoB,CAACzL,GAArB,CAA0B2L,CAAD,IAAO,KAAInN,cAAJ,EAAUmN,CAAC,CAACvL,EAAZ,CAAhC,CAAP;EACD;;EAEOzB,oBAAoB,CAACpB,QAAD,EAAqBuB,GAArB,EAA6C;IACvE,IAAI,IAAA8M,sBAAA,EAAY9M,GAAZ,CAAJ,EAAsB;MACpB,MAAM+M,cAAc,GAAG,KAAIC,yBAAJ,EAAmBvO,QAAnB,CAAvB;MACA,OAAOsO,cAAc,CAACE,+BAAf,CAA+CjN,GAA/C,CAAP;IACD;;IACD,OAAOA,GAAG,CAACkB,GAAJ,CAASI,EAAD,IAAQ7C,QAAQ,CAACgO,WAAT,CAAqBnL,EAArB,CAAhB,CAAP;EACD;;EAKoB,aAAR4L,QAAQ,CAAC,CAACC,GAAD,EAAM5O,SAAN,EAAiBC,QAAjB,CAAD,EAAiE;IACpF,MAAM4O,OAAO,GAAG,IAAI/O,WAAJ,CAAgBE,SAAhB,EAA2BC,QAA3B,CAAhB;IACA2O,GAAG,CAACE,QAAJ,CAAa,KAAIC,oBAAJ,EAAaF,OAAb,CAAb;IACA,OAAOA,OAAP;EACD;;AA3esB;;;gCAAZ/O,W,WAoeI,E;gCApeJA,W,kBAqeW,CAACkP,gBAAD,EAAYC,oBAAZ,EAA6BC,mBAA7B,C;gCAreXpP,W,aAseMqP,kB;;AAQnBC,wBAAA,CAAcC,UAAd,CAAyBvP,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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@@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/merging",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.129",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/component/merging",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "merging",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.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
|