@teambit/merge-lanes 1.0.161 → 1.0.163

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.
@@ -31,7 +31,21 @@ export declare class MergeLaneFromScopeCmd implements Command {
31
31
  report([fromLane, toLane]: [string, string], { pattern, push, keepReadme, noSquash, includeDeps, title, titleBase64, reMerge, }: Flags): Promise<string>;
32
32
  json([fromLane, toLane]: [string, string], { pattern, push, keepReadme, noSquash, includeDeps, reMerge }: Flags): Promise<{
33
33
  code: number;
34
- data: any;
34
+ data: {
35
+ mergedNow: string[];
36
+ mergedPreviously: string[];
37
+ exportedIds: string[];
38
+ unmerged: {
39
+ id: string;
40
+ reason: string;
41
+ }[];
42
+ conflicts: {
43
+ files: string[];
44
+ config?: boolean | undefined;
45
+ id: string;
46
+ }[] | undefined;
47
+ snappedIds: string[] | undefined;
48
+ };
35
49
  error?: undefined;
36
50
  } | {
37
51
  code: number;
@@ -32,7 +32,12 @@ function _bitError() {
32
32
  };
33
33
  return data;
34
34
  }
35
+ const _excluded = ["id"];
35
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
38
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
39
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
40
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
36
41
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
42
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
38
43
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -49,7 +54,7 @@ this is intended to use from the UI, which will have a button to merge an existi
49
54
  the lane must be up-to-date with the other lane, otherwise, conflicts might occur which are not handled in this command`);
50
55
  _defineProperty(this, "arguments", [{
51
56
  name: 'from-lane',
52
- description: 'lane-id to merge from'
57
+ description: `lane-id to merge from or "${_laneId().DEFAULT_LANE}"`
53
58
  }, {
54
59
  name: 'to-lane',
55
60
  description: `lane-id to merge to. default is "${_laneId().DEFAULT_LANE}"`
@@ -73,11 +78,15 @@ the lane must be up-to-date with the other lane, otherwise, conflicts might occu
73
78
  if (includeDeps && !pattern) {
74
79
  throw new (_bitError().BitError)(`"--include-deps" flag is relevant only for --pattern flag`);
75
80
  }
81
+ if (fromLane === _laneId().DEFAULT_LANE && !toLane) {
82
+ throw new (_bitError().BitError)('to merge from the main lane, specify the target lane');
83
+ }
76
84
  const titleBase64Decoded = titleBase64 ? (0, _utils().fromBase64)(titleBase64) : undefined;
77
85
  const {
78
86
  mergedNow,
79
- mergedPreviously,
80
- exportedIds
87
+ unmerged,
88
+ exportedIds,
89
+ conflicts
81
90
  } = await this.mergeLanes.mergeFromScope(fromLane, toLane || _laneId().DEFAULT_LANE, {
82
91
  push,
83
92
  keepReadme,
@@ -89,11 +98,13 @@ the lane must be up-to-date with the other lane, otherwise, conflicts might occu
89
98
  });
90
99
  const mergedTitle = _chalk().default.green(`successfully merged ${mergedNow.length} components from ${fromLane} to ${toLane || _laneId().DEFAULT_LANE}`);
91
100
  const mergedOutput = mergedNow.length ? `${mergedTitle}\n${mergedNow.join('\n')}` : '';
92
- const nonMergedTitle = _chalk().default.bold(`the following ${mergedPreviously.length} components were already merged before, they were left intact`);
93
- const nonMergedOutput = mergedPreviously.length ? `\n${nonMergedTitle}\n${mergedPreviously.join('\n')}` : '';
101
+ const nonMergedTitle = _chalk().default.bold(`the following ${unmerged.length} components were not merged`);
102
+ const nonMergedOutput = unmerged.length ? `\n${nonMergedTitle}\n${unmerged.map(u => `${u.id} (${u.reason})`).join('\n')}` : '';
103
+ const conflictsTitle = _chalk().default.bold(`the following ${conflicts?.length} components have conflicts, the merge was not completed`);
104
+ const conflictsOutput = conflicts?.length ? `\n${conflictsTitle}\n${conflicts.map(u => `${u.id} (files: ${u.files.join(', ') || 'N/A'}) (config: ${u.config})`).join('\n')}` : '';
94
105
  const exportedTitle = _chalk().default.green(`successfully exported ${exportedIds.length} components`);
95
106
  const exportedOutput = exportedIds.length ? `\n${exportedTitle}\n${exportedIds.join('\n')}` : '';
96
- return mergedOutput + nonMergedOutput + exportedOutput;
107
+ return mergedOutput + nonMergedOutput + conflictsOutput + exportedOutput;
97
108
  }
98
109
  async json([fromLane, toLane], {
99
110
  pattern,
@@ -118,7 +129,28 @@ the lane must be up-to-date with the other lane, otherwise, conflicts might occu
118
129
  });
119
130
  return {
120
131
  code: 0,
121
- data: results
132
+ data: _objectSpread(_objectSpread({}, results), {}, {
133
+ mergedNow: results.mergedNow.map(id => id.toString()),
134
+ mergedPreviously: results.mergedPreviously.map(id => id.toString()),
135
+ exportedIds: results.exportedIds.map(id => id.toString()),
136
+ unmerged: results.unmerged.map(({
137
+ id,
138
+ reason
139
+ }) => ({
140
+ id: id.toString(),
141
+ reason
142
+ })),
143
+ conflicts: results.conflicts?.map(_ref => {
144
+ let {
145
+ id
146
+ } = _ref,
147
+ rest = _objectWithoutProperties(_ref, _excluded);
148
+ return _objectSpread({
149
+ id: id.toString()
150
+ }, rest);
151
+ }),
152
+ snappedIds: results.snappedIds?.map(id => id.toString())
153
+ })
122
154
  };
123
155
  } catch (err) {
124
156
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_laneId","_utils","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","MergeLaneFromScopeCmd","constructor","mergeLanes","name","description","DEFAULT_LANE","report","fromLane","toLane","pattern","push","keepReadme","noSquash","includeDeps","title","titleBase64","reMerge","BitError","titleBase64Decoded","fromBase64","undefined","mergedNow","mergedPreviously","exportedIds","mergeFromScope","snapMessage","mergedTitle","chalk","green","length","mergedOutput","join","nonMergedTitle","bold","nonMergedOutput","exportedTitle","exportedOutput","json","results","code","err","error","message","exports"],"sources":["merge-lane-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { fromBase64 } from '@teambit/legacy/dist/utils';\nimport { BitError } from '@teambit/bit-error';\nimport { MergeLanesMain } from './merge-lanes.main.runtime';\n\ntype Flags = {\n pattern?: string;\n push?: boolean;\n keepReadme?: boolean;\n noSquash: boolean;\n includeDeps?: boolean;\n title?: string;\n titleBase64?: string;\n reMerge?: boolean;\n};\n\n/**\n * private command. the underscore prefix is intended.\n */\nexport class MergeLaneFromScopeCmd implements Command {\n name = '_merge-lane <from-lane> [to-lane]';\n description = `merge a remote lane into another lane or main via a bare-scope (not workspace)`;\n extendedDescription = `to merge from a workspace, use \"bit lane merge\" command.\nthis is intended to use from the UI, which will have a button to merge an existing lane.\nthe lane must be up-to-date with the other lane, otherwise, conflicts might occur which are not handled in this command`;\n arguments = [\n {\n name: 'from-lane',\n description: 'lane-id to merge from',\n },\n {\n name: 'to-lane',\n description: `lane-id to merge to. default is \"${DEFAULT_LANE}\"`,\n },\n ];\n alias = '';\n options = [\n ['', 'pattern <string>', 'partially merge the lane with the specified component-pattern'],\n [\n '',\n 'title <string>',\n 'if provided, it replaces the original message with this title and append squashed snaps messages',\n ],\n ['', 'title-base64 <string>', 'same as --title flag but the title is base64 encoded'],\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['', 'keep-readme', 'skip deleting the lane readme component after merging'],\n ['', 'no-squash', 'relevant for merging lanes into main, which by default squash.'],\n ['', 'include-deps', 'relevant for \"--pattern\". merge also dependencies of the given components'],\n ['', 're-merge', 'helpful when last merge failed during export. do not skip components that seemed to be merged'],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n remoteOp = true;\n\n constructor(private mergeLanes: MergeLanesMain) {}\n\n async report(\n [fromLane, toLane]: [string, string],\n {\n pattern,\n push = false,\n keepReadme = false,\n noSquash = false,\n includeDeps = false,\n title,\n titleBase64,\n reMerge,\n }: Flags\n ): Promise<string> {\n if (includeDeps && !pattern) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --pattern flag`);\n }\n\n const titleBase64Decoded = titleBase64 ? fromBase64(titleBase64) : undefined;\n\n const { mergedNow, mergedPreviously, exportedIds } = await this.mergeLanes.mergeFromScope(\n fromLane,\n toLane || DEFAULT_LANE,\n {\n push,\n keepReadme,\n noSquash,\n pattern,\n includeDeps,\n snapMessage: titleBase64Decoded || title,\n reMerge,\n }\n );\n\n const mergedTitle = chalk.green(\n `successfully merged ${mergedNow.length} components from ${fromLane} to ${toLane || DEFAULT_LANE}`\n );\n const mergedOutput = mergedNow.length ? `${mergedTitle}\\n${mergedNow.join('\\n')}` : '';\n\n const nonMergedTitle = chalk.bold(\n `the following ${mergedPreviously.length} components were already merged before, they were left intact`\n );\n const nonMergedOutput = mergedPreviously.length ? `\\n${nonMergedTitle}\\n${mergedPreviously.join('\\n')}` : '';\n\n const exportedTitle = chalk.green(`successfully exported ${exportedIds.length} components`);\n const exportedOutput = exportedIds.length ? `\\n${exportedTitle}\\n${exportedIds.join('\\n')}` : '';\n\n return mergedOutput + nonMergedOutput + exportedOutput;\n }\n async json(\n [fromLane, toLane]: [string, string],\n { pattern, push = false, keepReadme = false, noSquash = false, includeDeps = false, reMerge }: Flags\n ) {\n if (includeDeps && !pattern) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --pattern flag`);\n }\n let results: any;\n try {\n results = await this.mergeLanes.mergeFromScope(fromLane, toLane || DEFAULT_LANE, {\n push,\n keepReadme,\n noSquash,\n pattern,\n includeDeps,\n reMerge,\n });\n return {\n code: 0,\n data: results,\n };\n } catch (err: any) {\n return {\n code: 1,\n error: err.message,\n };\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OA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,CAACsB,cAAc,CAACjB,QAAQ,EAAEC,MAAM,IAAIH,sBAAY,EAAE;QAC/EK,IAAI;QACJC,UAAU;QACVC,QAAQ;QACRH,OAAO;QACPI,WAAW;QACXG;MACF,CAAC,CAAC;MACF,OAAO;QACLuB,IAAI,EAAE,CAAC;QACPpE,IAAI,EAAEmE;MACR,CAAC;IACH,CAAC,CAAC,OAAOE,GAAQ,EAAE;MACjB,OAAO;QACLD,IAAI,EAAE,CAAC;QACPE,KAAK,EAAED,GAAG,CAACE;MACb,CAAC;IACH;EACF;AACF;AAACC,OAAA,CAAA3C,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_laneId","_utils","_bitError","_excluded","obj","__esModule","default","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","sourceKeys","keys","ownKeys","e","r","t","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","MergeLaneFromScopeCmd","constructor","mergeLanes","name","description","DEFAULT_LANE","report","fromLane","toLane","pattern","keepReadme","noSquash","includeDeps","title","titleBase64","reMerge","BitError","titleBase64Decoded","fromBase64","undefined","mergedNow","unmerged","exportedIds","conflicts","mergeFromScope","snapMessage","mergedTitle","chalk","green","mergedOutput","join","nonMergedTitle","bold","nonMergedOutput","map","u","id","reason","conflictsTitle","conflictsOutput","files","config","exportedTitle","exportedOutput","json","results","code","toString","mergedPreviously","_ref","rest","snappedIds","err","error","message","exports"],"sources":["merge-lane-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { DEFAULT_LANE } from '@teambit/lane-id';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { fromBase64 } from '@teambit/legacy/dist/utils';\nimport { BitError } from '@teambit/bit-error';\nimport { MergeFromScopeResult, MergeLanesMain } from './merge-lanes.main.runtime';\n\ntype Flags = {\n pattern?: string;\n push?: boolean;\n keepReadme?: boolean;\n noSquash: boolean;\n includeDeps?: boolean;\n title?: string;\n titleBase64?: string;\n reMerge?: boolean;\n};\n\n/**\n * private command. the underscore prefix is intended.\n */\nexport class MergeLaneFromScopeCmd implements Command {\n name = '_merge-lane <from-lane> [to-lane]';\n description = `merge a remote lane into another lane or main via a bare-scope (not workspace)`;\n extendedDescription = `to merge from a workspace, use \"bit lane merge\" command.\nthis is intended to use from the UI, which will have a button to merge an existing lane.\nthe lane must be up-to-date with the other lane, otherwise, conflicts might occur which are not handled in this command`;\n arguments = [\n {\n name: 'from-lane',\n description: `lane-id to merge from or \"${DEFAULT_LANE}\"`,\n },\n {\n name: 'to-lane',\n description: `lane-id to merge to. default is \"${DEFAULT_LANE}\"`,\n },\n ];\n alias = '';\n options = [\n ['', 'pattern <string>', 'partially merge the lane with the specified component-pattern'],\n [\n '',\n 'title <string>',\n 'if provided, it replaces the original message with this title and append squashed snaps messages',\n ],\n ['', 'title-base64 <string>', 'same as --title flag but the title is base64 encoded'],\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['', 'keep-readme', 'skip deleting the lane readme component after merging'],\n ['', 'no-squash', 'relevant for merging lanes into main, which by default squash.'],\n ['', 'include-deps', 'relevant for \"--pattern\". merge also dependencies of the given components'],\n ['', 're-merge', 'helpful when last merge failed during export. do not skip components that seemed to be merged'],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n remoteOp = true;\n\n constructor(private mergeLanes: MergeLanesMain) {}\n\n async report(\n [fromLane, toLane]: [string, string],\n {\n pattern,\n push = false,\n keepReadme = false,\n noSquash = false,\n includeDeps = false,\n title,\n titleBase64,\n reMerge,\n }: Flags\n ): Promise<string> {\n if (includeDeps && !pattern) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --pattern flag`);\n }\n if (fromLane === DEFAULT_LANE && !toLane) {\n throw new BitError('to merge from the main lane, specify the target lane');\n }\n\n const titleBase64Decoded = titleBase64 ? fromBase64(titleBase64) : undefined;\n\n const { mergedNow, unmerged, exportedIds, conflicts } = await this.mergeLanes.mergeFromScope(\n fromLane,\n toLane || DEFAULT_LANE,\n {\n push,\n keepReadme,\n noSquash,\n pattern,\n includeDeps,\n snapMessage: titleBase64Decoded || title,\n reMerge,\n }\n );\n\n const mergedTitle = chalk.green(\n `successfully merged ${mergedNow.length} components from ${fromLane} to ${toLane || DEFAULT_LANE}`\n );\n const mergedOutput = mergedNow.length ? `${mergedTitle}\\n${mergedNow.join('\\n')}` : '';\n\n const nonMergedTitle = chalk.bold(`the following ${unmerged.length} components were not merged`);\n const nonMergedOutput = unmerged.length\n ? `\\n${nonMergedTitle}\\n${unmerged.map((u) => `${u.id} (${u.reason})`).join('\\n')}`\n : '';\n\n const conflictsTitle = chalk.bold(\n `the following ${conflicts?.length} components have conflicts, the merge was not completed`\n );\n const conflictsOutput = conflicts?.length\n ? `\\n${conflictsTitle}\\n${conflicts\n .map((u) => `${u.id} (files: ${u.files.join(', ') || 'N/A'}) (config: ${u.config})`)\n .join('\\n')}`\n : '';\n\n const exportedTitle = chalk.green(`successfully exported ${exportedIds.length} components`);\n const exportedOutput = exportedIds.length ? `\\n${exportedTitle}\\n${exportedIds.join('\\n')}` : '';\n\n return mergedOutput + nonMergedOutput + conflictsOutput + exportedOutput;\n }\n async json(\n [fromLane, toLane]: [string, string],\n { pattern, push = false, keepReadme = false, noSquash = false, includeDeps = false, reMerge }: Flags\n ) {\n if (includeDeps && !pattern) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --pattern flag`);\n }\n let results: MergeFromScopeResult;\n try {\n results = await this.mergeLanes.mergeFromScope(fromLane, toLane || DEFAULT_LANE, {\n push,\n keepReadme,\n noSquash,\n pattern,\n includeDeps,\n reMerge,\n });\n return {\n code: 0,\n data: {\n ...results,\n mergedNow: results.mergedNow.map((id) => id.toString()),\n mergedPreviously: results.mergedPreviously.map((id) => id.toString()),\n exportedIds: results.exportedIds.map((id) => id.toString()),\n unmerged: results.unmerged.map(({ id, reason }) => ({ id: id.toString(), reason })),\n conflicts: results.conflicts?.map(({ id, ...rest }) => ({ id: id.toString(), ...rest })),\n snappedIds: results.snappedIds?.map((id) => id.toString()),\n },\n };\n } catch (err: any) {\n return {\n code: 1,\n error: err.message,\n };\n }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,MAAAM,SAAA;AAAA,SAAAL,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,MAAA,EAAAC,QAAA,QAAAD,MAAA,yBAAAE,MAAA,GAAAC,6BAAA,CAAAH,MAAA,EAAAC,QAAA,OAAAG,GAAA,EAAAC,CAAA,MAAAC,MAAA,CAAAC,qBAAA,QAAAC,gBAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAP,MAAA,QAAAK,CAAA,MAAAA,CAAA,GAAAG,gBAAA,CAAAC,MAAA,EAAAJ,CAAA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W,QAAQ,CAAC,CAAC,CAAC;UACvDC,gBAAgB,EAAEH,OAAO,CAACG,gBAAgB,CAACd,GAAG,CAAEE,EAAE,IAAKA,EAAE,CAACW,QAAQ,CAAC,CAAC,CAAC;UACrEzB,WAAW,EAAEuB,OAAO,CAACvB,WAAW,CAACY,GAAG,CAAEE,EAAE,IAAKA,EAAE,CAACW,QAAQ,CAAC,CAAC,CAAC;UAC3D1B,QAAQ,EAAEwB,OAAO,CAACxB,QAAQ,CAACa,GAAG,CAAC,CAAC;YAAEE,EAAE;YAAEC;UAAO,CAAC,MAAM;YAAED,EAAE,EAAEA,EAAE,CAACW,QAAQ,CAAC,CAAC;YAAEV;UAAO,CAAC,CAAC,CAAC;UACnFd,SAAS,EAAEsB,OAAO,CAACtB,SAAS,EAAEW,GAAG,CAACe,IAAA;YAAA,IAAC;gBAAEb;cAAY,CAAC,GAAAa,IAAA;cAANC,IAAI,GAAA9F,wBAAA,CAAA6F,IAAA,EAAAjG,SAAA;YAAA,OAAA+B,aAAA;cAAUqD,EAAE,EAAEA,EAAE,CAACW,QAAQ,CAAC;YAAC,GAAKG,IAAI;UAAA,CAAG,CAAC;UACxFC,UAAU,EAAEN,OAAO,CAACM,UAAU,EAAEjB,GAAG,CAAEE,EAAE,IAAKA,EAAE,CAACW,QAAQ,CAAC,CAAC;QAAC;MAE9D,CAAC;IACH,CAAC,CAAC,OAAOK,GAAQ,EAAE;MACjB,OAAO;QACLN,IAAI,EAAE,CAAC;QACPO,KAAK,EAAED,GAAG,CAACE;MACb,CAAC;IACH;EACF;AACF;AAACC,OAAA,CAAAvD,qBAAA,GAAAA,qBAAA"}
@@ -129,7 +129,7 @@ Component pattern format: ${_constants().COMPONENT_PATTERN_HELP}`
129
129
  mergeResults,
130
130
  deleteResults,
131
131
  configMergeResults
132
- } = await this.mergeLanes.mergeLane(name, {
132
+ } = await this.mergeLanes.mergeLaneByCLI(name, {
133
133
  build,
134
134
  // @ts-ignore
135
135
  mergeStrategy,
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_merging","_constants","_bitError","_remove","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","MergeLaneCmd","constructor","mergeLanes","globalConfig","name","description","COMPONENT_PATTERN_HELP","report","pattern","ours","theirs","manual","autoMergeResolve","build","workspace","existingOnWorkspaceOnly","squash","noSnap","tag","message","snapMessage","keepReadme","noSquash","skipDependencyInstallation","skipFetch","includeDeps","resolveUnrelated","ignoreConfigChanges","verbose","excludeNonLaneComps","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","BitError","mergeStrategy","getResolveUnrelated","undefined","Error","mergeResults","deleteResults","configMergeResults","mergeLane","mergeResult","mergeReport","deleteOutput","localResult","removeTemplate","remoteResult","map","item","readmeResult","chalk","yellow","exports"],"sources":["merge-lane.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { mergeReport } from '@teambit/merging';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { COMPONENT_PATTERN_HELP, CFG_FORCE_LOCAL_BUILD } from '@teambit/legacy/dist/constants';\nimport { BitError } from '@teambit/bit-error';\nimport { removeTemplate } from '@teambit/remove';\nimport { MergeLanesMain } from './merge-lanes.main.runtime';\n\nexport class MergeLaneCmd implements Command {\n name = 'merge <lane> [pattern]';\n description = `merge a local or a remote lane to the current lane`;\n extendedDescription = `by default, the provided lane will be fetched from the remote before merging.\nto merge the lane from the local scope without updating it first, use \"--skip-fetch\" flag.\n\nwhen the current and merge candidate lanes are diverged in history and the files could be merged with no conflicts,\nthese components will be snap-merged to complete the merge. use \"no-snap\" to opt-out, or \"tag\" to tag instead.\n\nin case a component in both ends don't share history (no snap is found in common), the merge will require \"--resolve-unrelated\" flag.\nthis flag keeps the history of one end and saves a reference to the other end. the decision of which end to keep is determined by the following:\n1. if the component exists on main, then the history linked to main will be kept.\nin this case, the strategy of \"--resolve-unrelated\" only determines which source-code to keep. it's not about the history.\n2. if the component doesn't exist on main, then by default, the history of the current lane will be kept.\nunless \"--resolve-unrelated\" is set to \"theirs\", in which case the history of the other lane will be kept.\n2. a. an edge case: if the component is deleted on the current lane, the strategy will always be \"theirs\".\nso then the history (and the source-code) of the other lane will be kept.\n`;\n arguments = [\n {\n name: 'lane',\n description: 'lane-name or full lane-id (if remote) to merge to the current lane',\n },\n {\n name: 'pattern',\n description: `partially merge the lane - only components that match the specified component-pattern\nComponent pattern format: ${COMPONENT_PATTERN_HELP}`,\n },\n ];\n alias = '';\n options = [\n [\n '',\n 'manual',\n 'same as \"--auto-merge-resolve manual\". in case of merge conflict, write the files with the conflict markers',\n ],\n [\n '',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of a merge conflict, resolve according to the provided strategy: [ours, theirs, manual]',\n ],\n ['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep local modifications'],\n ['', 'theirs', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override local with incoming changes'],\n ['', 'workspace', 'merge only lane components that are in the current workspace'],\n ['', 'no-snap', 'do not auto snap after merge completed without conflicts'],\n ['', 'tag', 'auto-tag all lane components after merging into main (or tag-merge in case of snap-merge)'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['m', 'message <message>', 'override the default message for the auto snap'],\n ['', 'keep-readme', 'skip deleting the lane readme component after merging'],\n ['', 'no-squash', 'relevant for merging lanes into main, which by default squashes all lane snaps'],\n [\n '',\n 'squash',\n 'EXPERIMENTAL. relevant for merging a lane into another non-main lane, which by default does not squash',\n ],\n [\n '',\n 'ignore-config-changes',\n 'allow merging when components are modified due to config changes (such as dependencies) only and not files',\n ],\n ['', 'verbose', 'show details of components that were not merged successfully'],\n ['x', 'skip-dependency-installation', 'do not install dependencies of the imported components'],\n ['', 'skip-fetch', 'use the local state of target-lane if exits locally, without updating it from the remote'],\n [\n '',\n 'include-deps',\n 'relevant for \"--pattern\" and \"--workspace\". merge also dependencies of the specified components',\n ],\n [\n '',\n 'resolve-unrelated [merge-strategy]',\n 'relevant when a component on a lane and the component on main have nothing in common. merge-strategy can be \"ours\" (default) or \"theirs\"',\n ],\n [\n '',\n 'include-non-lane-comps',\n 'DEPRECATED (this is now the default). when merging main, include workspace components that are not on the lane (by default only lane components are merged)',\n ],\n [\n '',\n 'exclude-non-lane-comps',\n 'when merging main into a lane, exclude workspace components that are not on the lane (by default all workspace components are merged)',\n ],\n ] as CommandOptions;\n loader = true;\n private = true;\n remoteOp = true;\n\n constructor(private mergeLanes: MergeLanesMain, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [name, pattern]: [string, string],\n {\n ours,\n theirs,\n manual,\n autoMergeResolve,\n build,\n workspace: existingOnWorkspaceOnly = false,\n squash = false,\n noSnap = false,\n tag = false,\n message: snapMessage = '',\n keepReadme = false,\n noSquash = false,\n skipDependencyInstallation = false,\n skipFetch = false,\n includeDeps = false,\n resolveUnrelated,\n ignoreConfigChanges,\n verbose = false,\n excludeNonLaneComps = false,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n autoMergeResolve?: string;\n workspace?: boolean;\n build?: boolean;\n noSnap: boolean;\n tag: boolean;\n message: string;\n keepReadme?: boolean;\n squash?: boolean;\n noSquash: boolean;\n skipDependencyInstallation?: boolean;\n skipFetch: boolean;\n includeDeps?: boolean;\n resolveUnrelated?: string | boolean;\n ignoreConfigChanges?: boolean;\n verbose?: boolean;\n excludeNonLaneComps?: boolean;\n }\n ): Promise<string> {\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n if (ours || theirs) {\n throw new BitError(\n 'the \"--ours\" and \"--theirs\" flags are deprecated. use \"--auto-merge-resolve\" instead. see \"bit lane merge --help\" for more information'\n );\n }\n if (\n autoMergeResolve &&\n autoMergeResolve !== 'ours' &&\n autoMergeResolve !== 'theirs' &&\n autoMergeResolve !== 'manual'\n ) {\n throw new BitError('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');\n }\n if (manual) autoMergeResolve = 'manual';\n const mergeStrategy = autoMergeResolve;\n if (noSnap && snapMessage) throw new BitError('unable to use \"no-snap\" and \"message\" flags together');\n if (includeDeps && !pattern && !existingOnWorkspaceOnly) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --workspace and --pattern flags`);\n }\n const getResolveUnrelated = (): MergeStrategy | undefined => {\n if (!resolveUnrelated) return undefined;\n if (typeof resolveUnrelated === 'boolean') return 'ours';\n if (resolveUnrelated !== 'ours' && resolveUnrelated !== 'theirs' && resolveUnrelated !== 'manual') {\n throw new Error('--resolve-unrelated must be one of the following: [ours, theirs, manual]');\n }\n return resolveUnrelated;\n };\n if (resolveUnrelated && typeof resolveUnrelated === 'boolean') {\n resolveUnrelated = 'ours';\n }\n const { mergeResults, deleteResults, configMergeResults } = await this.mergeLanes.mergeLane(name, {\n build,\n // @ts-ignore\n mergeStrategy,\n ours,\n theirs,\n existingOnWorkspaceOnly,\n noSnap,\n snapMessage,\n keepReadme,\n squash,\n noSquash,\n tag,\n pattern,\n skipDependencyInstallation,\n skipFetch,\n resolveUnrelated: getResolveUnrelated(),\n ignoreConfigChanges,\n includeDeps,\n excludeNonLaneComps,\n });\n\n const mergeResult = mergeReport({ ...mergeResults, configMergeResults, verbose });\n const deleteOutput = `\\n${deleteResults.localResult ? removeTemplate(deleteResults.localResult, false) : ''}${(\n deleteResults.remoteResult || []\n ).map((item) => removeTemplate(item, true))}${\n (deleteResults.readmeResult && chalk.yellow(deleteResults.readmeResult)) || ''\n }\\n`;\n return mergeResult + deleteOutput;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC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AAAA,aAAA,KAAM2D,YAAY;MAAEE,kBAAkB;MAAEZ;IAAO,EAAE,CAAC;IACjF,MAAMgB,YAAY,GAAI,KAAIL,aAAa,CAACM,WAAW,GAAG,IAAAC,wBAAc,EAACP,aAAa,CAACM,WAAW,EAAE,KAAK,CAAC,GAAG,EAAG,GAAE,CAC5GN,aAAa,CAACQ,YAAY,IAAI,EAAE,EAChCC,GAAG,CAAEC,IAAI,IAAK,IAAAH,wBAAc,EAACG,IAAI,EAAE,IAAI,CAAC,CAAE,GACzCV,aAAa,CAACW,YAAY,IAAIC,gBAAK,CAACC,MAAM,CAACb,aAAa,CAACW,YAAY,CAAC,IAAK,EAC7E,IAAG;IACJ,OAAOR,WAAW,GAAGE,YAAY;EACnC;AACF;AAACS,OAAA,CAAArD,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_merging","_constants","_bitError","_remove","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","MergeLaneCmd","constructor","mergeLanes","globalConfig","name","description","COMPONENT_PATTERN_HELP","report","pattern","ours","theirs","manual","autoMergeResolve","build","workspace","existingOnWorkspaceOnly","squash","noSnap","tag","message","snapMessage","keepReadme","noSquash","skipDependencyInstallation","skipFetch","includeDeps","resolveUnrelated","ignoreConfigChanges","verbose","excludeNonLaneComps","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","BitError","mergeStrategy","getResolveUnrelated","undefined","Error","mergeResults","deleteResults","configMergeResults","mergeLaneByCLI","mergeResult","mergeReport","deleteOutput","localResult","removeTemplate","remoteResult","map","item","readmeResult","chalk","yellow","exports"],"sources":["merge-lane.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { mergeReport } from '@teambit/merging';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { COMPONENT_PATTERN_HELP, CFG_FORCE_LOCAL_BUILD } from '@teambit/legacy/dist/constants';\nimport { BitError } from '@teambit/bit-error';\nimport { removeTemplate } from '@teambit/remove';\nimport { MergeLanesMain } from './merge-lanes.main.runtime';\n\nexport class MergeLaneCmd implements Command {\n name = 'merge <lane> [pattern]';\n description = `merge a local or a remote lane to the current lane`;\n extendedDescription = `by default, the provided lane will be fetched from the remote before merging.\nto merge the lane from the local scope without updating it first, use \"--skip-fetch\" flag.\n\nwhen the current and merge candidate lanes are diverged in history and the files could be merged with no conflicts,\nthese components will be snap-merged to complete the merge. use \"no-snap\" to opt-out, or \"tag\" to tag instead.\n\nin case a component in both ends don't share history (no snap is found in common), the merge will require \"--resolve-unrelated\" flag.\nthis flag keeps the history of one end and saves a reference to the other end. the decision of which end to keep is determined by the following:\n1. if the component exists on main, then the history linked to main will be kept.\nin this case, the strategy of \"--resolve-unrelated\" only determines which source-code to keep. it's not about the history.\n2. if the component doesn't exist on main, then by default, the history of the current lane will be kept.\nunless \"--resolve-unrelated\" is set to \"theirs\", in which case the history of the other lane will be kept.\n2. a. an edge case: if the component is deleted on the current lane, the strategy will always be \"theirs\".\nso then the history (and the source-code) of the other lane will be kept.\n`;\n arguments = [\n {\n name: 'lane',\n description: 'lane-name or full lane-id (if remote) to merge to the current lane',\n },\n {\n name: 'pattern',\n description: `partially merge the lane - only components that match the specified component-pattern\nComponent pattern format: ${COMPONENT_PATTERN_HELP}`,\n },\n ];\n alias = '';\n options = [\n [\n '',\n 'manual',\n 'same as \"--auto-merge-resolve manual\". in case of merge conflict, write the files with the conflict markers',\n ],\n [\n '',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of a merge conflict, resolve according to the provided strategy: [ours, theirs, manual]',\n ],\n ['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep local modifications'],\n ['', 'theirs', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override local with incoming changes'],\n ['', 'workspace', 'merge only lane components that are in the current workspace'],\n ['', 'no-snap', 'do not auto snap after merge completed without conflicts'],\n ['', 'tag', 'auto-tag all lane components after merging into main (or tag-merge in case of snap-merge)'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['m', 'message <message>', 'override the default message for the auto snap'],\n ['', 'keep-readme', 'skip deleting the lane readme component after merging'],\n ['', 'no-squash', 'relevant for merging lanes into main, which by default squashes all lane snaps'],\n [\n '',\n 'squash',\n 'EXPERIMENTAL. relevant for merging a lane into another non-main lane, which by default does not squash',\n ],\n [\n '',\n 'ignore-config-changes',\n 'allow merging when components are modified due to config changes (such as dependencies) only and not files',\n ],\n ['', 'verbose', 'show details of components that were not merged successfully'],\n ['x', 'skip-dependency-installation', 'do not install dependencies of the imported components'],\n ['', 'skip-fetch', 'use the local state of target-lane if exits locally, without updating it from the remote'],\n [\n '',\n 'include-deps',\n 'relevant for \"--pattern\" and \"--workspace\". merge also dependencies of the specified components',\n ],\n [\n '',\n 'resolve-unrelated [merge-strategy]',\n 'relevant when a component on a lane and the component on main have nothing in common. merge-strategy can be \"ours\" (default) or \"theirs\"',\n ],\n [\n '',\n 'include-non-lane-comps',\n 'DEPRECATED (this is now the default). when merging main, include workspace components that are not on the lane (by default only lane components are merged)',\n ],\n [\n '',\n 'exclude-non-lane-comps',\n 'when merging main into a lane, exclude workspace components that are not on the lane (by default all workspace components are merged)',\n ],\n ] as CommandOptions;\n loader = true;\n private = true;\n remoteOp = true;\n\n constructor(private mergeLanes: MergeLanesMain, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [name, pattern]: [string, string],\n {\n ours,\n theirs,\n manual,\n autoMergeResolve,\n build,\n workspace: existingOnWorkspaceOnly = false,\n squash = false,\n noSnap = false,\n tag = false,\n message: snapMessage = '',\n keepReadme = false,\n noSquash = false,\n skipDependencyInstallation = false,\n skipFetch = false,\n includeDeps = false,\n resolveUnrelated,\n ignoreConfigChanges,\n verbose = false,\n excludeNonLaneComps = false,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n autoMergeResolve?: string;\n workspace?: boolean;\n build?: boolean;\n noSnap: boolean;\n tag: boolean;\n message: string;\n keepReadme?: boolean;\n squash?: boolean;\n noSquash: boolean;\n skipDependencyInstallation?: boolean;\n skipFetch: boolean;\n includeDeps?: boolean;\n resolveUnrelated?: string | boolean;\n ignoreConfigChanges?: boolean;\n verbose?: boolean;\n excludeNonLaneComps?: boolean;\n }\n ): Promise<string> {\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n if (ours || theirs) {\n throw new BitError(\n 'the \"--ours\" and \"--theirs\" flags are deprecated. use \"--auto-merge-resolve\" instead. see \"bit lane merge --help\" for more information'\n );\n }\n if (\n autoMergeResolve &&\n autoMergeResolve !== 'ours' &&\n autoMergeResolve !== 'theirs' &&\n autoMergeResolve !== 'manual'\n ) {\n throw new BitError('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');\n }\n if (manual) autoMergeResolve = 'manual';\n const mergeStrategy = autoMergeResolve;\n if (noSnap && snapMessage) throw new BitError('unable to use \"no-snap\" and \"message\" flags together');\n if (includeDeps && !pattern && !existingOnWorkspaceOnly) {\n throw new BitError(`\"--include-deps\" flag is relevant only for --workspace and --pattern flags`);\n }\n const getResolveUnrelated = (): MergeStrategy | undefined => {\n if (!resolveUnrelated) return undefined;\n if (typeof resolveUnrelated === 'boolean') return 'ours';\n if (resolveUnrelated !== 'ours' && resolveUnrelated !== 'theirs' && resolveUnrelated !== 'manual') {\n throw new Error('--resolve-unrelated must be one of the following: [ours, theirs, manual]');\n }\n return resolveUnrelated;\n };\n if (resolveUnrelated && typeof resolveUnrelated === 'boolean') {\n resolveUnrelated = 'ours';\n }\n const { mergeResults, deleteResults, configMergeResults } = await this.mergeLanes.mergeLaneByCLI(name, {\n build,\n // @ts-ignore\n mergeStrategy,\n ours,\n theirs,\n existingOnWorkspaceOnly,\n noSnap,\n snapMessage,\n keepReadme,\n squash,\n noSquash,\n tag,\n pattern,\n skipDependencyInstallation,\n skipFetch,\n resolveUnrelated: getResolveUnrelated(),\n ignoreConfigChanges,\n includeDeps,\n excludeNonLaneComps,\n });\n\n const mergeResult = mergeReport({ ...mergeResults, configMergeResults, verbose });\n const deleteOutput = `\\n${deleteResults.localResult ? removeTemplate(deleteResults.localResult, false) : ''}${(\n deleteResults.remoteResult || []\n ).map((item) => removeTemplate(item, true))}${\n (deleteResults.readmeResult && chalk.yellow(deleteResults.readmeResult)) || ''\n }\\n`;\n return mergeResult + deleteOutput;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiD,SAAAC,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,O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gB,KAAK,SAAS,EAAE;MAC7DA,gBAAgB,GAAG,MAAM;IAC3B;IACA,MAAM;MAAEY,YAAY;MAAEC,aAAa;MAAEC;IAAmB,CAAC,GAAG,MAAM,IAAI,CAACtC,UAAU,CAACuC,cAAc,CAACrC,IAAI,EAAE;MACrGS,KAAK;MACL;MACAqB,aAAa;MACbzB,IAAI;MACJC,MAAM;MACNK,uBAAuB;MACvBE,MAAM;MACNG,WAAW;MACXC,UAAU;MACVL,MAAM;MACNM,QAAQ;MACRJ,GAAG;MACHV,OAAO;MACPe,0BAA0B;MAC1BC,SAAS;MACTE,gBAAgB,EAAES,mBAAmB,CAAC,CAAC;MACvCR,mBAAmB;MACnBF,WAAW;MACXI;IACF,CAAC,CAAC;IAEF,MAAMa,WAAW,GAAG,IAAAC,sBAAW,EAAAhE,aAAA,CAAAA,aAAA,KAAM2D,YAAY;MAAEE,kBAAkB;MAAEZ;IAAO,EAAE,CAAC;IACjF,MAAMgB,YAAY,GAAI,KAAIL,aAAa,CAACM,WAAW,GAAG,IAAAC,wBAAc,EAACP,aAAa,CAACM,WAAW,EAAE,KAAK,CAAC,GAAG,EAAG,GAAE,CAC5GN,aAAa,CAACQ,YAAY,IAAI,EAAE,EAChCC,GAAG,CAAEC,IAAI,IAAK,IAAAH,wBAAc,EAACG,IAAI,EAAE,IAAI,CAAC,CAAE,GACzCV,aAAa,CAACW,YAAY,IAAIC,gBAAK,CAACC,MAAM,CAACb,aAAa,CAACW,YAAY,CAAC,IAAK,EAC7E,IAAG;IACJ,OAAOR,WAAW,GAAGE,YAAY;EACnC;AACF;AAACS,OAAA,CAAArD,YAAA,GAAAA,YAAA"}
@@ -3,8 +3,10 @@ import { ImporterMain } from '@teambit/importer';
3
3
  import { LanesMain } from '@teambit/lanes';
4
4
  import { MergingMain, ApplyVersionResults } from '@teambit/merging';
5
5
  import { Workspace } from '@teambit/workspace';
6
+ import { ComponentID } from '@teambit/component-id';
6
7
  import { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
7
8
  import { ScopeMain } from '@teambit/scope';
9
+ import { LaneId } from '@teambit/lane-id';
8
10
  import { ConfigMergeResult } from '@teambit/config-merger';
9
11
  import { Logger, LoggerMain } from '@teambit/logger';
10
12
  import { CheckoutMain, CheckoutProps } from '@teambit/checkout';
@@ -32,6 +34,21 @@ export type MergeLaneOptions = {
32
34
  skipFetch?: boolean;
33
35
  excludeNonLaneComps?: boolean;
34
36
  };
37
+ export type MergeFromScopeResult = {
38
+ mergedNow: ComponentID[];
39
+ exportedIds: ComponentID[];
40
+ unmerged: {
41
+ id: ComponentID;
42
+ reason: string;
43
+ }[];
44
+ conflicts?: Array<{
45
+ id: ComponentID;
46
+ files: string[];
47
+ config?: boolean;
48
+ }>;
49
+ snappedIds?: ComponentID[];
50
+ mergedPreviously: ComponentID[];
51
+ };
35
52
  export declare class MergeLanesMain {
36
53
  private workspace;
37
54
  private merging;
@@ -43,7 +60,12 @@ export declare class MergeLanesMain {
43
60
  private importer;
44
61
  private checkout;
45
62
  constructor(workspace: Workspace | undefined, merging: MergingMain, lanes: LanesMain, logger: Logger, remove: RemoveMain, scope: ScopeMain, exporter: ExportMain, importer: ImporterMain, checkout: CheckoutMain);
46
- mergeLane(laneName: string, options: MergeLaneOptions): Promise<{
63
+ mergeLaneByCLI(laneName: string, options: MergeLaneOptions): Promise<{
64
+ mergeResults: ApplyVersionResults;
65
+ deleteResults: any;
66
+ configMergeResults: ConfigMergeResult[];
67
+ }>;
68
+ mergeLane(otherLaneId: LaneId, currentLaneId: LaneId, options: MergeLaneOptions): Promise<{
47
69
  mergeResults: ApplyVersionResults;
48
70
  deleteResults: any;
49
71
  configMergeResults: ConfigMergeResult[];
@@ -57,11 +79,7 @@ export declare class MergeLanesMain {
57
79
  mergeFromScope(fromLane: string, toLane: string, options: Partial<MergeLaneOptions> & {
58
80
  push?: boolean;
59
81
  reMerge?: boolean;
60
- }): Promise<{
61
- mergedPreviously: string[];
62
- mergedNow: string[];
63
- exportedIds: string[];
64
- }>;
82
+ }): Promise<MergeFromScopeResult>;
65
83
  private throwIfNotUpToDate;
66
84
  static slots: never[];
67
85
  static dependencies: import("@teambit/harmony").Aspect[];