@teambit/checkout 0.0.186 → 0.0.188

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.
@@ -15,14 +15,14 @@ export declare class CheckoutCmd implements Command {
15
15
  options: CommandOptions;
16
16
  loader: boolean;
17
17
  constructor(checkout: CheckoutMain);
18
- report([to, componentPattern]: [string, string], { interactiveMerge, ours, theirs, manual, reset, all, entireLane, verbose, skipNpmInstall, skipDependencyInstallation, }: {
18
+ report([to, componentPattern]: [string, string], { interactiveMerge, ours, theirs, manual, reset, all, workspaceOnly, verbose, skipNpmInstall, skipDependencyInstallation, }: {
19
19
  interactiveMerge?: boolean;
20
20
  ours?: boolean;
21
21
  theirs?: boolean;
22
22
  manual?: boolean;
23
23
  reset?: boolean;
24
24
  all?: boolean;
25
- entireLane?: boolean;
25
+ workspaceOnly?: boolean;
26
26
  verbose?: boolean;
27
27
  skipNpmInstall?: boolean;
28
28
  skipDependencyInstallation?: boolean;
@@ -69,7 +69,7 @@ class CheckoutCmd {
69
69
  \`bit checkout latest [component-pattern]\` => checkout to the latest satisfying semver tag, omit [component-pattern] to checkout latest for all
70
70
  \`bit checkout reset [component-pattern]\` => remove local modifications from the specified ids (or all components when --all is used)`);
71
71
  (0, _defineProperty2().default)(this, "alias", 'U');
72
- (0, _defineProperty2().default)(this, "options", [['i', 'interactive-merge', 'when a component is modified and the merge process found conflicts, display options to resolve them'], ['o', 'ours', 'in case of a conflict, override the used version with the current modification'], ['t', 'theirs', 'in case of a conflict, override the current modification with the specified version'], ['m', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'], ['r', 'reset', 'revert changes that were not snapped/tagged'], ['a', 'all', 'all components'], ['e', 'entire-lane', 'write also new components that were introduced on the remote lane and do not exist locally'], ['v', 'verbose', 'showing verbose output for inspection'], ['', 'reset', 'DEPRECATED. run "bit checkout reset" instead'], ['', 'skip-npm-install', 'DEPRECATED. use "--skip-dependency-installation" instead'], ['x', 'skip-dependency-installation', 'do not install packages of the imported components']]);
72
+ (0, _defineProperty2().default)(this, "options", [['i', 'interactive-merge', 'when a component is modified and the merge process found conflicts, display options to resolve them'], ['o', 'ours', 'in case of a conflict, override the used version with the current modification'], ['t', 'theirs', 'in case of a conflict, override the current modification with the specified version'], ['m', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'], ['r', 'reset', 'revert changes that were not snapped/tagged'], ['a', 'all', 'all components'], ['e', 'workspace-only', 'when on a lane, avoid introducing new components from the remote lane that do not exist locally'], ['v', 'verbose', 'showing verbose output for inspection'], ['', 'reset', 'DEPRECATED. run "bit checkout reset" instead'], ['', 'skip-npm-install', 'DEPRECATED. use "--skip-dependency-installation" instead'], ['x', 'skip-dependency-installation', 'do not install packages of the imported components']]);
73
73
  (0, _defineProperty2().default)(this, "loader", true);
74
74
  }
75
75
  async report([to, componentPattern], {
@@ -79,7 +79,7 @@ class CheckoutCmd {
79
79
  manual = false,
80
80
  reset = false,
81
81
  all = false,
82
- entireLane = false,
82
+ workspaceOnly = false,
83
83
  verbose = false,
84
84
  skipNpmInstall = false,
85
85
  skipDependencyInstallation = false
@@ -99,7 +99,7 @@ class CheckoutCmd {
99
99
  verbose,
100
100
  isLane: false,
101
101
  skipNpmInstall: skipDependencyInstallation,
102
- entireLane
102
+ workspaceOnly
103
103
  };
104
104
  const {
105
105
  components,
@@ -170,7 +170,7 @@ once ready, snap/tag the components to persist the changes`;
170
170
  };
171
171
  const getNewOnLaneOutput = () => {
172
172
  if (!(newFromLane !== null && newFromLane !== void 0 && newFromLane.length)) return '';
173
- const title = newFromLaneAdded ? `successfully added the following components from the lane` : `the following components introduced on the lane and were not added. use --entire-lane flag to add them`;
173
+ const title = newFromLaneAdded ? `successfully added the following components from the lane` : `the following components introduced on the lane and were not added. omit --workspace-only flag to add them`;
174
174
  const body = newFromLane.join('\n');
175
175
  return `\n\n${_chalk().default.underline(title)}\n${body}`;
176
176
  };
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","ours","theirs","manual","reset","all","entireLane","verbose","skipNpmInstall","skipDependencyInstallation","BitError","console","log","chalk","yellow","checkoutProps","promptMergeOptions","mergeStrategy","getMergeStrategy","isLane","components","version","failedComponents","leftUnresolvedConflicts","newFromLane","newFromLaneAdded","installationError","compilationError","checkoutByCLIValues","isHead","isReset","isLatest","realFailedComponents","filter","f","unchangedLegitimately","notCheckedOutComponents","getFailureOutput","length","title","body","map","failedComponent","bold","id","toString","red","failureMessage","join","underline","getNotCheckedOutOutput","green","getConflictSummary","suggestion","conflictSummaryReport","getSuccessfulOutput","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","componentsStr","getNewOnLaneOutput","getSummary","checkedOut","notCheckedOutLegitimately","failedToCheckOut","newLines","checkedOutStr","unchangedLegitimatelyStr","failedToCheckOutStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","installationErrorOutput","compilationErrorOutput"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n ApplyVersionResults,\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n} from '@teambit/merging';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { getMergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\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 = 'docs/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, 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)`;\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 ['o', 'ours', 'in case of a conflict, override the used version with the current modification'],\n ['t', 'theirs', 'in case of a conflict, override the current modification with the specified version'],\n ['m', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'],\n ['r', 'reset', 'revert changes that were not snapped/tagged'],\n ['a', 'all', 'all components'],\n ['e', 'entire-lane', 'write also new components that were introduced on the remote lane and do not exist locally'],\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['', 'reset', 'DEPRECATED. run \"bit checkout reset\" instead'],\n ['', 'skip-npm-install', 'DEPRECATED. use \"--skip-dependency-installation\" instead'],\n ['x', 'skip-dependency-installation', 'do not install packages of the imported components'],\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 ours = false,\n theirs = false,\n manual = false,\n reset = false,\n all = false,\n entireLane = false,\n verbose = false,\n skipNpmInstall = false,\n skipDependencyInstallation = false,\n }: {\n interactiveMerge?: boolean;\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n reset?: boolean;\n all?: boolean;\n entireLane?: boolean;\n verbose?: boolean;\n skipNpmInstall?: boolean;\n skipDependencyInstallation?: boolean;\n }\n ) {\n if (reset) {\n throw new BitError(`--reset flag has been removed. please run \"bit checkout reset\" instead`);\n }\n if (skipNpmInstall) {\n // eslint-disable-next-line no-console\n console.log(\n chalk.yellow(`\"--skip-npm-install\" has been deprecated, please use \"--skip-dependency-installation\" instead`)\n );\n skipDependencyInstallation = true;\n }\n const checkoutProps: CheckoutProps = {\n promptMergeOptions: interactiveMerge,\n mergeStrategy: getMergeStrategy(ours, theirs, manual),\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n entireLane,\n };\n const {\n components,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane,\n newFromLaneAdded,\n installationError,\n compilationError,\n }: ApplyVersionResults = await this.checkout.checkoutByCLIValues(to, componentPattern || '', checkoutProps);\n const isHead = to === 'head';\n const isReset = to === 'reset';\n const isLatest = to === 'latest';\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = (failedComponents || []).filter((f) => !f.unchangedLegitimately);\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const notCheckedOutComponents = (failedComponents || []).filter((f) => f.unchangedLegitimately);\n\n const getFailureOutput = () => {\n if (!realFailedComponents.length) return '';\n const title = 'the checkout has been failed on the following component(s)';\n const body = realFailedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.failureMessage)}`\n )\n .join('\\n');\n return `${chalk.underline(title)}\\n${body}\\n\\n`;\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 = 'the checkout was not needed on the following component(s)';\n const body = notCheckedOutComponents\n .map((failedComponent) => `${failedComponent.id.toString()} - ${failedComponent.failureMessage}`)\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\" and \"bit compile\".\nonce ready, snap/tag the components to persist the changes`;\n return chalk.underline(title) + conflictSummaryReport(components) + chalk.yellow(suggestion);\n };\n const getSuccessfulOutput = () => {\n if (!components || !components.length) return '';\n if (components.length === 1) {\n const component = components[0];\n const componentName = isReset ? component.id.toString() : component.id.toStringWithoutVersion();\n if (isReset) return `successfully reset ${chalk.bold(componentName)}\\n`;\n const title = `successfully switched ${chalk.bold(componentName)} to version ${chalk.bold(\n // @ts-ignore version is defined when !isReset\n isHead || isLatest ? component.id.version : version\n )}\\n`;\n return `${chalk.underline(title)} ${applyVersionReport(components, false)}`;\n }\n if (isReset) {\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 (isHead) return 'their head version';\n if (isLatest) return 'their latest version';\n // @ts-ignore version is defined when !isReset\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title = `successfully switched the following components to ${versionOutput}\\n\\n`;\n const showVersion = isHead || isReset;\n const componentsStr = applyVersionReport(components, true, showVersion);\n return chalk.underline(title) + componentsStr;\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 introduced on the lane and were not added. use --entire-lane 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 failedToCheckOut = realFailedComponents.length;\n const newLines = '\\n\\n';\n const title = chalk.bold.underline('Checkout Summary');\n const checkedOutStr = `\\nTotal CheckedOut: ${chalk.bold(checkedOut.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(notCheckedOutLegitimately.toString())}`;\n const failedToCheckOutStr = `\\nTotal Failed: ${chalk.bold(failedToCheckOut.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 + failedToCheckOutStr + newOnLaneStr;\n };\n\n return (\n getFailureOutput() +\n getNotCheckedOutOutput() +\n getSuccessfulOutput() +\n getNewOnLaneOutput() +\n getConflictSummary() +\n getSummary() +\n installationErrorOutput(installationError) +\n compilationErrorOutput(compilationError)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,WAAW,CAAoB;EAyC1CC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,8CAxCnC,mCAAmC;IAAA,mDAC9B,CACV;MACEC,IAAI,EAAE,IAAI;MACVC,WAAW,EACT;IACJ,CAAC,EACD;MACED,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAEC;IACf,CAAC,CACF;IAAA,qDACa,2DAA2D;IAAA,iDAC/D,yEAAyE;IAAA,+CAC3E,aAAa;IAAA,6DACE;AACzB;AACA;AACA;AACA,yIAAyI;IAAA,+CAC/H,GAAG;IAAA,iDACD,CACR,CACE,GAAG,EACH,mBAAmB,EACnB,qGAAqG,CACtG,EACD,CAAC,GAAG,EAAE,MAAM,EAAE,gFAAgF,CAAC,EAC/F,CAAC,GAAG,EAAE,QAAQ,EAAE,qFAAqF,CAAC,EACtG,CAAC,GAAG,EAAE,QAAQ,EAAE,6FAA6F,CAAC,EAC9G,CAAC,GAAG,EAAE,OAAO,EAAE,6CAA6C,CAAC,EAC7D,CAAC,GAAG,E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gB,EAAE,GAClBa,sBAAsB,EAAE,GACxBK,mBAAmB,EAAE,GACrBS,kBAAkB,EAAE,GACpBZ,kBAAkB,EAAE,GACpBa,UAAU,EAAE,GACZ,IAAAW,kCAAuB,EAAClD,iBAAiB,CAAC,GAC1C,IAAAmD,iCAAsB,EAAClD,gBAAgB,CAAC;EAE5C;AACF;AAAC"}
1
+ {"version":3,"names":["CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","ours","theirs","manual","reset","all","workspaceOnly","verbose","skipNpmInstall","skipDependencyInstallation","BitError","console","log","chalk","yellow","checkoutProps","promptMergeOptions","mergeStrategy","getMergeStrategy","isLane","components","version","failedComponents","leftUnresolvedConflicts","newFromLane","newFromLaneAdded","installationError","compilationError","checkoutByCLIValues","isHead","isReset","isLatest","realFailedComponents","filter","f","unchangedLegitimately","notCheckedOutComponents","getFailureOutput","length","title","body","map","failedComponent","bold","id","toString","red","failureMessage","join","underline","getNotCheckedOutOutput","green","getConflictSummary","suggestion","conflictSummaryReport","getSuccessfulOutput","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","componentsStr","getNewOnLaneOutput","getSummary","checkedOut","notCheckedOutLegitimately","failedToCheckOut","newLines","checkedOutStr","unchangedLegitimatelyStr","failedToCheckOutStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","installationErrorOutput","compilationErrorOutput"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport {\n ApplyVersionResults,\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n} from '@teambit/merging';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { getMergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\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 = 'docs/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, 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)`;\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 ['o', 'ours', 'in case of a conflict, override the used version with the current modification'],\n ['t', 'theirs', 'in case of a conflict, override the current modification with the specified version'],\n ['m', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'],\n ['r', 'reset', 'revert changes that were not snapped/tagged'],\n ['a', 'all', 'all components'],\n [\n 'e',\n 'workspace-only',\n 'when on a lane, avoid introducing new components from the remote lane that do not exist locally',\n ],\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['', 'reset', 'DEPRECATED. run \"bit checkout reset\" instead'],\n ['', 'skip-npm-install', 'DEPRECATED. use \"--skip-dependency-installation\" instead'],\n ['x', 'skip-dependency-installation', 'do not install packages of the imported components'],\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 ours = false,\n theirs = false,\n manual = false,\n reset = false,\n all = false,\n workspaceOnly = false,\n verbose = false,\n skipNpmInstall = false,\n skipDependencyInstallation = false,\n }: {\n interactiveMerge?: boolean;\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n reset?: boolean;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipNpmInstall?: boolean;\n skipDependencyInstallation?: boolean;\n }\n ) {\n if (reset) {\n throw new BitError(`--reset flag has been removed. please run \"bit checkout reset\" instead`);\n }\n if (skipNpmInstall) {\n // eslint-disable-next-line no-console\n console.log(\n chalk.yellow(`\"--skip-npm-install\" has been deprecated, please use \"--skip-dependency-installation\" instead`)\n );\n skipDependencyInstallation = true;\n }\n const checkoutProps: CheckoutProps = {\n promptMergeOptions: interactiveMerge,\n mergeStrategy: getMergeStrategy(ours, theirs, manual),\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n workspaceOnly,\n };\n const {\n components,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane,\n newFromLaneAdded,\n installationError,\n compilationError,\n }: ApplyVersionResults = await this.checkout.checkoutByCLIValues(to, componentPattern || '', checkoutProps);\n const isHead = to === 'head';\n const isReset = to === 'reset';\n const isLatest = to === 'latest';\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = (failedComponents || []).filter((f) => !f.unchangedLegitimately);\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const notCheckedOutComponents = (failedComponents || []).filter((f) => f.unchangedLegitimately);\n\n const getFailureOutput = () => {\n if (!realFailedComponents.length) return '';\n const title = 'the checkout has been failed on the following component(s)';\n const body = realFailedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.failureMessage)}`\n )\n .join('\\n');\n return `${chalk.underline(title)}\\n${body}\\n\\n`;\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 = 'the checkout was not needed on the following component(s)';\n const body = notCheckedOutComponents\n .map((failedComponent) => `${failedComponent.id.toString()} - ${failedComponent.failureMessage}`)\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\" and \"bit compile\".\nonce ready, snap/tag the components to persist the changes`;\n return chalk.underline(title) + conflictSummaryReport(components) + chalk.yellow(suggestion);\n };\n const getSuccessfulOutput = () => {\n if (!components || !components.length) return '';\n if (components.length === 1) {\n const component = components[0];\n const componentName = isReset ? component.id.toString() : component.id.toStringWithoutVersion();\n if (isReset) return `successfully reset ${chalk.bold(componentName)}\\n`;\n const title = `successfully switched ${chalk.bold(componentName)} to version ${chalk.bold(\n // @ts-ignore version is defined when !isReset\n isHead || isLatest ? component.id.version : version\n )}\\n`;\n return `${chalk.underline(title)} ${applyVersionReport(components, false)}`;\n }\n if (isReset) {\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 (isHead) return 'their head version';\n if (isLatest) return 'their latest version';\n // @ts-ignore version is defined when !isReset\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title = `successfully switched the following components to ${versionOutput}\\n\\n`;\n const showVersion = isHead || isReset;\n const componentsStr = applyVersionReport(components, true, showVersion);\n return chalk.underline(title) + componentsStr;\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 introduced on the lane and were not added. 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 failedToCheckOut = realFailedComponents.length;\n const newLines = '\\n\\n';\n const title = chalk.bold.underline('Checkout Summary');\n const checkedOutStr = `\\nTotal CheckedOut: ${chalk.bold(checkedOut.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(notCheckedOutLegitimately.toString())}`;\n const failedToCheckOutStr = `\\nTotal Failed: ${chalk.bold(failedToCheckOut.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 + failedToCheckOutStr + newOnLaneStr;\n };\n\n return (\n getFailureOutput() +\n getNotCheckedOutOutput() +\n getSuccessfulOutput() +\n getNewOnLaneOutput() +\n getConflictSummary() +\n getSummary() +\n installationErrorOutput(installationError) +\n compilationErrorOutput(compilationError)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,WAAW,CAAoB;EA6C1CC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,8CA5CnC,mCAAmC;IAAA,mDAC9B,CACV;MACEC,IAAI,EAAE,IAAI;MACVC,WAAW,EACT;IACJ,CAAC,EACD;MACED,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAEC;IACf,CAAC,CACF;IAAA,qDACa,2DAA2D;IAAA,iDAC/D,yEAAyE;IAAA,+CAC3E,aAAa;IAAA,6DACE;AACzB;AACA;AACA;AACA,yIAAyI;IAAA,+CAC/H,GAAG;IAAA,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cAAc;MACxE,MAAMkD,YAAY,GAAGF,YAAY,GAC5B,gBAAeC,iBAAkB,KAAI7D,gBAAK,CAAC8B,IAAI,CAAC8B,YAAY,CAAC5B,QAAQ,EAAE,CAAE,EAAC,GAC3E,EAAE;MAEN,OAAOwB,QAAQ,GAAG9B,KAAK,GAAG+B,aAAa,GAAGC,wBAAwB,GAAGC,mBAAmB,GAAGG,YAAY;IACzG,CAAC;IAED,OACEtC,gBAAgB,EAAE,GAClBa,sBAAsB,EAAE,GACxBK,mBAAmB,EAAE,GACrBS,kBAAkB,EAAE,GACpBZ,kBAAkB,EAAE,GACpBa,UAAU,EAAE,GACZ,IAAAW,kCAAuB,EAAClD,iBAAiB,CAAC,GAC1C,IAAAmD,iCAAsB,EAAClD,gBAAgB,CAAC;EAE5C;AACF;AAAC"}
@@ -20,7 +20,7 @@ export declare type CheckoutProps = {
20
20
  reset?: boolean;
21
21
  all?: boolean;
22
22
  isLane?: boolean;
23
- entireLane?: boolean;
23
+ workspaceOnly?: boolean;
24
24
  };
25
25
  export declare type ComponentStatusBeforeMergeAttempt = {
26
26
  componentFromFS?: ConsumerComponent;
@@ -221,7 +221,7 @@ class CheckoutMain {
221
221
  let newFromLaneAdded = false;
222
222
  if (checkoutProps.head) {
223
223
  newFromLane = await this.getNewComponentsFromLane(checkoutProps.ids || []);
224
- if (checkoutProps.entireLane) {
224
+ if (!checkoutProps.workspaceOnly) {
225
225
  const compsNewFromLane = await Promise.all(newFromLane.map(id => consumer.loadComponentFromModelImportIfNeeded(id._legacy)));
226
226
  componentsLegacy.push(...compsNewFromLane);
227
227
  newFromLaneAdded = true;
@@ -306,8 +306,8 @@ class CheckoutMain {
306
306
  if (!componentPattern && !checkoutProps.all) {
307
307
  throw new (_generalError().default)('please specify [component-pattern] or use --all flag');
308
308
  }
309
- if (checkoutProps.entireLane && !checkoutProps.head) {
310
- throw new (_bitError().BitError)(`--entire-lane flag can only be used with "head" (bit checkout head --entire-lane)`);
309
+ if (checkoutProps.workspaceOnly && !checkoutProps.head) {
310
+ throw new (_bitError().BitError)(`--workspace-only flag can only be used with "head" (bit checkout head --workspace-only)`);
311
311
  }
312
312
  const idsOnWorkspace = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();
313
313
  const currentLane = await this.workspace.consumer.getCurrentLaneObject();
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutMain","constructor","workspace","logger","componentWriter","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","scope","import","useCache","preferDependencyGraph","bitIds","BitIds","fromArray","map","id","_legacy","components","loadComponents","allComponentStatusBeforeMerge","Promise","all","component","getComponentStatusBeforeMergeAttempt","compsNeedMerge","filter","c","propsForMerge","compsNotNeedMerge","toImport","compStatus","idsToImport","push","changeVersion","currentlyUsedVersion","flat","legacyScope","scopeImporter","importManyIfMissingWithoutDeps","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","entireLane","compsNewFromLane","loadComponentFromModelImportIfNeeded","leftUnresolvedConflicts","componentWriterResults","length","manyComponentsWriterOpts","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","writeMany","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","n","toString","installationError","compilationError","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","OutsideWorkspaceError","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","hasScope","changeScope","scopeComponentsImporter","importManyDeltaWithoutDeps","fromHead","error","unavailableOnMain","getUnavailableOnMainComponents","bitMap","makeComponentsAvailableOnMain","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsOnWorkspace","idsByPattern","listIds","currentLane","getCurrentLaneObject","currentLaneIds","toBitIds","hasWithoutVersion","lane","laneBitIds","newIds","bitId","isEqualWithoutVersion","newComponentIds","resolveMultipleComponentIds","nonRemovedNewIds","isRemoved","isComponentRemoved","headVersion","latestVersion","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","newVersion","hasVersion","existingBitMapId","getBitId","ignoreVersion","currentVersionObject","loadVersion","isModified","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","MainRuntime","addRuntime"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n} from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n FailedComponents,\n getMergeStrategyInteractive,\n MergeStrategy,\n threeWayMerge,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport mapSeries from 'p-map-series';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { Version, ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { ComponentID } from '@teambit/component-id';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\n\nexport type CheckoutProps = {\n version?: string; // if reset is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n latest?: boolean;\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy | null;\n verbose?: boolean;\n skipNpmInstall?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n all?: boolean; // checkout all ids\n isLane?: boolean;\n entireLane?: boolean;\n};\n\nexport type ComponentStatusBeforeMergeAttempt = {\n componentFromFS?: ConsumerComponent;\n componentFromModel?: Version;\n id: BitId;\n failureMessage?: string;\n unchangedLegitimately?: boolean; // failed to checkout but for a legitimate reason, such as, up-to-date\n propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\n\ntype CheckoutTo = 'head' | 'reset' | string;\n\nexport class CheckoutMain {\n constructor(private workspace: Workspace, private logger: Logger, private componentWriter: ComponentWriterMain) {}\n\n async checkout(checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const { version, ids, promptMergeOptions } = checkoutProps;\n await this.syncNewComponents(checkoutProps);\n await this.workspace.scope.import(ids || [], { useCache: false, preferDependencyGraph: true });\n const bitIds = BitIds.fromArray(ids?.map((id) => id._legacy) || []);\n const { components } = await consumer.loadComponents(bitIds);\n\n const allComponentStatusBeforeMerge = await Promise.all(\n components.map((component) => this.getComponentStatusBeforeMergeAttempt(component, checkoutProps))\n );\n const compsNeedMerge = allComponentStatusBeforeMerge.filter((c) => c.propsForMerge);\n const compsNotNeedMerge = allComponentStatusBeforeMerge.filter((c) => !c.propsForMerge) as ComponentStatus[];\n\n // in case the requested versions to checkout don't exist locally, import them.\n const toImport = allComponentStatusBeforeMerge\n .map((compStatus) => {\n const idsToImport = [compStatus.id];\n if (compStatus.propsForMerge) {\n idsToImport.push(compStatus.id.changeVersion(compStatus.propsForMerge.currentlyUsedVersion));\n }\n return idsToImport;\n })\n .flat();\n await this.workspace.scope.legacyScope.scopeImporter.importManyIfMissingWithoutDeps({\n ids: BitIds.fromArray(toImport),\n });\n\n const getComponentsStatusOfMergeNeeded = async (): Promise<ComponentStatus[]> => {\n const tmp = new Tmp(consumer.scope);\n try {\n const afterMergeAttempt = await Promise.all(compsNeedMerge.map((c) => this.getMergeStatus(c)));\n await tmp.clear();\n return afterMergeAttempt;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n\n const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();\n\n const allComponentsStatus: ComponentStatus[] = [...compStatusMergeNeeded, ...compsNotNeedMerge];\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict) {\n if (!promptMergeOptions && !checkoutProps.mergeStrategy) {\n throw new GeneralError(\n `automatic merge has failed for component ${componentWithConflict.id.toStringWithoutVersion()}.\\nplease use \"--manual\" to manually merge changes or use \"--theirs / --ours\" to choose one of the conflicted versions`\n );\n }\n if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.failureMessage)\n .map((componentStatus) => ({\n id: componentStatus.id,\n failureMessage: componentStatus.failureMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.failureMessage);\n // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,\n // which can be an issue when some components are also dependencies of others\n const checkoutPropsLegacy = { ...checkoutProps, ids: checkoutProps.ids?.map((id) => id._legacy) };\n const componentsResults = await mapSeries(succeededComponents, ({ id, componentFromFS, mergeResults }) => {\n return applyVersion(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);\n });\n\n markFilesToBeRemovedIfNeeded(succeededComponents, componentsResults);\n\n const componentsLegacy = compact(componentsResults.map((c) => c.component));\n\n let newFromLane: ComponentID[] | undefined;\n let newFromLaneAdded = false;\n if (checkoutProps.head) {\n newFromLane = await this.getNewComponentsFromLane(checkoutProps.ids || []);\n if (checkoutProps.entireLane) {\n const compsNewFromLane = await Promise.all(\n newFromLane.map((id) => consumer.loadComponentFromModelImportIfNeeded(id._legacy))\n );\n componentsLegacy.push(...compsNewFromLane);\n newFromLaneAdded = true;\n }\n }\n\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n let componentWriterResults;\n if (componentsLegacy.length) {\n const manyComponentsWriterOpts = {\n components: componentsLegacy,\n skipDependencyInstallation: checkoutProps.skipNpmInstall || leftUnresolvedConflicts,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\n await deleteFilesIfNeeded(componentsResults, consumer);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n return {\n components: appliedVersionComponents,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane: newFromLane?.map((n) => n.toString()),\n newFromLaneAdded,\n installationError: componentWriterResults?.installationError,\n compilationError: componentWriterResults?.compilationError,\n };\n }\n\n async checkoutByCLIValues(\n to: CheckoutTo,\n componentPattern: string,\n checkoutProps: CheckoutProps\n ): Promise<ApplyVersionResults> {\n this.logger.setStatusLine(BEFORE_CHECKOUT);\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n if (to === 'head') await this.makeLaneComponentsAvailableOnMain();\n await this.parseValues(to, componentPattern, checkoutProps);\n const checkoutResults = await this.checkout(checkoutProps);\n await consumer.onDestroy();\n return checkoutResults;\n }\n\n private async syncNewComponents({ ids, head }: CheckoutProps) {\n if (!head) return;\n const notExported = ids?.filter((id) => !id._legacy.hasScope()).map((id) => id._legacy.changeScope(id.scope));\n const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;\n try {\n await scopeComponentsImporter.importManyDeltaWithoutDeps({\n ids: BitIds.fromArray(notExported || []),\n fromHead: true,\n });\n } catch (err) {\n // don't stop the process. it's possible that the scope doesn't exist yet because these are new components\n this.logger.error(`unable to sync new components due to an error`, err);\n }\n }\n\n private async makeLaneComponentsAvailableOnMain() {\n const unavailableOnMain = await this.workspace.getUnavailableOnMainComponents();\n if (!unavailableOnMain.length) return;\n this.workspace.bitMap.makeComponentsAvailableOnMain(unavailableOnMain);\n }\n\n private async parseValues(to: CheckoutTo, componentPattern: string, checkoutProps: CheckoutProps) {\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 {\n if (!BitId.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n if (checkoutProps.head && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${HEAD}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (checkoutProps.latest && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${LATEST}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (componentPattern && checkoutProps.all) {\n throw new GeneralError('please specify either [component-pattern] or --all, not both');\n }\n if (!componentPattern && !checkoutProps.all) {\n throw new GeneralError('please specify [component-pattern] or use --all flag');\n }\n if (checkoutProps.entireLane && !checkoutProps.head) {\n throw new BitError(`--entire-lane flag can only be used with \"head\" (bit checkout head --entire-lane)`);\n }\n const idsOnWorkspace = componentPattern\n ? await this.workspace.idsByPattern(componentPattern)\n : await this.workspace.listIds();\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toBitIds();\n const ids = currentLaneIds\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id._legacy))\n : idsOnWorkspace;\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async getNewComponentsFromLane(ids: ComponentID[]): Promise<ComponentID[]> {\n const lane = await this.workspace.consumer.getCurrentLaneObject();\n if (!lane) {\n return [];\n }\n const laneBitIds = lane.toBitIds();\n const newIds = laneBitIds.filter((bitId) => !ids.find((id) => id._legacy.isEqualWithoutVersion(bitId)));\n const newComponentIds = await this.workspace.resolveMultipleComponentIds(newIds);\n const nonRemovedNewIds: ComponentID[] = [];\n await Promise.all(\n newComponentIds.map(async (id) => {\n const isRemoved = await this.workspace.scope.isComponentRemoved(id);\n if (!isRemoved) nonRemovedNewIds.push(id);\n })\n );\n return nonRemovedNewIds;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n component: ConsumerComponent,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const { version, head: headVersion, reset, latest: latestVersion } = checkoutProps;\n const repo = consumer.scope.objects;\n const componentModel = await consumer.scope.getModelComponentIfExist(component.id);\n const componentStatus: ComponentStatus = { id: component.id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.failureMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n if (!componentModel) {\n return returnFailure(`component ${component.id.toString()} is new, no version to checkout`, true);\n }\n const unmerged = repo.unmergedComponents.getEntry(component.name);\n if (!reset && unmerged) {\n return returnFailure(\n `component ${component.id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n const getNewVersion = async (): Promise<string> => {\n if (reset) return component.id.version as string;\n\n if (headVersion) return componentModel.headIncludeRemote(repo);\n if (latestVersion) return componentModel.latestVersion();\n // @ts-ignore if !reset the version is defined\n return version;\n };\n const newVersion = await getNewVersion();\n if (version && !headVersion) {\n const hasVersion = await componentModel.hasVersion(version, repo);\n if (!hasVersion)\n return returnFailure(`component ${component.id.toStringWithoutVersion()} doesn't have version ${version}`);\n }\n const existingBitMapId = consumer.bitMap.getBitId(component.id, { ignoreVersion: true });\n const currentlyUsedVersion = existingBitMapId.version;\n if (!currentlyUsedVersion) {\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is new`);\n }\n if (version && currentlyUsedVersion === version) {\n // it won't be relevant for 'reset' as it doesn't have a version\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`, true);\n }\n if (headVersion && currentlyUsedVersion === newVersion) {\n return returnFailure(\n `component ${component.id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`,\n true\n );\n }\n const currentVersionObject: Version = await componentModel.loadVersion(currentlyUsedVersion, repo);\n const isModified = await consumer.isComponentModified(currentVersionObject, component);\n if (!isModified && reset) {\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`, true);\n }\n\n const versionRef = componentModel.getRef(newVersion);\n if (!versionRef) throw new Error(`unable to get ref ${newVersion} from ${componentModel.id()}`);\n const componentVersion = (await consumer.scope.getObject(versionRef.hash)) as Version;\n const newId = component.id.changeVersion(newVersion);\n\n if (reset || !isModified) {\n // if the component is not modified, no need to try merge the files, they will be written later on according to the\n // checked out version. same thing when no version is specified, it'll be reset to the model-version later.\n return { componentFromFS: component, componentFromModel: componentVersion, id: newId };\n }\n\n const propsForMerge = {\n currentlyUsedVersion,\n componentModel,\n };\n\n return { componentFromFS: component, componentFromModel: componentVersion, id: newId, propsForMerge };\n }\n\n private async getMergeStatus({\n componentFromFS,\n componentFromModel,\n id,\n propsForMerge,\n }: ComponentStatusBeforeMergeAttempt): Promise<ComponentStatus> {\n if (!propsForMerge) throw new Error(`propsForMerge is missing for ${id.toString()}`);\n if (!componentFromFS) throw new Error(`componentFromFS is missing for ${id.toString()}`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const { currentlyUsedVersion, componentModel } = propsForMerge;\n\n // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.\n // the base is 0.0.1, as it's the common version for 0.0.1 and 0.0.2. however, if we let git merge-file use the 0.0.1\n // as the base, then, it'll get the changes done since 0.0.1 to 0.0.1, which is nothing, and put them on top of\n // 0.0.2+modification. in other words, it won't make any change.\n // this scenario of checking out while there are modified files, is forbidden in Git. here, we want to simulate a similar\n // experience of \"git stash\", then \"git checkout\", then \"git stash pop\". practically, we want the changes done on 0.0.2\n // to be added to 0.0.1\n // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.\n const baseVersion = currentlyUsedVersion;\n const newVersion = id.version as string;\n const baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n const mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: newVersion,\n currentComponent: componentFromFS,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n\n return { componentFromFS, componentFromModel, id, mergeResults };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, ComponentWriterAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain, compWriter]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ComponentWriterMain\n ]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger, compWriter);\n cli.register(new CheckoutCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime(CheckoutMain);\n\nexport default CheckoutMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAC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AAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCApVY5L,YAAY,WAoUR,EAAE;AAAA,gCApUNA,YAAY,kBAqUD,CAAC+L,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wCAAqB,CAAC;AAAA,gCArU5ElM,YAAY,aAuUNmM,kBAAW;AAe9BR,0BAAc,CAACS,UAAU,CAACpM,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
1
+ {"version":3,"names":["CheckoutMain","constructor","workspace","logger","componentWriter","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","scope","import","useCache","preferDependencyGraph","bitIds","BitIds","fromArray","map","id","_legacy","components","loadComponents","allComponentStatusBeforeMerge","Promise","all","component","getComponentStatusBeforeMergeAttempt","compsNeedMerge","filter","c","propsForMerge","compsNotNeedMerge","toImport","compStatus","idsToImport","push","changeVersion","currentlyUsedVersion","flat","legacyScope","scopeImporter","importManyIfMissingWithoutDeps","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","leftUnresolvedConflicts","componentWriterResults","length","manyComponentsWriterOpts","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","writeMany","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","n","toString","installationError","compilationError","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","OutsideWorkspaceError","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","hasScope","changeScope","scopeComponentsImporter","importManyDeltaWithoutDeps","fromHead","error","unavailableOnMain","getUnavailableOnMainComponents","bitMap","makeComponentsAvailableOnMain","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsOnWorkspace","idsByPattern","listIds","currentLane","getCurrentLaneObject","currentLaneIds","toBitIds","hasWithoutVersion","lane","laneBitIds","newIds","bitId","isEqualWithoutVersion","newComponentIds","resolveMultipleComponentIds","nonRemovedNewIds","isRemoved","isComponentRemoved","headVersion","latestVersion","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","newVersion","hasVersion","existingBitMapId","getBitId","ignoreVersion","currentVersionObject","loadVersion","isModified","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","MainRuntime","addRuntime"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n} from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n FailedComponents,\n getMergeStrategyInteractive,\n MergeStrategy,\n threeWayMerge,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport mapSeries from 'p-map-series';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { Version, ModelComponent } from '@teambit/legacy/dist/scope/models';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { ComponentID } from '@teambit/component-id';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\n\nexport type CheckoutProps = {\n version?: string; // if reset is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n latest?: boolean;\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy | null;\n verbose?: boolean;\n skipNpmInstall?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n all?: boolean; // checkout all ids\n isLane?: boolean;\n workspaceOnly?: boolean;\n};\n\nexport type ComponentStatusBeforeMergeAttempt = {\n componentFromFS?: ConsumerComponent;\n componentFromModel?: Version;\n id: BitId;\n failureMessage?: string;\n unchangedLegitimately?: boolean; // failed to checkout but for a legitimate reason, such as, up-to-date\n propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\n\ntype CheckoutTo = 'head' | 'reset' | string;\n\nexport class CheckoutMain {\n constructor(private workspace: Workspace, private logger: Logger, private componentWriter: ComponentWriterMain) {}\n\n async checkout(checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n const consumer = this.workspace.consumer;\n const { version, ids, promptMergeOptions } = checkoutProps;\n await this.syncNewComponents(checkoutProps);\n await this.workspace.scope.import(ids || [], { useCache: false, preferDependencyGraph: true });\n const bitIds = BitIds.fromArray(ids?.map((id) => id._legacy) || []);\n const { components } = await consumer.loadComponents(bitIds);\n\n const allComponentStatusBeforeMerge = await Promise.all(\n components.map((component) => this.getComponentStatusBeforeMergeAttempt(component, checkoutProps))\n );\n const compsNeedMerge = allComponentStatusBeforeMerge.filter((c) => c.propsForMerge);\n const compsNotNeedMerge = allComponentStatusBeforeMerge.filter((c) => !c.propsForMerge) as ComponentStatus[];\n\n // in case the requested versions to checkout don't exist locally, import them.\n const toImport = allComponentStatusBeforeMerge\n .map((compStatus) => {\n const idsToImport = [compStatus.id];\n if (compStatus.propsForMerge) {\n idsToImport.push(compStatus.id.changeVersion(compStatus.propsForMerge.currentlyUsedVersion));\n }\n return idsToImport;\n })\n .flat();\n await this.workspace.scope.legacyScope.scopeImporter.importManyIfMissingWithoutDeps({\n ids: BitIds.fromArray(toImport),\n });\n\n const getComponentsStatusOfMergeNeeded = async (): Promise<ComponentStatus[]> => {\n const tmp = new Tmp(consumer.scope);\n try {\n const afterMergeAttempt = await Promise.all(compsNeedMerge.map((c) => this.getMergeStatus(c)));\n await tmp.clear();\n return afterMergeAttempt;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n\n const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();\n\n const allComponentsStatus: ComponentStatus[] = [...compStatusMergeNeeded, ...compsNotNeedMerge];\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict) {\n if (!promptMergeOptions && !checkoutProps.mergeStrategy) {\n throw new GeneralError(\n `automatic merge has failed for component ${componentWithConflict.id.toStringWithoutVersion()}.\\nplease use \"--manual\" to manually merge changes or use \"--theirs / --ours\" to choose one of the conflicted versions`\n );\n }\n if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.failureMessage)\n .map((componentStatus) => ({\n id: componentStatus.id,\n failureMessage: componentStatus.failureMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.failureMessage);\n // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,\n // which can be an issue when some components are also dependencies of others\n const checkoutPropsLegacy = { ...checkoutProps, ids: checkoutProps.ids?.map((id) => id._legacy) };\n const componentsResults = await mapSeries(succeededComponents, ({ id, componentFromFS, mergeResults }) => {\n return applyVersion(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);\n });\n\n markFilesToBeRemovedIfNeeded(succeededComponents, componentsResults);\n\n const componentsLegacy = compact(componentsResults.map((c) => c.component));\n\n let newFromLane: ComponentID[] | undefined;\n let newFromLaneAdded = false;\n if (checkoutProps.head) {\n newFromLane = await this.getNewComponentsFromLane(checkoutProps.ids || []);\n if (!checkoutProps.workspaceOnly) {\n const compsNewFromLane = await Promise.all(\n newFromLane.map((id) => consumer.loadComponentFromModelImportIfNeeded(id._legacy))\n );\n componentsLegacy.push(...compsNewFromLane);\n newFromLaneAdded = true;\n }\n }\n\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n let componentWriterResults;\n if (componentsLegacy.length) {\n const manyComponentsWriterOpts = {\n components: componentsLegacy,\n skipDependencyInstallation: checkoutProps.skipNpmInstall || leftUnresolvedConflicts,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\n await deleteFilesIfNeeded(componentsResults, consumer);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n return {\n components: appliedVersionComponents,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane: newFromLane?.map((n) => n.toString()),\n newFromLaneAdded,\n installationError: componentWriterResults?.installationError,\n compilationError: componentWriterResults?.compilationError,\n };\n }\n\n async checkoutByCLIValues(\n to: CheckoutTo,\n componentPattern: string,\n checkoutProps: CheckoutProps\n ): Promise<ApplyVersionResults> {\n this.logger.setStatusLine(BEFORE_CHECKOUT);\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n if (to === 'head') await this.makeLaneComponentsAvailableOnMain();\n await this.parseValues(to, componentPattern, checkoutProps);\n const checkoutResults = await this.checkout(checkoutProps);\n await consumer.onDestroy();\n return checkoutResults;\n }\n\n private async syncNewComponents({ ids, head }: CheckoutProps) {\n if (!head) return;\n const notExported = ids?.filter((id) => !id._legacy.hasScope()).map((id) => id._legacy.changeScope(id.scope));\n const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;\n try {\n await scopeComponentsImporter.importManyDeltaWithoutDeps({\n ids: BitIds.fromArray(notExported || []),\n fromHead: true,\n });\n } catch (err) {\n // don't stop the process. it's possible that the scope doesn't exist yet because these are new components\n this.logger.error(`unable to sync new components due to an error`, err);\n }\n }\n\n private async makeLaneComponentsAvailableOnMain() {\n const unavailableOnMain = await this.workspace.getUnavailableOnMainComponents();\n if (!unavailableOnMain.length) return;\n this.workspace.bitMap.makeComponentsAvailableOnMain(unavailableOnMain);\n }\n\n private async parseValues(to: CheckoutTo, componentPattern: string, checkoutProps: CheckoutProps) {\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 {\n if (!BitId.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n if (checkoutProps.head && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${HEAD}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (checkoutProps.latest && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${LATEST}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (componentPattern && checkoutProps.all) {\n throw new GeneralError('please specify either [component-pattern] or --all, not both');\n }\n if (!componentPattern && !checkoutProps.all) {\n throw new GeneralError('please specify [component-pattern] or use --all flag');\n }\n if (checkoutProps.workspaceOnly && !checkoutProps.head) {\n throw new BitError(`--workspace-only flag can only be used with \"head\" (bit checkout head --workspace-only)`);\n }\n const idsOnWorkspace = componentPattern\n ? await this.workspace.idsByPattern(componentPattern)\n : await this.workspace.listIds();\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toBitIds();\n const ids = currentLaneIds\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id._legacy))\n : idsOnWorkspace;\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async getNewComponentsFromLane(ids: ComponentID[]): Promise<ComponentID[]> {\n const lane = await this.workspace.consumer.getCurrentLaneObject();\n if (!lane) {\n return [];\n }\n const laneBitIds = lane.toBitIds();\n const newIds = laneBitIds.filter((bitId) => !ids.find((id) => id._legacy.isEqualWithoutVersion(bitId)));\n const newComponentIds = await this.workspace.resolveMultipleComponentIds(newIds);\n const nonRemovedNewIds: ComponentID[] = [];\n await Promise.all(\n newComponentIds.map(async (id) => {\n const isRemoved = await this.workspace.scope.isComponentRemoved(id);\n if (!isRemoved) nonRemovedNewIds.push(id);\n })\n );\n return nonRemovedNewIds;\n }\n\n private async getComponentStatusBeforeMergeAttempt(\n component: ConsumerComponent,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const { version, head: headVersion, reset, latest: latestVersion } = checkoutProps;\n const repo = consumer.scope.objects;\n const componentModel = await consumer.scope.getModelComponentIfExist(component.id);\n const componentStatus: ComponentStatus = { id: component.id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.failureMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n if (!componentModel) {\n return returnFailure(`component ${component.id.toString()} is new, no version to checkout`, true);\n }\n const unmerged = repo.unmergedComponents.getEntry(component.name);\n if (!reset && unmerged) {\n return returnFailure(\n `component ${component.id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n const getNewVersion = async (): Promise<string> => {\n if (reset) return component.id.version as string;\n\n if (headVersion) return componentModel.headIncludeRemote(repo);\n if (latestVersion) return componentModel.latestVersion();\n // @ts-ignore if !reset the version is defined\n return version;\n };\n const newVersion = await getNewVersion();\n if (version && !headVersion) {\n const hasVersion = await componentModel.hasVersion(version, repo);\n if (!hasVersion)\n return returnFailure(`component ${component.id.toStringWithoutVersion()} doesn't have version ${version}`);\n }\n const existingBitMapId = consumer.bitMap.getBitId(component.id, { ignoreVersion: true });\n const currentlyUsedVersion = existingBitMapId.version;\n if (!currentlyUsedVersion) {\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is new`);\n }\n if (version && currentlyUsedVersion === version) {\n // it won't be relevant for 'reset' as it doesn't have a version\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`, true);\n }\n if (headVersion && currentlyUsedVersion === newVersion) {\n return returnFailure(\n `component ${component.id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`,\n true\n );\n }\n const currentVersionObject: Version = await componentModel.loadVersion(currentlyUsedVersion, repo);\n const isModified = await consumer.isComponentModified(currentVersionObject, component);\n if (!isModified && reset) {\n return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`, true);\n }\n\n const versionRef = componentModel.getRef(newVersion);\n if (!versionRef) throw new Error(`unable to get ref ${newVersion} from ${componentModel.id()}`);\n const componentVersion = (await consumer.scope.getObject(versionRef.hash)) as Version;\n const newId = component.id.changeVersion(newVersion);\n\n if (reset || !isModified) {\n // if the component is not modified, no need to try merge the files, they will be written later on according to the\n // checked out version. same thing when no version is specified, it'll be reset to the model-version later.\n return { componentFromFS: component, componentFromModel: componentVersion, id: newId };\n }\n\n const propsForMerge = {\n currentlyUsedVersion,\n componentModel,\n };\n\n return { componentFromFS: component, componentFromModel: componentVersion, id: newId, propsForMerge };\n }\n\n private async getMergeStatus({\n componentFromFS,\n componentFromModel,\n id,\n propsForMerge,\n }: ComponentStatusBeforeMergeAttempt): Promise<ComponentStatus> {\n if (!propsForMerge) throw new Error(`propsForMerge is missing for ${id.toString()}`);\n if (!componentFromFS) throw new Error(`componentFromFS is missing for ${id.toString()}`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const { currentlyUsedVersion, componentModel } = propsForMerge;\n\n // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.\n // the base is 0.0.1, as it's the common version for 0.0.1 and 0.0.2. however, if we let git merge-file use the 0.0.1\n // as the base, then, it'll get the changes done since 0.0.1 to 0.0.1, which is nothing, and put them on top of\n // 0.0.2+modification. in other words, it won't make any change.\n // this scenario of checking out while there are modified files, is forbidden in Git. here, we want to simulate a similar\n // experience of \"git stash\", then \"git checkout\", then \"git stash pop\". practically, we want the changes done on 0.0.2\n // to be added to 0.0.1\n // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.\n const baseVersion = currentlyUsedVersion;\n const newVersion = id.version as string;\n const baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n const mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: newVersion,\n currentComponent: componentFromFS,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n\n return { componentFromFS, componentFromModel, id, mergeResults };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, ComponentWriterAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain, compWriter]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ComponentWriterMain\n ]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger, compWriter);\n cli.register(new CheckoutCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime(CheckoutMain);\n\nexport default CheckoutMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAA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AACvK,EAAE,CAAC;IACzD,MAAMwK,YAAY,GAAG,IAAI5L,YAAY,CAACE,SAAS,EAAEC,MAAM,EAAEsL,UAAU,CAAC;IACpEF,GAAG,CAACM,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCApVY5L,YAAY,WAoUR,EAAE;AAAA,gCApUNA,YAAY,kBAqUD,CAAC+L,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wCAAqB,CAAC;AAAA,gCArU5ElM,YAAY,aAuUNmM,kBAAW;AAe9BR,0BAAc,CAACS,UAAU,CAACpM,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/checkout",
3
- "version": "0.0.186",
3
+ "version": "0.0.188",
4
4
  "homepage": "https://bit.dev/teambit/component/checkout",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "checkout",
9
- "version": "0.0.186"
9
+ "version": "0.0.188"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -16,13 +16,13 @@
16
16
  "@babel/runtime": "7.20.0",
17
17
  "@teambit/harmony": "0.4.6",
18
18
  "@teambit/bit-error": "0.0.402",
19
- "@teambit/cli": "0.0.681",
20
- "@teambit/merging": "0.0.332",
19
+ "@teambit/cli": "0.0.683",
20
+ "@teambit/merging": "0.0.334",
21
21
  "@teambit/component-id": "0.0.427",
22
- "@teambit/component-writer": "0.0.53",
22
+ "@teambit/component-writer": "0.0.55",
23
23
  "@teambit/legacy-bit-id": "0.0.423",
24
- "@teambit/logger": "0.0.774",
25
- "@teambit/workspace": "0.0.1017"
24
+ "@teambit/logger": "0.0.776",
25
+ "@teambit/workspace": "0.0.1019"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/lodash": "4.14.165",
@@ -34,7 +34,7 @@
34
34
  "@types/testing-library__jest-dom": "5.9.5"
35
35
  },
36
36
  "peerDependencies": {
37
- "@teambit/legacy": "1.0.460",
37
+ "@teambit/legacy": "1.0.462",
38
38
  "react": "^16.8.0 || ^17.0.0",
39
39
  "react-dom": "^16.8.0 || ^17.0.0"
40
40
  },