@teambit/merge-lanes 1.0.487 → 1.0.488

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.
@@ -1,6 +1,6 @@
1
1
  import { ScopeMain } from '@teambit/scope';
2
- import { Lane } from '@teambit/legacy/dist/scope/models';
3
- import { Consumer } from '@teambit/legacy/dist/consumer';
2
+ import { Lane } from '@teambit/scope.objects';
3
+ import { Consumer } from '@teambit/legacy.consumer';
4
4
  import { Logger } from '@teambit/logger';
5
5
  import { MergeAbortOpts } from './merge-abort.cmd';
6
6
  type Snapshot = {
@@ -53,23 +53,23 @@ function _legacyCli() {
53
53
  };
54
54
  return data;
55
55
  }
56
- function _stagedSnaps() {
57
- const data = require("@teambit/legacy/dist/scope/staged-snaps");
58
- _stagedSnaps = function () {
56
+ function _scope() {
57
+ const data = require("@teambit/scope.objects");
58
+ _scope = function () {
59
59
  return data;
60
60
  };
61
61
  return data;
62
62
  }
63
- function _bitError() {
64
- const data = require("@teambit/bit-error");
65
- _bitError = function () {
63
+ function _legacy2() {
64
+ const data = require("@teambit/legacy.scope");
65
+ _legacy2 = function () {
66
66
  return data;
67
67
  };
68
68
  return data;
69
69
  }
70
- function _objects() {
71
- const data = require("@teambit/legacy/dist/scope/objects");
72
- _objects = function () {
70
+ function _bitError() {
71
+ const data = require("@teambit/bit-error");
72
+ _bitError = function () {
73
73
  return data;
74
74
  };
75
75
  return data;
@@ -96,7 +96,7 @@ class LastMerged {
96
96
  await _fsExtra().default.copyFile(consumer.config.path, copyOfWorkspaceJsonc);
97
97
  if (!consumer.scope.stagedSnaps.isEmpty()) {
98
98
  copyOfStagedSnaps = _tempy().default.file();
99
- await _fsExtra().default.copyFile(_stagedSnaps().StagedSnaps.getPath(consumer.scope.path), copyOfStagedSnaps);
99
+ await _fsExtra().default.copyFile(_legacy2().StagedSnaps.getPath(consumer.scope.path), copyOfStagedSnaps);
100
100
  }
101
101
  const stagedConfig = await this.scope.getStagedConfig();
102
102
  let copyOfStagedConfig;
@@ -143,7 +143,7 @@ class LastMerged {
143
143
  if (!lastLane) {
144
144
  throw new (_bitError().BitError)(`unable to revert the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`);
145
145
  }
146
- const laneFromBackup = await _objects().BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);
146
+ const laneFromBackup = await _scope().BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);
147
147
  await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);
148
148
  }
149
149
  async restoreFromLastMerged(mergeAbortOpts, currentLane) {
@@ -161,7 +161,7 @@ class LastMerged {
161
161
  if (!lastLane) {
162
162
  throw new (_bitError().BitError)(`unable to abort the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`);
163
163
  }
164
- const laneFromBackup = await _objects().BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);
164
+ const laneFromBackup = await _scope().BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);
165
165
  await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);
166
166
  }
167
167
  const previousBitmapBuffer = await _fsExtra().default.readFile(this.getLastMergedBitmapPath());
@@ -176,7 +176,7 @@ class LastMerged {
176
176
  await _fsExtra().default.copyFile(this.getLastMergedBitmapPath(), this.consumer.bitMap.mapPath);
177
177
  await _fsExtra().default.copyFile(this.getLastMergedWorkspacePath(), this.consumer.config.path);
178
178
  if (_fsExtra().default.pathExistsSync(this.getLastMergedStagedSnapsPath())) {
179
- await _fsExtra().default.copyFile(this.getLastMergedStagedSnapsPath(), _stagedSnaps().StagedSnaps.getPath(this.scope.path));
179
+ await _fsExtra().default.copyFile(this.getLastMergedStagedSnapsPath(), _legacy2().StagedSnaps.getPath(this.scope.path));
180
180
  } else {
181
181
  await this.scope.legacyScope.stagedSnaps.deleteFile();
182
182
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","_interopRequireDefault","require","_tempy","_fsExtra","_yesno","_chalk","_legacy","_legacyCli","_stagedSnaps","_bitError","_objects","e","__esModule","default","LAST_MERGED_LANE_FILENAME","LAST_MERGED_BITMAP_FILENAME","LastMerged","constructor","scope","consumer","logger","path","getLastMergedPath","takeSnapshot","currentLane","copyOfCurrentLane","clone","undefined","copyOfBitmap","tempy","file","copyOfWorkspaceJsonc","copyOfStagedSnaps","fs","copyFile","bitMap","mapPath","config","stagedSnaps","isEmpty","StagedSnaps","getPath","stagedConfig","getStagedConfig","copyOfStagedConfig","filePath","persistSnapshot","snapshot","remove","ensureDir","getLastMergedBitmapPath","getLastMergedWorkspacePath","compressed","compress","outputFile","getLastMergedLanePath","getLastMergedStagedSnapsPath","getLastMergedStagedConfigPath","restoreLaneObjectFromLastMerged","pathExistsSync","BitError","lastLane","getLastMergedLaneContentIfExists","laneFromBackup","BitObject","parseObject","legacyScope","objects","writeObjectsToTheFS","restoreFromLastMerged","mergeAbortOpts","previousBitmapBuffer","readFile","previousBitmap","BitMap","loadFromContentWithoutLoadingFiles","currentRootDirs","getAllTrackDirs","previousRootDirs","compDirsToRemove","Object","keys","filter","dir","silent","mergeAbortPrompt","Promise","all","map","deleteFile","dirsToRemove","clearStatusLine","dirsToRemoveStr","length","join","ok","yesno","question","chalk","bold","PromptCanceled","filename","getFileContentIfExist","err","code","exports"],"sources":["last-merged.ts"],"sourcesContent":["import path from 'path';\nimport tempy from 'tempy';\nimport fs from 'fs-extra';\nimport yesno from 'yesno';\nimport chalk from 'chalk';\nimport { BitMap } from '@teambit/legacy.bit-map';\nimport { PromptCanceled } from '@teambit/legacy.cli.prompts';\nimport { ScopeMain } from '@teambit/scope';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { StagedSnaps } from '@teambit/legacy/dist/scope/staged-snaps';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { BitError } from '@teambit/bit-error';\nimport { BitObject } from '@teambit/legacy/dist/scope/objects';\nimport { Logger } from '@teambit/logger';\nimport { MergeAbortOpts } from './merge-abort.cmd';\n\nconst LAST_MERGED_LANE_FILENAME = 'lane';\nconst LAST_MERGED_BITMAP_FILENAME = 'bitmap';\n\ntype Snapshot = {\n copyOfCurrentLane?: Lane;\n copyOfBitmap: string;\n copyOfWorkspaceJsonc: string;\n copyOfStagedSnaps?: string;\n copyOfStagedConfig?: string;\n};\n\nexport class LastMerged {\n constructor(\n private scope: ScopeMain,\n private consumer: Consumer,\n private logger: Logger\n ) {}\n\n get path() {\n return this.scope.getLastMergedPath();\n }\n\n async takeSnapshot(currentLane?: Lane | null): Promise<Snapshot> {\n const consumer = this.consumer;\n const copyOfCurrentLane = currentLane ? currentLane.clone() : undefined;\n const copyOfBitmap = tempy.file();\n const copyOfWorkspaceJsonc = tempy.file();\n let copyOfStagedSnaps: string | undefined;\n await fs.copyFile(consumer.bitMap.mapPath, copyOfBitmap);\n await fs.copyFile(consumer.config.path, copyOfWorkspaceJsonc);\n if (!consumer.scope.stagedSnaps.isEmpty()) {\n copyOfStagedSnaps = tempy.file();\n await fs.copyFile(StagedSnaps.getPath(consumer.scope.path), copyOfStagedSnaps);\n }\n const stagedConfig = await this.scope.getStagedConfig();\n let copyOfStagedConfig: string | undefined;\n if (!stagedConfig.isEmpty()) {\n copyOfStagedConfig = tempy.file();\n await fs.copyFile(stagedConfig.filePath, copyOfStagedConfig);\n }\n\n return {\n copyOfCurrentLane,\n copyOfBitmap,\n copyOfWorkspaceJsonc,\n copyOfStagedSnaps,\n copyOfStagedConfig,\n };\n }\n\n async persistSnapshot(snapshot: Snapshot) {\n const { copyOfCurrentLane, copyOfBitmap, copyOfWorkspaceJsonc, copyOfStagedSnaps, copyOfStagedConfig } = snapshot;\n await fs.remove(this.path);\n await fs.ensureDir(this.path);\n await fs.copyFile(copyOfBitmap, this.getLastMergedBitmapPath());\n await fs.copyFile(copyOfWorkspaceJsonc, this.getLastMergedWorkspacePath());\n if (copyOfCurrentLane) {\n const compressed = await copyOfCurrentLane.compress();\n await fs.outputFile(this.getLastMergedLanePath(), compressed);\n }\n if (copyOfStagedSnaps) {\n await fs.copyFile(copyOfStagedSnaps, this.getLastMergedStagedSnapsPath());\n }\n if (copyOfStagedConfig) {\n await fs.copyFile(copyOfStagedConfig, this.getLastMergedStagedConfigPath());\n }\n }\n\n async restoreLaneObjectFromLastMerged() {\n if (!fs.pathExistsSync(this.path)) {\n throw new BitError(`unable to abort the last lane-merge because \"bit export\" was running since then`);\n }\n const lastLane = await this.getLastMergedLaneContentIfExists();\n if (!lastLane) {\n throw new BitError(\n `unable to revert the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`\n );\n }\n const laneFromBackup = await BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);\n }\n\n async restoreFromLastMerged(mergeAbortOpts: MergeAbortOpts, currentLane?: Lane | null) {\n if (!fs.pathExistsSync(this.path)) {\n throw new BitError(`unable to abort the last lane-merge because \"bit export\" was running since then`);\n }\n const lastLane = await this.getLastMergedLaneContentIfExists();\n\n if (!fs.pathExistsSync(this.getLastMergedBitmapPath())) {\n throw new BitError(\n `unable to abort the last lane-merge because the ${LAST_MERGED_BITMAP_FILENAME} is missing from ${this.path}`\n );\n }\n if (!fs.pathExistsSync(this.getLastMergedWorkspacePath())) {\n throw new BitError(\n `unable to abort the last lane-merge because the workspace.jsonc is missing from ${this.path}`\n );\n }\n if (currentLane) {\n if (!lastLane) {\n throw new BitError(\n `unable to abort the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`\n );\n }\n const laneFromBackup = await BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);\n }\n const previousBitmapBuffer = await fs.readFile(this.getLastMergedBitmapPath());\n const previousBitmap = BitMap.loadFromContentWithoutLoadingFiles(previousBitmapBuffer, '', '', '');\n const currentRootDirs = this.consumer.bitMap.getAllTrackDirs();\n const previousRootDirs = previousBitmap.getAllTrackDirs();\n const compDirsToRemove = Object.keys(currentRootDirs).filter((dir) => !previousRootDirs[dir]);\n\n if (!mergeAbortOpts.silent) {\n await this.mergeAbortPrompt(compDirsToRemove);\n }\n await Promise.all(compDirsToRemove.map((dir) => fs.remove(dir))); // it doesn't throw if not-exist, so we're good here.\n await fs.copyFile(this.getLastMergedBitmapPath(), this.consumer.bitMap.mapPath);\n await fs.copyFile(this.getLastMergedWorkspacePath(), this.consumer.config.path);\n if (fs.pathExistsSync(this.getLastMergedStagedSnapsPath())) {\n await fs.copyFile(this.getLastMergedStagedSnapsPath(), StagedSnaps.getPath(this.scope.path));\n } else {\n await this.scope.legacyScope.stagedSnaps.deleteFile();\n }\n const stagedConfig = await this.scope.getStagedConfig();\n if (fs.pathExistsSync(this.getLastMergedStagedConfigPath())) {\n await fs.copyFile(this.getLastMergedStagedConfigPath(), stagedConfig.filePath);\n } else {\n await stagedConfig.deleteFile();\n }\n await fs.remove(this.path);\n\n return {\n compDirsToRemove,\n };\n }\n\n private async mergeAbortPrompt(dirsToRemove: string[]) {\n this.logger.clearStatusLine();\n const dirsToRemoveStr = dirsToRemove.length\n ? `\\nThe following directories introduced by the merge will be deleted: ${dirsToRemove.join(', ')}`\n : '';\n const ok = await yesno({\n question: `Code changes that were done since the last lane-merge will be lost.${dirsToRemoveStr}\nThe .bitmap and workspace.jsonc files will be restored to the state before the merge.\nThis action is irreversible.\n${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new PromptCanceled();\n }\n }\n\n private async getLastMergedLaneContentIfExists(): Promise<Buffer | null> {\n const filename = this.getLastMergedLanePath();\n return this.getFileContentIfExist(filename);\n }\n private async getFileContentIfExist(filename: string): Promise<Buffer | null> {\n try {\n return await fs.readFile(filename);\n } catch (err: any) {\n if (err.code === 'ENOENT') return null;\n throw err;\n }\n }\n private getLastMergedBitmapPath() {\n return path.join(this.path, LAST_MERGED_BITMAP_FILENAME);\n }\n private getLastMergedWorkspacePath() {\n return path.join(this.path, 'workspace.jsonc');\n }\n private getLastMergedLanePath() {\n return path.join(this.path, LAST_MERGED_LANE_FILENAME);\n }\n private getLastMergedStagedSnapsPath() {\n return path.join(this.path, 'staged-snaps');\n }\n private getLastMergedStagedConfigPath() {\n return path.join(this.path, 'staged-config.json');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,WAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAS,aAAA;E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AI,CAACzE,IAAI,EAAEP,yBAAyB,CAAC;EACxD;EACQ0C,4BAA4BA,CAAA,EAAG;IACrC,OAAOnC,eAAI,CAACyE,IAAI,CAAC,IAAI,CAACzE,IAAI,EAAE,cAAc,CAAC;EAC7C;EACQoC,6BAA6BA,CAAA,EAAG;IACtC,OAAOpC,eAAI,CAACyE,IAAI,CAAC,IAAI,CAACzE,IAAI,EAAE,oBAAoB,CAAC;EACnD;AACF;AAACoF,OAAA,CAAAzF,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","_interopRequireDefault","require","_tempy","_fsExtra","_yesno","_chalk","_legacy","_legacyCli","_scope","_legacy2","_bitError","e","__esModule","default","LAST_MERGED_LANE_FILENAME","LAST_MERGED_BITMAP_FILENAME","LastMerged","constructor","scope","consumer","logger","path","getLastMergedPath","takeSnapshot","currentLane","copyOfCurrentLane","clone","undefined","copyOfBitmap","tempy","file","copyOfWorkspaceJsonc","copyOfStagedSnaps","fs","copyFile","bitMap","mapPath","config","stagedSnaps","isEmpty","StagedSnaps","getPath","stagedConfig","getStagedConfig","copyOfStagedConfig","filePath","persistSnapshot","snapshot","remove","ensureDir","getLastMergedBitmapPath","getLastMergedWorkspacePath","compressed","compress","outputFile","getLastMergedLanePath","getLastMergedStagedSnapsPath","getLastMergedStagedConfigPath","restoreLaneObjectFromLastMerged","pathExistsSync","BitError","lastLane","getLastMergedLaneContentIfExists","laneFromBackup","BitObject","parseObject","legacyScope","objects","writeObjectsToTheFS","restoreFromLastMerged","mergeAbortOpts","previousBitmapBuffer","readFile","previousBitmap","BitMap","loadFromContentWithoutLoadingFiles","currentRootDirs","getAllTrackDirs","previousRootDirs","compDirsToRemove","Object","keys","filter","dir","silent","mergeAbortPrompt","Promise","all","map","deleteFile","dirsToRemove","clearStatusLine","dirsToRemoveStr","length","join","ok","yesno","question","chalk","bold","PromptCanceled","filename","getFileContentIfExist","err","code","exports"],"sources":["last-merged.ts"],"sourcesContent":["import path from 'path';\nimport tempy from 'tempy';\nimport fs from 'fs-extra';\nimport yesno from 'yesno';\nimport chalk from 'chalk';\nimport { BitMap } from '@teambit/legacy.bit-map';\nimport { PromptCanceled } from '@teambit/legacy.cli.prompts';\nimport { ScopeMain } from '@teambit/scope';\nimport { BitObject, Lane } from '@teambit/scope.objects';\nimport { StagedSnaps } from '@teambit/legacy.scope';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { MergeAbortOpts } from './merge-abort.cmd';\n\nconst LAST_MERGED_LANE_FILENAME = 'lane';\nconst LAST_MERGED_BITMAP_FILENAME = 'bitmap';\n\ntype Snapshot = {\n copyOfCurrentLane?: Lane;\n copyOfBitmap: string;\n copyOfWorkspaceJsonc: string;\n copyOfStagedSnaps?: string;\n copyOfStagedConfig?: string;\n};\n\nexport class LastMerged {\n constructor(\n private scope: ScopeMain,\n private consumer: Consumer,\n private logger: Logger\n ) {}\n\n get path() {\n return this.scope.getLastMergedPath();\n }\n\n async takeSnapshot(currentLane?: Lane | null): Promise<Snapshot> {\n const consumer = this.consumer;\n const copyOfCurrentLane = currentLane ? currentLane.clone() : undefined;\n const copyOfBitmap = tempy.file();\n const copyOfWorkspaceJsonc = tempy.file();\n let copyOfStagedSnaps: string | undefined;\n await fs.copyFile(consumer.bitMap.mapPath, copyOfBitmap);\n await fs.copyFile(consumer.config.path, copyOfWorkspaceJsonc);\n if (!consumer.scope.stagedSnaps.isEmpty()) {\n copyOfStagedSnaps = tempy.file();\n await fs.copyFile(StagedSnaps.getPath(consumer.scope.path), copyOfStagedSnaps);\n }\n const stagedConfig = await this.scope.getStagedConfig();\n let copyOfStagedConfig: string | undefined;\n if (!stagedConfig.isEmpty()) {\n copyOfStagedConfig = tempy.file();\n await fs.copyFile(stagedConfig.filePath, copyOfStagedConfig);\n }\n\n return {\n copyOfCurrentLane,\n copyOfBitmap,\n copyOfWorkspaceJsonc,\n copyOfStagedSnaps,\n copyOfStagedConfig,\n };\n }\n\n async persistSnapshot(snapshot: Snapshot) {\n const { copyOfCurrentLane, copyOfBitmap, copyOfWorkspaceJsonc, copyOfStagedSnaps, copyOfStagedConfig } = snapshot;\n await fs.remove(this.path);\n await fs.ensureDir(this.path);\n await fs.copyFile(copyOfBitmap, this.getLastMergedBitmapPath());\n await fs.copyFile(copyOfWorkspaceJsonc, this.getLastMergedWorkspacePath());\n if (copyOfCurrentLane) {\n const compressed = await copyOfCurrentLane.compress();\n await fs.outputFile(this.getLastMergedLanePath(), compressed);\n }\n if (copyOfStagedSnaps) {\n await fs.copyFile(copyOfStagedSnaps, this.getLastMergedStagedSnapsPath());\n }\n if (copyOfStagedConfig) {\n await fs.copyFile(copyOfStagedConfig, this.getLastMergedStagedConfigPath());\n }\n }\n\n async restoreLaneObjectFromLastMerged() {\n if (!fs.pathExistsSync(this.path)) {\n throw new BitError(`unable to abort the last lane-merge because \"bit export\" was running since then`);\n }\n const lastLane = await this.getLastMergedLaneContentIfExists();\n if (!lastLane) {\n throw new BitError(\n `unable to revert the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`\n );\n }\n const laneFromBackup = await BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);\n }\n\n async restoreFromLastMerged(mergeAbortOpts: MergeAbortOpts, currentLane?: Lane | null) {\n if (!fs.pathExistsSync(this.path)) {\n throw new BitError(`unable to abort the last lane-merge because \"bit export\" was running since then`);\n }\n const lastLane = await this.getLastMergedLaneContentIfExists();\n\n if (!fs.pathExistsSync(this.getLastMergedBitmapPath())) {\n throw new BitError(\n `unable to abort the last lane-merge because the ${LAST_MERGED_BITMAP_FILENAME} is missing from ${this.path}`\n );\n }\n if (!fs.pathExistsSync(this.getLastMergedWorkspacePath())) {\n throw new BitError(\n `unable to abort the last lane-merge because the workspace.jsonc is missing from ${this.path}`\n );\n }\n if (currentLane) {\n if (!lastLane) {\n throw new BitError(\n `unable to abort the last lane-merge because the ${LAST_MERGED_LANE_FILENAME} is missing from ${this.path}`\n );\n }\n const laneFromBackup = await BitObject.parseObject(lastLane, LAST_MERGED_LANE_FILENAME);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([laneFromBackup]);\n }\n const previousBitmapBuffer = await fs.readFile(this.getLastMergedBitmapPath());\n const previousBitmap = BitMap.loadFromContentWithoutLoadingFiles(previousBitmapBuffer, '', '', '');\n const currentRootDirs = this.consumer.bitMap.getAllTrackDirs();\n const previousRootDirs = previousBitmap.getAllTrackDirs();\n const compDirsToRemove = Object.keys(currentRootDirs).filter((dir) => !previousRootDirs[dir]);\n\n if (!mergeAbortOpts.silent) {\n await this.mergeAbortPrompt(compDirsToRemove);\n }\n await Promise.all(compDirsToRemove.map((dir) => fs.remove(dir))); // it doesn't throw if not-exist, so we're good here.\n await fs.copyFile(this.getLastMergedBitmapPath(), this.consumer.bitMap.mapPath);\n await fs.copyFile(this.getLastMergedWorkspacePath(), this.consumer.config.path);\n if (fs.pathExistsSync(this.getLastMergedStagedSnapsPath())) {\n await fs.copyFile(this.getLastMergedStagedSnapsPath(), StagedSnaps.getPath(this.scope.path));\n } else {\n await this.scope.legacyScope.stagedSnaps.deleteFile();\n }\n const stagedConfig = await this.scope.getStagedConfig();\n if (fs.pathExistsSync(this.getLastMergedStagedConfigPath())) {\n await fs.copyFile(this.getLastMergedStagedConfigPath(), stagedConfig.filePath);\n } else {\n await stagedConfig.deleteFile();\n }\n await fs.remove(this.path);\n\n return {\n compDirsToRemove,\n };\n }\n\n private async mergeAbortPrompt(dirsToRemove: string[]) {\n this.logger.clearStatusLine();\n const dirsToRemoveStr = dirsToRemove.length\n ? `\\nThe following directories introduced by the merge will be deleted: ${dirsToRemove.join(', ')}`\n : '';\n const ok = await yesno({\n question: `Code changes that were done since the last lane-merge will be lost.${dirsToRemoveStr}\nThe .bitmap and workspace.jsonc files will be restored to the state before the merge.\nThis action is irreversible.\n${chalk.bold('Do you want to continue? [yes(y)/no(n)]')}`,\n });\n if (!ok) {\n throw new PromptCanceled();\n }\n }\n\n private async getLastMergedLaneContentIfExists(): Promise<Buffer | null> {\n const filename = this.getLastMergedLanePath();\n return this.getFileContentIfExist(filename);\n }\n private async getFileContentIfExist(filename: string): Promise<Buffer | null> {\n try {\n return await fs.readFile(filename);\n } catch (err: any) {\n if (err.code === 'ENOENT') return null;\n throw err;\n }\n }\n private getLastMergedBitmapPath() {\n return path.join(this.path, LAST_MERGED_BITMAP_FILENAME);\n }\n private getLastMergedWorkspacePath() {\n return path.join(this.path, 'workspace.jsonc');\n }\n private getLastMergedLanePath() {\n return path.join(this.path, LAST_MERGED_LANE_FILENAME);\n }\n private getLastMergedStagedSnapsPath() {\n return path.join(this.path, 'staged-snaps');\n }\n private getLastMergedStagedConfigPath() {\n return path.join(this.path, 'staged-config.json');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAN,I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IACX;EACF;EACQrD,uBAAuBA,CAAA,EAAG;IAChC,OAAO7B,eAAI,CAACyE,IAAI,CAAC,IAAI,CAACzE,IAAI,EAAEN,2BAA2B,CAAC;EAC1D;EACQoC,0BAA0BA,CAAA,EAAG;IACnC,OAAO9B,eAAI,CAACyE,IAAI,CAAC,IAAI,CAACzE,IAAI,EAAE,iBAAiB,CAAC;EAChD;EACQkC,qBAAqBA,CAAA,EAAG;IAC9B,OAAOlC,eAAI,CAACyE,IAAI,CAAC,IAAI,CAACzE,IAAI,EAAEP,yBAAyB,CAAC;EACxD;EACQ0C,4BAA4BA,CAAA,EAAG;IACrC,OAAOnC,eAAI,CAACyE,IAAI,CAAC,IAAI,CAACzE,IAAI,EAAE,cAAc,CAAC;EAC7C;EACQoC,6BAA6BA,CAAA,EAAG;IACtC,OAAOpC,eAAI,CAACyE,IAAI,CAAC,IAAI,CAACzE,IAAI,EAAE,oBAAoB,CAAC;EACnD;AACF;AAACoF,OAAA,CAAAzF,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -18,9 +18,9 @@ function _merging() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _constants() {
22
- const data = require("@teambit/legacy/dist/constants");
23
- _constants = function () {
21
+ function _legacy() {
22
+ const data = require("@teambit/legacy.constants");
23
+ _legacy = function () {
24
24
  return data;
25
25
  };
26
26
  return data;
@@ -76,7 +76,7 @@ so then the history (and the source-code) of the other lane will be kept.
76
76
  }, {
77
77
  name: 'pattern',
78
78
  description: `partially merge the lane - only components that match the specified component-pattern
79
- Component pattern format: ${_constants().COMPONENT_PATTERN_HELP}`
79
+ Component pattern format: ${_legacy().COMPONENT_PATTERN_HELP}`
80
80
  }]);
81
81
  _defineProperty(this, "alias", '');
82
82
  _defineProperty(this, "options", [['', 'manual', 'same as "--auto-merge-resolve manual". in case of merge conflict, write the files with the conflict markers'], ['r', 'auto-merge-resolve <merge-strategy>', 'in case of a merge conflict, resolve according to the provided strategy: [ours, theirs, manual]'], ['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep local modifications'], ['', 'theirs', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override local with incoming changes'], ['', 'workspace', 'merge only lane components that are in the current workspace'], ['', 'no-auto-snap', 'do not auto snap after merge completed without conflicts of diverged components (see command description)'], ['', 'no-snap', 'do not pass snaps from the other lane even for non-diverged components (see command description)'], ['', 'tag', 'auto-tag all lane components after merging into main (or tag-merge in case of snap-merge)'], ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'], ['m', 'message <message>', 'override the default message for the auto snap'], ['', 'keep-readme', 'skip deleting the lane readme component after merging'], ['', 'no-squash', 'relevant for merging lanes into main, which by default squashes all lane snaps'], ['', 'squash', 'relevant for merging a lane into another non-main lane, which by default does not squash'], ['', 'ignore-config-changes', 'allow merging when components are modified due to config changes (such as dependencies) only and not files'], ['', 'verbose', 'display detailed information about components that were legitimately unmerged'], ['x', 'skip-dependency-installation', 'do not install dependencies of the imported components'], ['', 'skip-fetch', 'use the local state of target-lane if exits locally, without updating it from the remote'], ['', 'include-deps', 'relevant for "pattern" and "--workspace". merge also dependencies of the specified components'], ['', 'resolve-unrelated [merge-strategy]', 'relevant when a component on a lane and the component on main have nothing in common. merge-strategy can be "ours" (default) or "theirs"'], ['', 'include-non-lane-comps', '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)'], ['', 'exclude-non-lane-comps', 'when merging main into a lane, exclude workspace components that are not on the lane (by default all workspace components are merged)']]);
@@ -106,7 +106,7 @@ Component pattern format: ${_constants().COMPONENT_PATTERN_HELP}`
106
106
  verbose = false,
107
107
  excludeNonLaneComps = false
108
108
  }) {
109
- build = (await this.globalConfig.getBool(_constants().CFG_FORCE_LOCAL_BUILD)) || Boolean(build);
109
+ build = (await this.globalConfig.getBool(_legacy().CFG_FORCE_LOCAL_BUILD)) || Boolean(build);
110
110
  if (ours || theirs) {
111
111
  throw new (_bitError().BitError)('the "--ours" and "--theirs" flags are deprecated. use "--auto-merge-resolve" instead. see "bit lane merge --help" for more information');
112
112
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_merging","_constants","_bitError","_remove","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MergeLaneCmd","constructor","mergeLanes","globalConfig","name","description","COMPONENT_PATTERN_HELP","report","pattern","ours","theirs","manual","autoMergeResolve","build","workspace","existingOnWorkspaceOnly","squash","noAutoSnap","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 { mergeReport, MergeStrategy } 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-auto-snap\" to opt-out, or \"tag\" to tag instead.\n\nwhen the components are not diverged in history, and the current lane is behind the merge candidate, the merge will\nsimply update the components and the heads according to the merge candidate.\nto opt-out, use \"--no-snap\", the components will be written as the merge candidate, and will be left as modified.\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 'r',\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 [\n '',\n 'no-auto-snap',\n 'do not auto snap after merge completed without conflicts of diverged components (see command description)',\n ],\n ['', 'no-snap', 'do not pass snaps from the other lane even for non-diverged components (see command description)'],\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 ['', 'squash', 'relevant for merging a lane into another non-main lane, which by default does not squash'],\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', 'display detailed information about components that were legitimately unmerged'],\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(\n private mergeLanes: MergeLanesMain,\n private globalConfig: GlobalConfigMain\n ) {}\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 noAutoSnap = 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 noAutoSnap: 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 (noAutoSnap && 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 noAutoSnap,\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;AAEA,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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAR,CAAA,GAAAI,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA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AAE;MACrGS,KAAK;MACL;MACAsB,aAAa;MACb1B,IAAI;MACJC,MAAM;MACNK,uBAAuB;MACvBE,UAAU;MACVC,MAAM;MACNG,WAAW;MACXC,UAAU;MACVN,MAAM;MACNO,QAAQ;MACRJ,GAAG;MACHX,OAAO;MACPgB,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,GAAG,KAAKL,aAAa,CAACM,WAAW,GAAG,IAAAC,wBAAc,EAACP,aAAa,CAACM,WAAW,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAC5GN,aAAa,CAACQ,YAAY,IAAI,EAAE,EAChCC,GAAG,CAAEC,IAAI,IAAK,IAAAH,wBAAc,EAACG,IAAI,EAAE,IAAI,CAAC,CAAC,GACxCV,aAAa,CAACW,YAAY,IAAIC,gBAAK,CAACC,MAAM,CAACb,aAAa,CAACW,YAAY,CAAC,IAAK,EAAE,IAC5E;IACJ,OAAOR,WAAW,GAAGE,YAAY;EACnC;AACF;AAACS,OAAA,CAAAtD,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_merging","_legacy","_bitError","_remove","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","MergeLaneCmd","constructor","mergeLanes","globalConfig","name","description","COMPONENT_PATTERN_HELP","report","pattern","ours","theirs","manual","autoMergeResolve","build","workspace","existingOnWorkspaceOnly","squash","noAutoSnap","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 { mergeReport, MergeStrategy } from '@teambit/merging';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { COMPONENT_PATTERN_HELP, CFG_FORCE_LOCAL_BUILD } from '@teambit/legacy.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-auto-snap\" to opt-out, or \"tag\" to tag instead.\n\nwhen the components are not diverged in history, and the current lane is behind the merge candidate, the merge will\nsimply update the components and the heads according to the merge candidate.\nto opt-out, use \"--no-snap\", the components will be written as the merge candidate, and will be left as modified.\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 'r',\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 [\n '',\n 'no-auto-snap',\n 'do not auto snap after merge completed without conflicts of diverged components (see command description)',\n ],\n ['', 'no-snap', 'do not pass snaps from the other lane even for non-diverged components (see command description)'],\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 ['', 'squash', 'relevant for merging a lane into another non-main lane, which by default does not squash'],\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', 'display detailed information about components that were legitimately unmerged'],\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(\n private mergeLanes: MergeLanesMain,\n private globalConfig: GlobalConfigMain\n ) {}\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 noAutoSnap = 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 noAutoSnap: 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 (noAutoSnap && 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 noAutoSnap,\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;AAEA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAE,O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