@teambit/checkout 1.0.138 → 1.0.140

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.
@@ -17,11 +17,12 @@ export declare class CheckoutCmd implements Command {
17
17
  options: CommandOptions;
18
18
  loader: boolean;
19
19
  constructor(checkout: CheckoutMain);
20
- report([to, componentPattern]: [string, string], { interactiveMerge, forceOurs, forceTheirs, autoMergeResolve, all, workspaceOnly, verbose, skipDependencyInstallation, revert, }: {
20
+ report([to, componentPattern]: [string, string], { interactiveMerge, forceOurs, forceTheirs, autoMergeResolve, manual, all, workspaceOnly, verbose, skipDependencyInstallation, revert, }: {
21
21
  interactiveMerge?: boolean;
22
22
  forceOurs?: boolean;
23
23
  forceTheirs?: boolean;
24
24
  autoMergeResolve?: MergeStrategy;
25
+ manual?: boolean;
25
26
  all?: boolean;
26
27
  workspaceOnly?: boolean;
27
28
  verbose?: boolean;
@@ -12,6 +12,13 @@ function _chalk() {
12
12
  };
13
13
  return data;
14
14
  }
15
+ function _lodash() {
16
+ const data = require("lodash");
17
+ _lodash = function () {
18
+ return data;
19
+ };
20
+ return data;
21
+ }
15
22
  function _merging() {
16
23
  const data = require("@teambit/merging");
17
24
  _merging = function () {
@@ -65,7 +72,7 @@ class CheckoutCmd {
65
72
  \`bit checkout reset [component-pattern]\` => remove local modifications from the specified ids (or all components when --all is used)
66
73
  when on a lane, "checkout head" only checks out components on this lane. to update main components, run "bit lane merge main"`);
67
74
  _defineProperty(this, "alias", 'U');
68
- _defineProperty(this, "options", [['i', 'interactive-merge', 'when a component is modified and the merge process found conflicts, display options to resolve them'], ['', 'auto-merge-resolve <merge-strategy>', 'in case of merge conflict, resolve according to the provided strategy: [ours, theirs, manual]'], ['a', 'all', 'all components'], ['e', 'workspace-only', "only relevant for 'bit checkout head' when on a lane. don't import components from the remote lane that are not already in the workspace"], ['v', 'verbose', 'showing verbose output for inspection'], ['x', 'skip-dependency-installation', 'do not auto-install dependencies of the imported components'], ['', 'force-ours', 'regardless of conflicts, ignore theirs changes and keep our local files intact'], ['', 'force-theirs', 'regardless of conflicts, ignore our local changes and use theirs files']]);
75
+ _defineProperty(this, "options", [['i', 'interactive-merge', 'when a component is modified and the merge process found conflicts, display options to resolve them'], ['', 'auto-merge-resolve <merge-strategy>', 'in case of merge conflict, resolve according to the provided strategy: [ours, theirs, manual]'], ['', 'manual', 'same as "--auto-merge-resolve manual". in case of merge conflict, write the files with the conflict markers'], ['a', 'all', 'all components'], ['e', 'workspace-only', "only relevant for 'bit checkout head' when on a lane. don't import components from the remote lane that are not already in the workspace"], ['v', 'verbose', 'showing verbose output for inspection'], ['x', 'skip-dependency-installation', 'do not auto-install dependencies of the imported components'], ['', 'force-ours', 'do not merge, preserve local files as is'], ['', 'force-theirs', 'do not merge, just overwrite with incoming files']]);
69
76
  _defineProperty(this, "loader", true);
70
77
  }
71
78
  async report([to, componentPattern], {
@@ -73,6 +80,7 @@ when on a lane, "checkout head" only checks out components on this lane. to upda
73
80
  forceOurs,
74
81
  forceTheirs,
75
82
  autoMergeResolve,
83
+ manual,
76
84
  all = false,
77
85
  workspaceOnly = false,
78
86
  verbose = false,
@@ -85,6 +93,7 @@ when on a lane, "checkout head" only checks out components on this lane. to upda
85
93
  if (autoMergeResolve && autoMergeResolve !== 'ours' && autoMergeResolve !== 'theirs' && autoMergeResolve !== 'manual') {
86
94
  throw new (_bitError().BitError)('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');
87
95
  }
96
+ if (manual) autoMergeResolve = 'manual';
88
97
  if (workspaceOnly && to !== _constants().HEAD) {
89
98
  throw new (_bitError().BitError)('--workspace-only is only relevant when running "bit checkout head" on a lane');
90
99
  }
@@ -146,11 +155,11 @@ function checkoutOutput(checkoutResults, checkoutProps, alternativeTitle) {
146
155
  }
147
156
  const title = 'checkout was not required for the following component(s)';
148
157
  const body = notCheckedOutComponents.map(failedComponent => `${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`).join('\n');
149
- return `${_chalk().default.underline(title)}\n${body}\n\n`;
158
+ return `${_chalk().default.underline(title)}\n${body}`;
150
159
  };
151
160
  const getConflictSummary = () => {
152
161
  if (!components || !components.length || !leftUnresolvedConflicts) return '';
153
- const title = `\n\nfiles with conflicts summary\n`;
162
+ const title = `files with conflicts summary\n`;
154
163
  const suggestion = `\n\nfix the conflicts above manually and then run "bit install".
155
164
  once ready, snap/tag the components to persist the changes`;
156
165
  const conflictSummary = (0, _merging().conflictSummaryReport)(components);
@@ -190,21 +199,20 @@ once ready, snap/tag the components to persist the changes`;
190
199
  if (!newFromLane?.length) return '';
191
200
  const title = newFromLaneAdded ? `successfully added the following components from the lane` : `the following components exist on the lane but were not added to the workspace. omit --workspace-only flag to add them`;
192
201
  const body = newFromLane.join('\n');
193
- return `\n\n${_chalk().default.underline(title)}\n${body}`;
202
+ return `${_chalk().default.underline(title)}\n${body}`;
194
203
  };
195
204
  const getSummary = () => {
196
205
  const checkedOut = components?.length || 0;
197
206
  const notCheckedOutLegitimately = notCheckedOutComponents.length;
198
- const newLines = '\n\n';
199
207
  const title = _chalk().default.bold.underline('Summary');
200
208
  const checkedOutStr = `\nTotal Changed: ${_chalk().default.bold(checkedOut.toString())}`;
201
209
  const unchangedLegitimatelyStr = `\nTotal Unchanged: ${_chalk().default.bold(notCheckedOutLegitimately.toString())}`;
202
210
  const newOnLaneNum = newFromLane?.length || 0;
203
211
  const newOnLaneAddedStr = newFromLaneAdded ? ' (added)' : ' (not added)';
204
212
  const newOnLaneStr = newOnLaneNum ? `\nNew on lane${newOnLaneAddedStr}: ${_chalk().default.bold(newOnLaneNum.toString())}` : '';
205
- return newLines + title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr;
213
+ return title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr;
206
214
  };
207
- return getNotCheckedOutOutput() + getSuccessfulOutput() + (0, _merging().getRemovedOutput)(removedComponents) + (0, _merging().getAddedOutput)(addedComponents) + getNewOnLaneOutput() + getConflictSummary() + getSummary() + (0, _merging().installationErrorOutput)(installationError) + (0, _merging().compilationErrorOutput)(compilationError);
215
+ return (0, _lodash().compact)([getNotCheckedOutOutput(), getSuccessfulOutput(), (0, _merging().getRemovedOutput)(removedComponents), (0, _merging().getAddedOutput)(addedComponents), getNewOnLaneOutput(), getConflictSummary(), getSummary(), (0, _merging().installationErrorOutput)(installationError), (0, _merging().compilationErrorOutput)(compilationError)]).join('\n\n');
208
216
  }
209
217
 
210
218
  //# sourceMappingURL=checkout-cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_merging","_constants","_componentId","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","forceOurs","forceTheirs","autoMergeResolve","all","workspaceOnly","verbose","skipDependencyInstallation","revert","BitError","HEAD","checkoutProps","promptMergeOptions","mergeStrategy","isLane","skipNpmInstall","head","LATEST","latest","reset","main","ComponentID","isValidVersion","version","checkoutResults","checkoutByCLIValues","checkoutOutput","exports","alternativeTitle","components","failedComponents","removedComponents","addedComponents","leftUnresolvedConflicts","newFromLane","newFromLaneAdded","installationError","compilationError","realFailedComponents","filter","f","unchangedLegitimately","length","Error","notCheckedOutComponents","getNotCheckedOutOutput","chalk","green","bold","toString","title","body","map","failedComponent","id","unchangedMessage","join","underline","getConflictSummary","suggestion","conflictSummary","conflictSummaryReport","conflictStr","yellow","getSuccessfulOutput","newLine","switchedOrReverted","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","getNewOnLaneOutput","getSummary","checkedOut","notCheckedOutLegitimately","newLines","checkedOutStr","unchangedLegitimatelyStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","getRemovedOutput","getAddedOutput","installationErrorOutput","compilationErrorOutput"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n ApplyVersionResults,\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n getRemovedOutput,\n getAddedOutput,\n} from '@teambit/merging';\nimport { COMPONENT_PATTERN_HELP, HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { CheckoutMain, CheckoutProps } from './checkout.main.runtime';\n\nexport class CheckoutCmd implements Command {\n name = 'checkout <to> [component-pattern]';\n arguments = [\n {\n name: 'to',\n description:\n \"permitted values: [head, latest, reset, specific-version]. 'head' - last snap/tag. 'latest' - semver latest tag. 'reset' - removes local changes\",\n },\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n description = 'switch between component versions or remove local changes';\n helpUrl = 'reference/components/merging-changes#checkout-snaps-to-the-working-directory';\n group = 'development';\n extendedDescription = `\n\\`bit checkout <version> [component-pattern]\\` => checkout the specified ids (or all components when --all is used) to the specified version\n\\`bit checkout head [component-pattern]\\` => checkout to the last snap/tag (use --latest if you only want semver tags), omit [component-pattern] to checkout head for all\n\\`bit checkout latest [component-pattern]\\` => checkout to the latest satisfying semver tag, omit [component-pattern] to checkout latest for all\n\\`bit checkout reset [component-pattern]\\` => remove local modifications from the specified ids (or all components when --all is used)\nwhen on a lane, \"checkout head\" only checks out components on this lane. to update main components, run \"bit lane merge main\"`;\n alias = 'U';\n options = [\n [\n 'i',\n 'interactive-merge',\n 'when a component is modified and the merge process found conflicts, display options to resolve them',\n ],\n [\n '',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of merge conflict, resolve according to the provided strategy: [ours, theirs, manual]',\n ],\n ['a', 'all', 'all components'],\n [\n 'e',\n 'workspace-only',\n \"only relevant for 'bit checkout head' when on a lane. don't import components from the remote lane that are not already in the workspace\",\n ],\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['x', 'skip-dependency-installation', 'do not auto-install dependencies of the imported components'],\n ['', 'force-ours', 'regardless of conflicts, ignore theirs changes and keep our local files intact'],\n ['', 'force-theirs', 'regardless of conflicts, ignore our local changes and use theirs files'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [to, componentPattern]: [string, string],\n {\n interactiveMerge = false,\n forceOurs,\n forceTheirs,\n autoMergeResolve,\n all = false,\n workspaceOnly = false,\n verbose = false,\n skipDependencyInstallation = false,\n revert = false,\n }: {\n interactiveMerge?: boolean;\n forceOurs?: boolean;\n forceTheirs?: boolean;\n autoMergeResolve?: MergeStrategy;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n revert?: boolean;\n }\n ) {\n if (forceOurs && forceTheirs) {\n throw new BitError('please use either --force-ours or --force-theirs, not both');\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 (workspaceOnly && to !== HEAD) {\n throw new BitError('--workspace-only is only relevant when running \"bit checkout head\" on a lane');\n }\n const checkoutProps: CheckoutProps = {\n promptMergeOptions: interactiveMerge,\n mergeStrategy: autoMergeResolve,\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n workspaceOnly,\n revert,\n forceOurs,\n forceTheirs,\n };\n if (to === HEAD) checkoutProps.head = true;\n else if (to === LATEST) checkoutProps.latest = true;\n else if (to === 'reset') checkoutProps.reset = true;\n else if (to === 'main') checkoutProps.main = true;\n else {\n if (!ComponentID.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n\n const checkoutResults = await this.checkout.checkoutByCLIValues(componentPattern || '', checkoutProps);\n return checkoutOutput(checkoutResults, checkoutProps);\n }\n}\n\nexport function checkoutOutput(\n checkoutResults: ApplyVersionResults,\n checkoutProps: CheckoutProps,\n alternativeTitle?: string\n) {\n const {\n components,\n version,\n failedComponents,\n removedComponents,\n addedComponents,\n leftUnresolvedConflicts,\n newFromLane,\n newFromLaneAdded,\n installationError,\n compilationError,\n }: ApplyVersionResults = checkoutResults;\n\n const { head, reset, latest, main, revert, verbose, all } = checkoutProps;\n\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = (failedComponents || []).filter((f) => !f.unchangedLegitimately);\n if (realFailedComponents.length) {\n throw new Error('checkout should throw in case of errors');\n }\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const notCheckedOutComponents = failedComponents || [];\n\n const getNotCheckedOutOutput = () => {\n if (!notCheckedOutComponents.length) return '';\n if (!verbose && all) {\n return chalk.green(\n `checkout was not needed for ${chalk.bold(\n notCheckedOutComponents.length.toString()\n )} components (use --verbose to get more details)\\n`\n );\n }\n const title = 'checkout was not required for the following component(s)';\n const body = notCheckedOutComponents\n .map((failedComponent) => `${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`)\n .join('\\n');\n return `${chalk.underline(title)}\\n${body}\\n\\n`;\n };\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `\\n\\nfiles with conflicts summary\\n`;\n const suggestion = `\\n\\nfix the conflicts above manually and then run \"bit install\".\nonce ready, snap/tag the components to persist the changes`;\n const conflictSummary = conflictSummaryReport(components);\n return chalk.underline(title) + conflictSummary.conflictStr + chalk.yellow(suggestion);\n };\n const getSuccessfulOutput = () => {\n if (!components || !components.length) return '';\n const newLine = '\\n';\n const switchedOrReverted = revert ? 'reverted' : 'switched';\n if (components.length === 1) {\n const component = components[0];\n const componentName = reset ? component.id.toString() : component.id.toStringWithoutVersion();\n if (reset) return `successfully reset ${chalk.bold(componentName)}\\n`;\n const title =\n alternativeTitle ||\n `successfully ${switchedOrReverted} ${chalk.bold(componentName)} to version ${chalk.bold(\n // @ts-ignore version is defined when !reset\n head || latest ? component.id.version : version\n )}`;\n return chalk.bold(title) + newLine + applyVersionReport(components, false);\n }\n if (reset) {\n const title = 'successfully reset the following components\\n\\n';\n const body = components.map((component) => chalk.bold(component.id.toString())).join('\\n');\n return chalk.underline(title) + body;\n }\n const getVerOutput = () => {\n if (head) return 'their head version';\n if (latest) return 'their latest version';\n if (main) return 'their main version';\n // @ts-ignore version is defined when !reset\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title =\n alternativeTitle || `successfully ${switchedOrReverted} ${components.length} components to ${versionOutput}`;\n const showVersion = head || reset;\n return chalk.bold(title) + newLine + applyVersionReport(components, true, showVersion);\n };\n const getNewOnLaneOutput = () => {\n if (!newFromLane?.length) return '';\n const title = newFromLaneAdded\n ? `successfully added the following components from the lane`\n : `the following components exist on the lane but were not added to the workspace. omit --workspace-only flag to add them`;\n const body = newFromLane.join('\\n');\n return `\\n\\n${chalk.underline(title)}\\n${body}`;\n };\n const getSummary = () => {\n const checkedOut = components?.length || 0;\n const notCheckedOutLegitimately = notCheckedOutComponents.length;\n const newLines = '\\n\\n';\n const title = chalk.bold.underline('Summary');\n const checkedOutStr = `\\nTotal Changed: ${chalk.bold(checkedOut.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(notCheckedOutLegitimately.toString())}`;\n const newOnLaneNum = newFromLane?.length || 0;\n const newOnLaneAddedStr = newFromLaneAdded ? ' (added)' : ' (not added)';\n const newOnLaneStr = newOnLaneNum\n ? `\\nNew on lane${newOnLaneAddedStr}: ${chalk.bold(newOnLaneNum.toString())}`\n : '';\n\n return newLines + title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr;\n };\n\n return (\n getNotCheckedOutOutput() +\n getSuccessfulOutput() +\n getRemovedOutput(removedComponents) +\n getAddedOutput(addedComponents) +\n getNewOnLaneOutput() +\n getConflictSummary() +\n getSummary() +\n installation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B,GAAGG,YAAY;EACnF,CAAC;EAED,OACEtC,sBAAsB,CAAC,CAAC,GACxBmB,mBAAmB,CAAC,CAAC,GACrB,IAAAoB,2BAAgB,EAACrD,iBAAiB,CAAC,GACnC,IAAAsD,yBAAc,EAACrD,eAAe,CAAC,GAC/B0C,kBAAkB,CAAC,CAAC,GACpBhB,kBAAkB,CAAC,CAAC,GACpBiB,UAAU,CAAC,CAAC,GACZ,IAAAW,kCAAuB,EAAClD,iBAAiB,CAAC,GAC1C,IAAAmD,iCAAsB,EAAClD,gBAAgB,CAAC;AAE5C"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_merging","_constants","_componentId","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","forceOurs","forceTheirs","autoMergeResolve","manual","all","workspaceOnly","verbose","skipDependencyInstallation","revert","BitError","HEAD","checkoutProps","promptMergeOptions","mergeStrategy","isLane","skipNpmInstall","head","LATEST","latest","reset","main","ComponentID","isValidVersion","version","checkoutResults","checkoutByCLIValues","checkoutOutput","exports","alternativeTitle","components","failedComponents","removedComponents","addedComponents","leftUnresolvedConflicts","newFromLane","newFromLaneAdded","installationError","compilationError","realFailedComponents","filter","f","unchangedLegitimately","length","Error","notCheckedOutComponents","getNotCheckedOutOutput","chalk","green","bold","toString","title","body","map","failedComponent","id","unchangedMessage","join","underline","getConflictSummary","suggestion","conflictSummary","conflictSummaryReport","conflictStr","yellow","getSuccessfulOutput","newLine","switchedOrReverted","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","getNewOnLaneOutput","getSummary","checkedOut","notCheckedOutLegitimately","checkedOutStr","unchangedLegitimatelyStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","compact","getRemovedOutput","getAddedOutput","installationErrorOutput","compilationErrorOutput"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport {\n ApplyVersionResults,\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n getRemovedOutput,\n getAddedOutput,\n} from '@teambit/merging';\nimport { COMPONENT_PATTERN_HELP, HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { CheckoutMain, CheckoutProps } from './checkout.main.runtime';\n\nexport class CheckoutCmd implements Command {\n name = 'checkout <to> [component-pattern]';\n arguments = [\n {\n name: 'to',\n description:\n \"permitted values: [head, latest, reset, specific-version]. 'head' - last snap/tag. 'latest' - semver latest tag. 'reset' - removes local changes\",\n },\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n description = 'switch between component versions or remove local changes';\n helpUrl = 'reference/components/merging-changes#checkout-snaps-to-the-working-directory';\n group = 'development';\n extendedDescription = `\n\\`bit checkout <version> [component-pattern]\\` => checkout the specified ids (or all components when --all is used) to the specified version\n\\`bit checkout head [component-pattern]\\` => checkout to the last snap/tag (use --latest if you only want semver tags), omit [component-pattern] to checkout head for all\n\\`bit checkout latest [component-pattern]\\` => checkout to the latest satisfying semver tag, omit [component-pattern] to checkout latest for all\n\\`bit checkout reset [component-pattern]\\` => remove local modifications from the specified ids (or all components when --all is used)\nwhen on a lane, \"checkout head\" only checks out components on this lane. to update main components, run \"bit lane merge main\"`;\n alias = 'U';\n options = [\n [\n 'i',\n 'interactive-merge',\n 'when a component is modified and the merge process found conflicts, display options to resolve them',\n ],\n [\n '',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of merge conflict, resolve according to the provided strategy: [ours, theirs, manual]',\n ],\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 ['a', 'all', 'all components'],\n [\n 'e',\n 'workspace-only',\n \"only relevant for 'bit checkout head' when on a lane. don't import components from the remote lane that are not already in the workspace\",\n ],\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['x', 'skip-dependency-installation', 'do not auto-install dependencies of the imported components'],\n ['', 'force-ours', 'do not merge, preserve local files as is'],\n ['', 'force-theirs', 'do not merge, just overwrite with incoming files'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [to, componentPattern]: [string, string],\n {\n interactiveMerge = false,\n forceOurs,\n forceTheirs,\n autoMergeResolve,\n manual,\n all = false,\n workspaceOnly = false,\n verbose = false,\n skipDependencyInstallation = false,\n revert = false,\n }: {\n interactiveMerge?: boolean;\n forceOurs?: boolean;\n forceTheirs?: boolean;\n autoMergeResolve?: MergeStrategy;\n manual?: boolean;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n revert?: boolean;\n }\n ) {\n if (forceOurs && forceTheirs) {\n throw new BitError('please use either --force-ours or --force-theirs, not both');\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 if (workspaceOnly && to !== HEAD) {\n throw new BitError('--workspace-only is only relevant when running \"bit checkout head\" on a lane');\n }\n const checkoutProps: CheckoutProps = {\n promptMergeOptions: interactiveMerge,\n mergeStrategy: autoMergeResolve,\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n workspaceOnly,\n revert,\n forceOurs,\n forceTheirs,\n };\n if (to === HEAD) checkoutProps.head = true;\n else if (to === LATEST) checkoutProps.latest = true;\n else if (to === 'reset') checkoutProps.reset = true;\n else if (to === 'main') checkoutProps.main = true;\n else {\n if (!ComponentID.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n\n const checkoutResults = await this.checkout.checkoutByCLIValues(componentPattern || '', checkoutProps);\n return checkoutOutput(checkoutResults, checkoutProps);\n }\n}\n\nexport function checkoutOutput(\n checkoutResults: ApplyVersionResults,\n checkoutProps: CheckoutProps,\n alternativeTitle?: string\n) {\n const {\n components,\n version,\n failedComponents,\n removedComponents,\n addedComponents,\n leftUnresolvedConflicts,\n newFromLane,\n newFromLaneAdded,\n installationError,\n compilationError,\n }: ApplyVersionResults = checkoutResults;\n\n const { head, reset, latest, main, revert, verbose, all } = checkoutProps;\n\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = (failedComponents || []).filter((f) => !f.unchangedLegitimately);\n if (realFailedComponents.length) {\n throw new Error('checkout should throw in case of errors');\n }\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const notCheckedOutComponents = failedComponents || [];\n\n const getNotCheckedOutOutput = () => {\n if (!notCheckedOutComponents.length) return '';\n if (!verbose && all) {\n return chalk.green(\n `checkout was not needed for ${chalk.bold(\n notCheckedOutComponents.length.toString()\n )} components (use --verbose to get more details)\\n`\n );\n }\n const title = 'checkout was not required for the following component(s)';\n const body = notCheckedOutComponents\n .map((failedComponent) => `${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`)\n .join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n };\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `files with conflicts summary\\n`;\n const suggestion = `\\n\\nfix the conflicts above manually and then run \"bit install\".\nonce ready, snap/tag the components to persist the changes`;\n const conflictSummary = conflictSummaryReport(components);\n return chalk.underline(title) + conflictSummary.conflictStr + chalk.yellow(suggestion);\n };\n const getSuccessfulOutput = () => {\n if (!components || !components.length) return '';\n const newLine = '\\n';\n const switchedOrReverted = revert ? 'reverted' : 'switched';\n if (components.length === 1) {\n const component = components[0];\n const componentName = reset ? component.id.toString() : component.id.toStringWithoutVersion();\n if (reset) return `successfully reset ${chalk.bold(componentName)}\\n`;\n const title =\n alternativeTitle ||\n `successfully ${switchedOrReverted} ${chalk.bold(componentName)} to version ${chalk.bold(\n // @ts-ignore version is defined when !reset\n head || latest ? component.id.version : version\n )}`;\n return chalk.bold(title) + newLine + applyVersionReport(components, false);\n }\n if (reset) {\n const title = 'successfully reset the following components\\n\\n';\n const body = components.map((component) => chalk.bold(component.id.toString())).join('\\n');\n return chalk.underline(title) + body;\n }\n const getVerOutput = () => {\n if (head) return 'their head version';\n if (latest) return 'their latest version';\n if (main) return 'their main version';\n // @ts-ignore version is defined when !reset\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title =\n alternativeTitle || `successfully ${switchedOrReverted} ${components.length} components to ${versionOutput}`;\n const showVersion = head || reset;\n return chalk.bold(title) + newLine + applyVersionReport(components, true, showVersion);\n };\n const getNewOnLaneOutput = () => {\n if (!newFromLane?.length) return '';\n const title = newFromLaneAdded\n ? `successfully added the following components from the lane`\n : `the following components exist on the lane but were not added to the workspace. omit --workspace-only flag to add them`;\n const body = newFromLane.join('\\n');\n return `${chalk.underline(title)}\\n${body}`;\n };\n const getSummary = () => {\n const checkedOut = components?.length || 0;\n const notCheckedOutLegitimately = notCheckedOutComponents.length;\n const title = chalk.bold.underline('Summary');\n const checkedOutStr = `\\nTotal Changed: ${chalk.bold(checkedOut.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(notCheckedOutLegitimately.toString())}`;\n const newOnLaneNum = newFromLane?.length || 0;\n const newOnLaneAddedStr = newFromLaneAdded ? ' (added)' : ' (not added)';\n const newOnLaneStr = newOnLaneNum\n ? `\\nNew on lane${newOnLaneAddedStr}: ${chalk.bold(newOnLaneNum.toString())}`\n : '';\n\n return title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr;\n };\n\n return compact([\n getNotCheckedOutOutput(),\n getSuccessfulOutput(),\n getRemovedOutput(removedComponents),\n getAddedOutput(addedComponents),\n getNewOnLaneOutput(),\n getConflictSummary(),\n getSummary(),\n installationErrorOutput(installationError),\n compilationErrorOutput(compilationError),\n ]).join('\\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;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,E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9C,WAAW,EAAEQ,MAAM,IAAI,CAAC;IAC7C,MAAMuC,iBAAiB,GAAG9C,gBAAgB,GAAG,UAAU,GAAG,cAAc;IACxE,MAAM+C,YAAY,GAAGF,YAAY,GAC5B,gBAAeC,iBAAkB,KAAInC,gBAAK,CAACE,IAAI,CAACgC,YAAY,CAAC/B,QAAQ,CAAC,CAAC,CAAE,EAAC,GAC3E,EAAE;IAEN,OAAOC,KAAK,GAAG4B,aAAa,GAAGC,wBAAwB,GAAGG,YAAY;EACxE,CAAC;EAED,OAAO,IAAAC,iBAAO,EAAC,CACbtC,sBAAsB,CAAC,CAAC,EACxBmB,mBAAmB,CAAC,CAAC,EACrB,IAAAoB,2BAAgB,EAACrD,iBAAiB,CAAC,EACnC,IAAAsD,yBAAc,EAACrD,eAAe,CAAC,EAC/B0C,kBAAkB,CAAC,CAAC,EACpBhB,kBAAkB,CAAC,CAAC,EACpBiB,UAAU,CAAC,CAAC,EACZ,IAAAW,kCAAuB,EAAClD,iBAAiB,CAAC,EAC1C,IAAAmD,iCAAsB,EAAClD,gBAAgB,CAAC,CACzC,CAAC,CAACmB,IAAI,CAAC,MAAM,CAAC;AACjB"}
@@ -53,7 +53,7 @@ export declare function updateFileStatus(files: SourceFile[], filesStatus: Files
53
53
  * this needs to be done *before* the component is written to the filesystem, otherwise, it won't work when a file
54
54
  * has a case change. e.g. from uppercase to lowercase. (see merge-lane.e2e 'renaming files from uppercase to lowercase').
55
55
  */
56
- export declare function removeFilesIfNeeded(filesStatus: FilesStatus, componentFromFS?: ConsumerComponent): Promise<void>;
56
+ export declare function removeFilesIfNeeded(filesStatus: FilesStatus, consumer: Consumer, componentFromFS?: ConsumerComponent): Promise<void>;
57
57
  /**
58
58
  * relevant only when
59
59
  * 1) there is no conflict => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.output.
@@ -122,7 +122,7 @@ mergeResults, checkoutProps) {
122
122
  if (componentFromFS && !componentMap) throw new (_generalError().default)('applyVersion: componentMap was not found');
123
123
  const files = component.files;
124
124
  updateFileStatus(files, filesStatus, componentFromFS || undefined);
125
- await removeFilesIfNeeded(filesStatus, componentFromFS || undefined);
125
+ await removeFilesIfNeeded(filesStatus, consumer, componentFromFS || undefined);
126
126
  if (mergeResults) {
127
127
  // update files according to the merge results
128
128
  const {
@@ -159,8 +159,14 @@ function updateFileStatus(files, filesStatus, componentFromFS) {
159
159
  * this needs to be done *before* the component is written to the filesystem, otherwise, it won't work when a file
160
160
  * has a case change. e.g. from uppercase to lowercase. (see merge-lane.e2e 'renaming files from uppercase to lowercase').
161
161
  */
162
- async function removeFilesIfNeeded(filesStatus, componentFromFS) {
162
+ async function removeFilesIfNeeded(filesStatus, consumer, componentFromFS) {
163
163
  if (!componentFromFS) return;
164
+ // @todo: if the component is not in the FS, it should be passed as undefined here.
165
+ // in the case this is coming from merge-lane, it's sometimes populated from the scope.
166
+ const isExistOnFs = consumer.bitMap.getComponentIdIfExist(componentFromFS.id, {
167
+ ignoreVersion: true
168
+ });
169
+ if (!isExistOnFs) return;
164
170
  const filePathsFromFS = componentFromFS.files || [];
165
171
  const dataToPersist = new (_dataToPersist().default)();
166
172
  filePathsFromFS.forEach(file => {
@@ -1 +1 @@
1
- {"version":3,"names":["path","data","_interopRequireWildcard","require","_generalError","_interopRequireDefault","_path2","_dataToPersist","_removePath","_mergeVersion","_bitError","_chalk","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","applyVersion","consumer","id","componentFromFS","mergeResults","checkoutProps","isLane","Error","toString","mergeStrategy","forceOurs","filesStatus","hasConflicts","MergeOptions","ours","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","bitMap","updateComponentId","applyVersionResult","component","loadComponentFromModelImportIfNeeded","componentMap","GeneralError","updateFileStatus","undefined","removeFilesIfNeeded","modifiedStatus","modifiedFiles","applyModifiedVersion","fileFromFs","find","f","areFilesEqual","Buffer","compare","contents","updated","filePathsFromFS","dataToPersist","DataToPersist","filename","removed","removePath","RemovePath","persistAllToFS","componentFiles","map","clone","manual","filePath","normalize","foundFile","componentFile","conflict","from","output","merged","isBinaryConflict","fsFile","binaryConflict","addFiles","m","added","deletedConflictFiles","removeFiles","remainDeletedFiles","remainDeleted","deletedConflict","overrideFiles","overridden","updatedFiles","content","throwForFailures","allComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","failedComponent","chalk","bold","red","join","BitError"],"sources":["checkout-version.ts"],"sourcesContent":["import * as path from 'path';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ComponentID } from '@teambit/component-id';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport Version from '@teambit/legacy/dist/scope/models/version';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux, PathOsBased } from '@teambit/legacy/dist/utils/path';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { FileStatus, MergeOptions, MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport { ApplyVersionResult, FilesStatus } from '@teambit/merging';\nimport { CheckoutProps } from './checkout.main.runtime';\n\nexport type ComponentStatusBase = {\n currentComponent?: ConsumerComponent;\n componentFromModel?: Version;\n id: ComponentID;\n shouldBeRemoved?: boolean; // in case the component is soft-removed, it should be removed from the workspace\n unchangedMessage?: string; // this gets populated either upon skip or failure.\n unchangedLegitimately?: boolean; // true for skipped legitimately (e.g. already up to date). false for failure.\n};\n\nexport type ComponentStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null | undefined;\n};\n\nexport type ApplyVersionWithComps = {\n applyVersionResult: ApplyVersionResult;\n component?: ConsumerComponent;\n // in case the component needs to be written to the filesystem, this is the component to write.\n legacyCompToWrite?: ConsumerComponent;\n};\n\n/**\n * This function optionally returns \"component\" object. If it returns, it means it needs to be written to the filesystem.\n * Otherwise, it means the component is already up to date and no need to write it.\n *\n * If no need to change anything (ours), then don't return the component object.\n * Otherwise, either return the component object as is (if no conflicts or \"theirs\"), or change the files in this\n * component object. Later, this component object is written to the filesystem.\n *\n * 1) when the files are modified with conflicts and the strategy is \"ours\", or forceOurs was used, leave the FS as is.\n *\n * 2) when the files are modified with conflicts and the strategy is \"theirs\", or forceTheirs was used, write the\n * component according to \"component\" object\n *\n * 3) when files are modified with no conflict or files are modified with conflicts and the\n * strategy is manual, load the component according to id.version and update component.files.\n * applyModifiedVersion() docs explains what files are updated/added.\n *\n * Side note:\n * Deleted file => if files are in used version but not in the modified one, no need to delete it. (similar to git).\n * Added file => if files are not in used version but in the modified one, they'll be under mergeResults.addFiles\n */\nexport async function applyVersion(\n consumer: Consumer,\n id: ComponentID,\n componentFromFS: ConsumerComponent | null | undefined, // it can be null only when isLanes is true\n mergeResults: MergeResultsThreeWay | null | undefined,\n checkoutProps: CheckoutProps\n): Promise<ApplyVersionWithComps> {\n if (!checkoutProps.isLane && !componentFromFS)\n throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n const { mergeStrategy, forceOurs } = checkoutProps;\n let filesStatus = {};\n if ((mergeResults?.hasConflicts && mergeStrategy === MergeOptions.ours) || forceOurs) {\n // even when isLane is true, the mergeResults is possible only when the component is on the filesystem\n // otherwise it's impossible to have conflicts\n if (!componentFromFS) throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n componentFromFS.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n consumer.bitMap.updateComponentId(id);\n return { applyVersionResult: { id, filesStatus } };\n }\n const component = await consumer.loadComponentFromModelImportIfNeeded(id);\n const componentMap = componentFromFS && componentFromFS.componentMap;\n if (componentFromFS && !componentMap) throw new GeneralError('applyVersion: componentMap was not found');\n\n const files = component.files;\n updateFileStatus(files, filesStatus, componentFromFS || undefined);\n\n await removeFilesIfNeeded(filesStatus, componentFromFS || undefined);\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n filesStatus = { ...filesStatus, ...modifiedStatus };\n component.files = modifiedFiles;\n }\n\n // in case of forceTheirs, the mergeResults is undefined, the \"component\" object is according to \"theirs\", so it'll work\n // expected. (later, it writes the component object).\n\n return {\n applyVersionResult: { id, filesStatus },\n component,\n };\n}\n\nexport function updateFileStatus(files: SourceFile[], filesStatus: FilesStatus, componentFromFS?: ConsumerComponent) {\n files.forEach((file) => {\n const fileFromFs = componentFromFS?.files.find((f) => f.relative === file.relative);\n const areFilesEqual = fileFromFs && Buffer.compare(fileFromFs.contents, file.contents) === 0;\n // @ts-ignore\n filesStatus[pathNormalizeToLinux(file.relative)] = areFilesEqual ? FileStatus.unchanged : FileStatus.updated;\n });\n}\n\n/**\n * when files exist on the filesystem but not on the checked out versions, they need to be deleted.\n * without this function, these files would be left on the filesystem. (we don't delete the comp-dir before writing).\n * this needs to be done *before* the component is written to the filesystem, otherwise, it won't work when a file\n * has a case change. e.g. from uppercase to lowercase. (see merge-lane.e2e 'renaming files from uppercase to lowercase').\n */\nexport async function removeFilesIfNeeded(filesStatus: FilesStatus, componentFromFS?: ConsumerComponent) {\n if (!componentFromFS) return;\n const filePathsFromFS = componentFromFS.files || [];\n const dataToPersist = new DataToPersist();\n filePathsFromFS.forEach((file) => {\n const filename = pathNormalizeToLinux(file.relative);\n if (!filesStatus[filename]) {\n // @ts-ignore todo: typescript has a good point here. it should be the string \"removed\", not chalk.green(removed).\n filesStatus[filename] = FileStatus.removed;\n dataToPersist.removePath(new RemovePath(file.path));\n }\n });\n await dataToPersist.persistAllToFS();\n}\n\n/**\n * relevant only when\n * 1) there is no conflict => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.output.\n * 2) there is conflict and mergeStrategy is manual => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.conflict.\n *\n * this function only updates the files content, it doesn't write the files\n */\nexport function applyModifiedVersion(\n componentFiles: SourceFile[],\n mergeResults: MergeResultsThreeWay,\n mergeStrategy: MergeStrategy | null | undefined\n): { filesStatus: Record<string, any>; modifiedFiles: SourceFile[] } {\n let modifiedFiles = componentFiles.map((file) => file.clone());\n const filesStatus = {};\n if (mergeResults.hasConflicts && mergeStrategy !== MergeOptions.manual) {\n return { filesStatus, modifiedFiles };\n }\n mergeResults.modifiedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n if (file.conflict) {\n foundFile.contents = Buffer.from(file.conflict);\n filesStatus[file.filePath] = FileStatus.manual;\n } else if (typeof file.output === 'string') {\n foundFile.contents = Buffer.from(file.output);\n filesStatus[file.filePath] = FileStatus.merged;\n } else if (file.isBinaryConflict) {\n // leave the file as is and notify the user later about it.\n foundFile.contents = file.fsFile.contents;\n filesStatus[file.filePath] = FileStatus.binaryConflict;\n } else {\n throw new GeneralError(`file ${filePath} does not have output nor conflict`);\n }\n });\n\n mergeResults.addFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n if (modifiedFiles.find((m) => m.relative === filePath)) return;\n modifiedFiles.push(file.fsFile);\n filesStatus[file.filePath] = FileStatus.added;\n });\n mergeResults.deletedConflictFiles.forEach((file) => {\n if (!file.fsFile) return;\n const filePath: PathOsBased = path.normalize(file.filePath);\n if (modifiedFiles.find((m) => m.relative === filePath)) return;\n modifiedFiles.push(file.fsFile);\n filesStatus[file.filePath] = FileStatus.added;\n });\n mergeResults.removeFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n filesStatus[file.filePath] = FileStatus.removed;\n modifiedFiles = modifiedFiles.filter((f) => f.relative !== filePath);\n });\n mergeResults.remainDeletedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n modifiedFiles = modifiedFiles.filter((f) => f.relative !== filePath);\n filesStatus[file.filePath] = FileStatus.remainDeleted;\n });\n mergeResults.deletedConflictFiles.forEach((file) => {\n filesStatus[file.filePath] = FileStatus.deletedConflict;\n });\n\n mergeResults.overrideFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n foundFile.contents = file.fsFile.contents;\n filesStatus[file.filePath] = FileStatus.overridden;\n });\n mergeResults.updatedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n foundFile.contents = file.content;\n filesStatus[file.filePath] = FileStatus.updated;\n });\n\n return { filesStatus, modifiedFiles };\n}\n\nexport function throwForFailures(allComponentsStatus: ComponentStatusBase[]) {\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to proceed due to the following failures:\\n${failureMsgs}`);\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,YAAAA,CAAA;IAAA,O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AAI,CAAC4D,OAAO;IACjCjE,WAAW,CAACK,IAAI,CAACsC,QAAQ,CAAC,GAAGnC,0BAAU,CAACsB,OAAO;EACjD,CAAC,CAAC;EAEF,OAAO;IAAE9B,WAAW;IAAEqB;EAAc,CAAC;AACvC;AAEO,SAAS6C,gBAAgBA,CAACC,mBAA0C,EAAE;EAC3E,MAAMC,gBAAgB,GAAGD,mBAAmB,CAACpG,MAAM,CAAEsG,CAAC,IAAKA,CAAC,CAACC,gBAAgB,IAAI,CAACD,CAAC,CAACE,qBAAqB,CAAC;EAC1G,IAAIH,gBAAgB,CAAC/F,MAAM,EAAE;IAC3B,MAAMmG,WAAW,GAAGJ,gBAAgB,CACjC5B,GAAG,CACDiC,eAAe,IACb,GAAEC,gBAAK,CAACC,IAAI,CAACF,eAAe,CAAClF,EAAE,CAACM,QAAQ,CAAC,CAAC,CAAE,MAAK6E,gBAAK,CAACE,GAAG,CAACH,eAAe,CAACH,gBAA0B,CAAE,EAC5G,CAAC,CACAO,IAAI,CAAC,IAAI,CAAC;IACb,MAAM,KAAIC,oBAAQ,EAAE,qDAAoDN,WAAY,EAAC,CAAC;EACxF;AACF"}
1
+ {"version":3,"names":["path","data","_interopRequireWildcard","require","_generalError","_interopRequireDefault","_path2","_dataToPersist","_removePath","_mergeVersion","_bitError","_chalk","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","applyVersion","consumer","id","componentFromFS","mergeResults","checkoutProps","isLane","Error","toString","mergeStrategy","forceOurs","filesStatus","hasConflicts","MergeOptions","ours","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","bitMap","updateComponentId","applyVersionResult","component","loadComponentFromModelImportIfNeeded","componentMap","GeneralError","updateFileStatus","undefined","removeFilesIfNeeded","modifiedStatus","modifiedFiles","applyModifiedVersion","fileFromFs","find","f","areFilesEqual","Buffer","compare","contents","updated","isExistOnFs","getComponentIdIfExist","ignoreVersion","filePathsFromFS","dataToPersist","DataToPersist","filename","removed","removePath","RemovePath","persistAllToFS","componentFiles","map","clone","manual","filePath","normalize","foundFile","componentFile","conflict","from","output","merged","isBinaryConflict","fsFile","binaryConflict","addFiles","m","added","deletedConflictFiles","removeFiles","remainDeletedFiles","remainDeleted","deletedConflict","overrideFiles","overridden","updatedFiles","content","throwForFailures","allComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","failedComponent","chalk","bold","red","join","BitError"],"sources":["checkout-version.ts"],"sourcesContent":["import * as path from 'path';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ComponentID } from '@teambit/component-id';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport Version from '@teambit/legacy/dist/scope/models/version';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux, PathOsBased } from '@teambit/legacy/dist/utils/path';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { FileStatus, MergeOptions, MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport { ApplyVersionResult, FilesStatus } from '@teambit/merging';\nimport { CheckoutProps } from './checkout.main.runtime';\n\nexport type ComponentStatusBase = {\n currentComponent?: ConsumerComponent;\n componentFromModel?: Version;\n id: ComponentID;\n shouldBeRemoved?: boolean; // in case the component is soft-removed, it should be removed from the workspace\n unchangedMessage?: string; // this gets populated either upon skip or failure.\n unchangedLegitimately?: boolean; // true for skipped legitimately (e.g. already up to date). false for failure.\n};\n\nexport type ComponentStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null | undefined;\n};\n\nexport type ApplyVersionWithComps = {\n applyVersionResult: ApplyVersionResult;\n component?: ConsumerComponent;\n // in case the component needs to be written to the filesystem, this is the component to write.\n legacyCompToWrite?: ConsumerComponent;\n};\n\n/**\n * This function optionally returns \"component\" object. If it returns, it means it needs to be written to the filesystem.\n * Otherwise, it means the component is already up to date and no need to write it.\n *\n * If no need to change anything (ours), then don't return the component object.\n * Otherwise, either return the component object as is (if no conflicts or \"theirs\"), or change the files in this\n * component object. Later, this component object is written to the filesystem.\n *\n * 1) when the files are modified with conflicts and the strategy is \"ours\", or forceOurs was used, leave the FS as is.\n *\n * 2) when the files are modified with conflicts and the strategy is \"theirs\", or forceTheirs was used, write the\n * component according to \"component\" object\n *\n * 3) when files are modified with no conflict or files are modified with conflicts and the\n * strategy is manual, load the component according to id.version and update component.files.\n * applyModifiedVersion() docs explains what files are updated/added.\n *\n * Side note:\n * Deleted file => if files are in used version but not in the modified one, no need to delete it. (similar to git).\n * Added file => if files are not in used version but in the modified one, they'll be under mergeResults.addFiles\n */\nexport async function applyVersion(\n consumer: Consumer,\n id: ComponentID,\n componentFromFS: ConsumerComponent | null | undefined, // it can be null only when isLanes is true\n mergeResults: MergeResultsThreeWay | null | undefined,\n checkoutProps: CheckoutProps\n): Promise<ApplyVersionWithComps> {\n if (!checkoutProps.isLane && !componentFromFS)\n throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n const { mergeStrategy, forceOurs } = checkoutProps;\n let filesStatus = {};\n if ((mergeResults?.hasConflicts && mergeStrategy === MergeOptions.ours) || forceOurs) {\n // even when isLane is true, the mergeResults is possible only when the component is on the filesystem\n // otherwise it's impossible to have conflicts\n if (!componentFromFS) throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n componentFromFS.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n consumer.bitMap.updateComponentId(id);\n return { applyVersionResult: { id, filesStatus } };\n }\n const component = await consumer.loadComponentFromModelImportIfNeeded(id);\n const componentMap = componentFromFS && componentFromFS.componentMap;\n if (componentFromFS && !componentMap) throw new GeneralError('applyVersion: componentMap was not found');\n\n const files = component.files;\n updateFileStatus(files, filesStatus, componentFromFS || undefined);\n\n await removeFilesIfNeeded(filesStatus, consumer, componentFromFS || undefined);\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n filesStatus = { ...filesStatus, ...modifiedStatus };\n component.files = modifiedFiles;\n }\n\n // in case of forceTheirs, the mergeResults is undefined, the \"component\" object is according to \"theirs\", so it'll work\n // expected. (later, it writes the component object).\n\n return {\n applyVersionResult: { id, filesStatus },\n component,\n };\n}\n\nexport function updateFileStatus(files: SourceFile[], filesStatus: FilesStatus, componentFromFS?: ConsumerComponent) {\n files.forEach((file) => {\n const fileFromFs = componentFromFS?.files.find((f) => f.relative === file.relative);\n const areFilesEqual = fileFromFs && Buffer.compare(fileFromFs.contents, file.contents) === 0;\n // @ts-ignore\n filesStatus[pathNormalizeToLinux(file.relative)] = areFilesEqual ? FileStatus.unchanged : FileStatus.updated;\n });\n}\n\n/**\n * when files exist on the filesystem but not on the checked out versions, they need to be deleted.\n * without this function, these files would be left on the filesystem. (we don't delete the comp-dir before writing).\n * this needs to be done *before* the component is written to the filesystem, otherwise, it won't work when a file\n * has a case change. e.g. from uppercase to lowercase. (see merge-lane.e2e 'renaming files from uppercase to lowercase').\n */\nexport async function removeFilesIfNeeded(\n filesStatus: FilesStatus,\n consumer: Consumer,\n componentFromFS?: ConsumerComponent\n) {\n if (!componentFromFS) return;\n // @todo: if the component is not in the FS, it should be passed as undefined here.\n // in the case this is coming from merge-lane, it's sometimes populated from the scope.\n const isExistOnFs = consumer.bitMap.getComponentIdIfExist(componentFromFS.id, { ignoreVersion: true });\n if (!isExistOnFs) return;\n const filePathsFromFS = componentFromFS.files || [];\n const dataToPersist = new DataToPersist();\n filePathsFromFS.forEach((file) => {\n const filename = pathNormalizeToLinux(file.relative);\n if (!filesStatus[filename]) {\n // @ts-ignore todo: typescript has a good point here. it should be the string \"removed\", not chalk.green(removed).\n filesStatus[filename] = FileStatus.removed;\n dataToPersist.removePath(new RemovePath(file.path));\n }\n });\n await dataToPersist.persistAllToFS();\n}\n\n/**\n * relevant only when\n * 1) there is no conflict => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.output.\n * 2) there is conflict and mergeStrategy is manual => add files from mergeResults: addFiles, overrideFiles and modifiedFiles.conflict.\n *\n * this function only updates the files content, it doesn't write the files\n */\nexport function applyModifiedVersion(\n componentFiles: SourceFile[],\n mergeResults: MergeResultsThreeWay,\n mergeStrategy: MergeStrategy | null | undefined\n): { filesStatus: Record<string, any>; modifiedFiles: SourceFile[] } {\n let modifiedFiles = componentFiles.map((file) => file.clone());\n const filesStatus = {};\n if (mergeResults.hasConflicts && mergeStrategy !== MergeOptions.manual) {\n return { filesStatus, modifiedFiles };\n }\n mergeResults.modifiedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n if (file.conflict) {\n foundFile.contents = Buffer.from(file.conflict);\n filesStatus[file.filePath] = FileStatus.manual;\n } else if (typeof file.output === 'string') {\n foundFile.contents = Buffer.from(file.output);\n filesStatus[file.filePath] = FileStatus.merged;\n } else if (file.isBinaryConflict) {\n // leave the file as is and notify the user later about it.\n foundFile.contents = file.fsFile.contents;\n filesStatus[file.filePath] = FileStatus.binaryConflict;\n } else {\n throw new GeneralError(`file ${filePath} does not have output nor conflict`);\n }\n });\n\n mergeResults.addFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n if (modifiedFiles.find((m) => m.relative === filePath)) return;\n modifiedFiles.push(file.fsFile);\n filesStatus[file.filePath] = FileStatus.added;\n });\n mergeResults.deletedConflictFiles.forEach((file) => {\n if (!file.fsFile) return;\n const filePath: PathOsBased = path.normalize(file.filePath);\n if (modifiedFiles.find((m) => m.relative === filePath)) return;\n modifiedFiles.push(file.fsFile);\n filesStatus[file.filePath] = FileStatus.added;\n });\n mergeResults.removeFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n filesStatus[file.filePath] = FileStatus.removed;\n modifiedFiles = modifiedFiles.filter((f) => f.relative !== filePath);\n });\n mergeResults.remainDeletedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n modifiedFiles = modifiedFiles.filter((f) => f.relative !== filePath);\n filesStatus[file.filePath] = FileStatus.remainDeleted;\n });\n mergeResults.deletedConflictFiles.forEach((file) => {\n filesStatus[file.filePath] = FileStatus.deletedConflict;\n });\n\n mergeResults.overrideFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n foundFile.contents = file.fsFile.contents;\n filesStatus[file.filePath] = FileStatus.overridden;\n });\n mergeResults.updatedFiles.forEach((file) => {\n const filePath: PathOsBased = path.normalize(file.filePath);\n const foundFile = modifiedFiles.find((componentFile) => componentFile.relative === filePath);\n if (!foundFile) throw new GeneralError(`file ${filePath} not found`);\n foundFile.contents = file.content;\n filesStatus[file.filePath] = FileStatus.updated;\n });\n\n return { filesStatus, modifiedFiles };\n}\n\nexport function throwForFailures(allComponentsStatus: ComponentStatusBase[]) {\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\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.cloud/teambit/component/checkout",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "checkout",
9
- "version": "1.0.138"
9
+ "version": "1.0.140"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -16,12 +16,12 @@
16
16
  "@teambit/component-id": "1.2.0",
17
17
  "@teambit/harmony": "0.4.6",
18
18
  "@teambit/cli": "0.0.848",
19
- "@teambit/merging": "1.0.138",
20
- "@teambit/component-writer": "1.0.138",
21
- "@teambit/importer": "1.0.138",
19
+ "@teambit/merging": "1.0.140",
20
+ "@teambit/component-writer": "1.0.140",
21
+ "@teambit/importer": "1.0.140",
22
22
  "@teambit/logger": "0.0.941",
23
- "@teambit/remove": "1.0.138",
24
- "@teambit/workspace": "1.0.138"
23
+ "@teambit/remove": "1.0.140",
24
+ "@teambit/workspace": "1.0.140"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/lodash": "4.14.165",