@teambit/checkout 0.0.273 → 0.0.275

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,7 +15,7 @@ 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, all, workspaceOnly, verbose, skipDependencyInstallation, }: {
18
+ report([to, componentPattern]: [string, string], { interactiveMerge, ours, theirs, manual, all, workspaceOnly, verbose, skipDependencyInstallation, revert, }: {
19
19
  interactiveMerge?: boolean;
20
20
  ours?: boolean;
21
21
  theirs?: boolean;
@@ -24,5 +24,6 @@ export declare class CheckoutCmd implements Command {
24
24
  workspaceOnly?: boolean;
25
25
  verbose?: boolean;
26
26
  skipDependencyInstallation?: boolean;
27
+ revert?: boolean;
27
28
  }): Promise<string>;
28
29
  }
@@ -73,7 +73,8 @@ class CheckoutCmd {
73
73
  all = false,
74
74
  workspaceOnly = false,
75
75
  verbose = false,
76
- skipDependencyInstallation = false
76
+ skipDependencyInstallation = false,
77
+ revert = false
77
78
  }) {
78
79
  const checkoutProps = {
79
80
  promptMergeOptions: interactiveMerge,
@@ -82,7 +83,8 @@ class CheckoutCmd {
82
83
  verbose,
83
84
  isLane: false,
84
85
  skipNpmInstall: skipDependencyInstallation,
85
- workspaceOnly
86
+ workspaceOnly,
87
+ revert
86
88
  };
87
89
  const {
88
90
  components,
@@ -98,6 +100,7 @@ class CheckoutCmd {
98
100
  const isHead = to === 'head';
99
101
  const isReset = to === 'reset';
100
102
  const isLatest = to === 'latest';
103
+ const isMain = to === 'main';
101
104
  // components that failed for no legitimate reason. e.g. merge-conflict.
102
105
  const realFailedComponents = (failedComponents || []).filter(f => !f.unchangedLegitimately);
103
106
  // components that weren't checked out for legitimate reasons, e.g. up-to-date.
@@ -125,12 +128,13 @@ once ready, snap/tag the components to persist the changes`;
125
128
  return _chalk().default.underline(title) + (0, _merging().conflictSummaryReport)(components) + _chalk().default.yellow(suggestion);
126
129
  };
127
130
  const getSuccessfulOutput = () => {
131
+ const switchedOrReverted = revert ? 'reverted' : 'switched';
128
132
  if (!components || !components.length) return '';
129
133
  if (components.length === 1) {
130
134
  const component = components[0];
131
135
  const componentName = isReset ? component.id.toString() : component.id.toStringWithoutVersion();
132
136
  if (isReset) return `successfully reset ${_chalk().default.bold(componentName)}\n`;
133
- const title = `successfully switched ${_chalk().default.bold(componentName)} to version ${_chalk().default.bold(
137
+ const title = `successfully ${switchedOrReverted} ${_chalk().default.bold(componentName)} to version ${_chalk().default.bold(
134
138
  // @ts-ignore version is defined when !isReset
135
139
  isHead || isLatest ? component.id.version : version)}\n`;
136
140
  return `${_chalk().default.underline(title)} ${(0, _merging().applyVersionReport)(components, false)}`;
@@ -143,11 +147,12 @@ once ready, snap/tag the components to persist the changes`;
143
147
  const getVerOutput = () => {
144
148
  if (isHead) return 'their head version';
145
149
  if (isLatest) return 'their latest version';
150
+ if (isMain) return 'their main version';
146
151
  // @ts-ignore version is defined when !isReset
147
152
  return `version ${_chalk().default.bold(version)}`;
148
153
  };
149
154
  const versionOutput = getVerOutput();
150
- const title = `successfully switched the following components to ${versionOutput}\n\n`;
155
+ const title = `successfully ${switchedOrReverted} the following components to ${versionOutput}\n\n`;
151
156
  const showVersion = isHead || isReset;
152
157
  const componentsStr = (0, _merging().applyVersionReport)(components, true, showVersion);
153
158
  return _chalk().default.underline(title) + componentsStr;
@@ -163,8 +168,8 @@ once ready, snap/tag the components to persist the changes`;
163
168
  const notCheckedOutLegitimately = notCheckedOutComponents.length;
164
169
  const failedToCheckOut = realFailedComponents.length;
165
170
  const newLines = '\n\n';
166
- const title = _chalk().default.bold.underline('Checkout Summary');
167
- const checkedOutStr = `\nTotal CheckedOut: ${_chalk().default.bold(checkedOut.toString())}`;
171
+ const title = _chalk().default.bold.underline('Summary');
172
+ const checkedOutStr = `\nTotal Changed: ${_chalk().default.bold(checkedOut.toString())}`;
168
173
  const unchangedLegitimatelyStr = `\nTotal Unchanged: ${_chalk().default.bold(notCheckedOutLegitimately.toString())}`;
169
174
  const failedToCheckOutStr = `\nTotal Failed: ${_chalk().default.bold(failedToCheckOut.toString())}`;
170
175
  const newOnLaneNum = (newFromLane === null || newFromLane === void 0 ? void 0 : newFromLane.length) || 0;
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","ours","theirs","manual","all","workspaceOnly","verbose","skipDependencyInstallation","checkoutProps","promptMergeOptions","mergeStrategy","getMergeStrategy","isLane","skipNpmInstall","components","version","failedComponents","removedComponents","leftUnresolvedConflicts","newFromLane","newFromLaneAdded","installationError","compilationError","checkoutByCLIValues","isHead","isReset","isLatest","realFailedComponents","filter","f","unchangedLegitimately","notCheckedOutComponents","getFailureOutput","length","title","body","map","failedComponent","chalk","bold","id","toString","red","failureMessage","join","underline","getNotCheckedOutOutput","green","getConflictSummary","suggestion","conflictSummaryReport","yellow","getSuccessfulOutput","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","componentsStr","getNewOnLaneOutput","getSummary","checkedOut","notCheckedOutLegitimately","failedToCheckOut","newLines","checkedOutStr","unchangedLegitimatelyStr","failedToCheckOutStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","getRemovedOutput","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} 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 ['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 all = false,\n workspaceOnly = false,\n verbose = false,\n skipDependencyInstallation = false,\n }: {\n interactiveMerge?: boolean;\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n }\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 removedComponents,\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 getRemovedOutput(removedComponents) +\n getNewOnLaneOutput() +\n getConflictSummary() +\n getSummary() +\n installationErrorOutput(installationError) +\n compilationErrorOutput(compilationError)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,WAAW,CAAoB;EA2C1CC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,8CA1CnC,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,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAC9B,CACE,GAAG,EACH,gBAAgB,EAChB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C;MACtD,MAAMsB,aAAa,GAAI,uBAAsB7B,gBAAK,CAACC,IAAI,CAACwB,UAAU,CAACtB,QAAQ,EAAE,CAAE,EAAC;MAChF,MAAM2B,wBAAwB,GAAI,sBAAqB9B,gBAAK,CAACC,IAAI,CAACyB,yBAAyB,CAACvB,QAAQ,EAAE,CAAE,EAAC;MACzG,MAAM4B,mBAAmB,GAAI,mBAAkB/B,gBAAK,CAACC,IAAI,CAAC0B,gBAAgB,CAACxB,QAAQ,EAAE,CAAE,EAAC;MACxF,MAAM6B,YAAY,GAAG,CAAAnD,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEc,MAAM,KAAI,CAAC;MAC7C,MAAMsC,iBAAiB,GAAGnD,gBAAgB,GAAG,UAAU,GAAG,cAAc;MACxE,MAAMoD,YAAY,GAAGF,YAAY,GAC5B,gBAAeC,iBAAkB,KAAIjC,gBAAK,CAACC,IAAI,CAAC+B,YAAY,CAAC7B,QAAQ,EAAE,CAAE,EAAC,GAC3E,EAAE;MAEN,OAAOyB,QAAQ,GAAGhC,KAAK,GAAGiC,aAAa,GAAGC,wBAAwB,GAAGC,mBAAmB,GAAGG,YAAY;IACzG,CAAC;IAED,OACExC,gBAAgB,EAAE,GAClBc,sBAAsB,EAAE,GACxBM,mBAAmB,EAAE,GACrB,IAAAqB,2BAAgB,EAACxD,iBAAiB,CAAC,GACnC4C,kBAAkB,EAAE,GACpBb,kBAAkB,EAAE,GACpBc,UAAU,EAAE,GACZ,IAAAY,kCAAuB,EAACrD,iBAAiB,CAAC,GAC1C,IAAAsD,iCAAsB,EAACrD,gBAAgB,CAAC;EAE5C;AACF;AAAC"}
1
+ {"version":3,"names":["CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","ours","theirs","manual","all","workspaceOnly","verbose","skipDependencyInstallation","revert","checkoutProps","promptMergeOptions","mergeStrategy","getMergeStrategy","isLane","skipNpmInstall","components","version","failedComponents","removedComponents","leftUnresolvedConflicts","newFromLane","newFromLaneAdded","installationError","compilationError","checkoutByCLIValues","isHead","isReset","isLatest","isMain","realFailedComponents","filter","f","unchangedLegitimately","notCheckedOutComponents","getFailureOutput","length","title","body","map","failedComponent","chalk","bold","id","toString","red","failureMessage","join","underline","getNotCheckedOutOutput","green","getConflictSummary","suggestion","conflictSummaryReport","yellow","getSuccessfulOutput","switchedOrReverted","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","componentsStr","getNewOnLaneOutput","getSummary","checkedOut","notCheckedOutLegitimately","failedToCheckOut","newLines","checkedOutStr","unchangedLegitimatelyStr","failedToCheckOutStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","getRemovedOutput","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} 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 ['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 all = false,\n workspaceOnly = false,\n verbose = false,\n skipDependencyInstallation = false,\n revert = false,\n }: {\n interactiveMerge?: boolean;\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n revert?: boolean;\n }\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 revert,\n };\n const {\n components,\n version,\n failedComponents,\n removedComponents,\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 const isMain = to === 'main';\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 const switchedOrReverted = revert ? 'reverted' : 'switched';\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 ${switchedOrReverted} ${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 if (isMain) return 'their main version';\n // @ts-ignore version is defined when !isReset\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title = `successfully ${switchedOrReverted} 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('Summary');\n const checkedOutStr = `\\nTotal Changed: ${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 getRemovedOutput(removedComponents) +\n getNewOnLaneOutput() +\n getConflictSummary() +\n getSummary() +\n installationErrorOutput(installationError) +\n compilationErrorOutput(compilationError)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;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AAE,CAAE,EAAC;MAC7E,MAAM4B,wBAAwB,GAAI,sBAAqB/B,gBAAK,CAACC,IAAI,CAAC0B,yBAAyB,CAACxB,QAAQ,EAAE,CAAE,EAAC;MACzG,MAAM6B,mBAAmB,GAAI,mBAAkBhC,gBAAK,CAACC,IAAI,CAAC2B,gBAAgB,CAACzB,QAAQ,EAAE,CAAE,EAAC;MACxF,MAAM8B,YAAY,GAAG,CAAArD,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEe,MAAM,KAAI,CAAC;MAC7C,MAAMuC,iBAAiB,GAAGrD,gBAAgB,GAAG,UAAU,GAAG,cAAc;MACxE,MAAMsD,YAAY,GAAGF,YAAY,GAC5B,gBAAeC,iBAAkB,KAAIlC,gBAAK,CAACC,IAAI,CAACgC,YAAY,CAAC9B,QAAQ,EAAE,CAAE,EAAC,GAC3E,EAAE;MAEN,OAAO0B,QAAQ,GAAGjC,KAAK,GAAGkC,aAAa,GAAGC,wBAAwB,GAAGC,mBAAmB,GAAGG,YAAY;IACzG,CAAC;IAED,OACEzC,gBAAgB,EAAE,GAClBc,sBAAsB,EAAE,GACxBM,mBAAmB,EAAE,GACrB,IAAAsB,2BAAgB,EAAC1D,iBAAiB,CAAC,GACnC8C,kBAAkB,EAAE,GACpBd,kBAAkB,EAAE,GACpBe,UAAU,EAAE,GACZ,IAAAY,kCAAuB,EAACvD,iBAAiB,CAAC,GAC1C,IAAAwD,iCAAsB,EAACvD,gBAAgB,CAAC;EAE5C;AACF;AAAC"}
@@ -14,11 +14,13 @@ export declare type CheckoutProps = {
14
14
  ids?: ComponentID[];
15
15
  head?: boolean;
16
16
  latest?: boolean;
17
+ main?: boolean;
17
18
  promptMergeOptions?: boolean;
18
19
  mergeStrategy?: MergeStrategy | null;
19
20
  verbose?: boolean;
20
21
  skipNpmInstall?: boolean;
21
22
  reset?: boolean;
23
+ revert?: boolean;
22
24
  all?: boolean;
23
25
  isLane?: boolean;
24
26
  workspaceOnly?: boolean;
@@ -33,7 +35,7 @@ export declare type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {
33
35
  componentModel: ModelComponent;
34
36
  };
35
37
  };
36
- declare type CheckoutTo = 'head' | 'reset' | string;
38
+ declare type CheckoutTo = 'head' | 'reset' | 'main' | string;
37
39
  export declare class CheckoutMain {
38
40
  private workspace;
39
41
  private logger;
@@ -149,6 +149,13 @@ function _checkoutVersion() {
149
149
  };
150
150
  return data;
151
151
  }
152
+ function _revertCmd() {
153
+ const data = require("./revert-cmd");
154
+ _revertCmd = function () {
155
+ return data;
156
+ };
157
+ return data;
158
+ }
152
159
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
153
160
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
154
161
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -272,7 +279,10 @@ class CheckoutMain {
272
279
  };
273
280
  }
274
281
  async checkoutByCLIValues(to, componentPattern, checkoutProps) {
275
- this.logger.setStatusLine(_loaderMessages().BEFORE_CHECKOUT);
282
+ const {
283
+ revert
284
+ } = checkoutProps;
285
+ this.logger.setStatusLine(revert ? 'reverting components...' : _loaderMessages().BEFORE_CHECKOUT);
276
286
  if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
277
287
  const consumer = this.workspace.consumer;
278
288
  await this.importer.importCurrentObjects(); // important. among others, it fetches the remote lane object and its new components.
@@ -304,7 +314,7 @@ class CheckoutMain {
304
314
  this.workspace.bitMap.makeComponentsAvailableOnMain(unavailableOnMain);
305
315
  }
306
316
  async parseValues(to, componentPattern, checkoutProps) {
307
- if (to === _constants().HEAD) checkoutProps.head = true;else if (to === _constants().LATEST) checkoutProps.latest = true;else if (to === 'reset') checkoutProps.reset = true;else {
317
+ if (to === _constants().HEAD) checkoutProps.head = true;else if (to === _constants().LATEST) checkoutProps.latest = true;else if (to === 'reset') checkoutProps.reset = true;else if (to === 'main') checkoutProps.main = true;else {
308
318
  if (!_legacyBitId().BitId.isValidVersion(to)) throw new (_bitError().BitError)(`the specified version "${to}" is not a valid version`);
309
319
  checkoutProps.version = to;
310
320
  }
@@ -329,6 +339,9 @@ class CheckoutMain {
329
339
  if (checkoutProps.workspaceOnly && !checkoutProps.head) {
330
340
  throw new (_bitError().BitError)(`--workspace-only flag can only be used with "head" (bit checkout head --workspace-only)`);
331
341
  }
342
+ if (checkoutProps.revert) {
343
+ checkoutProps.skipUpdatingBitmap = true;
344
+ }
332
345
  const idsOnWorkspace = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();
333
346
  const currentLane = await this.workspace.consumer.getCurrentLaneObject();
334
347
  const currentLaneIds = currentLane === null || currentLane === void 0 ? void 0 : currentLane.toBitIds();
@@ -357,6 +370,8 @@ class CheckoutMain {
357
370
  version,
358
371
  head: headVersion,
359
372
  reset,
373
+ revert,
374
+ main,
360
375
  latest: latestVersion,
361
376
  versionPerId
362
377
  } = checkoutProps;
@@ -373,13 +388,19 @@ class CheckoutMain {
373
388
  if (!componentModel) {
374
389
  return returnFailure(`component ${component.id.toString()} is new, no version to checkout`, true);
375
390
  }
391
+ if (main && !componentModel.head) {
392
+ return returnFailure(`component ${component.id.toString()} is not available on main`);
393
+ }
376
394
  const unmerged = repo.unmergedComponents.getEntry(component.name);
377
395
  if (!reset && unmerged) {
378
396
  return returnFailure(`component ${component.id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`);
379
397
  }
380
398
  const getNewVersion = async () => {
399
+ var _componentModel$head;
381
400
  if (reset) return component.id.version;
382
401
  if (headVersion) return componentModel.headIncludeRemote(repo);
402
+ // we verified previously that head exists in case of "main"
403
+ if (main) return (_componentModel$head = componentModel.head) === null || _componentModel$head === void 0 ? void 0 : _componentModel$head.toString();
383
404
  if (latestVersion) {
384
405
  const latest = componentModel.latestVersionIfExist();
385
406
  return latest || componentModel.headIncludeRemote(repo);
@@ -389,7 +410,7 @@ class CheckoutMain {
389
410
  return (_versionPerId$find = versionPerId.find(id => id._legacy.isEqualWithoutVersion(component.id))) === null || _versionPerId$find === void 0 ? void 0 : _versionPerId$find.version;
390
411
  }
391
412
 
392
- // @ts-ignore if !reset the version is defined
413
+ // if all above are false, the version is defined
393
414
  return version;
394
415
  };
395
416
  const newVersion = await getNewVersion();
@@ -431,7 +452,7 @@ class CheckoutMain {
431
452
  return returnFailure(`component has been removed`, true);
432
453
  }
433
454
  const newId = component.id.changeVersion(newVersion);
434
- if (reset || !isModified) {
455
+ if (reset || !isModified || revert) {
435
456
  // if the component is not modified, no need to try merge the files, they will be written later on according to the
436
457
  // checked out version. same thing when no version is specified, it'll be reset to the model-version later.
437
458
  return {
@@ -496,7 +517,7 @@ class CheckoutMain {
496
517
  static async provider([cli, workspace, loggerMain, compWriter, importer, remove]) {
497
518
  const logger = loggerMain.createLogger(_checkout().CheckoutAspect.id);
498
519
  const checkoutMain = new CheckoutMain(workspace, logger, compWriter, importer, remove);
499
- cli.register(new (_checkoutCmd().CheckoutCmd)(checkoutMain));
520
+ cli.register(new (_checkoutCmd().CheckoutCmd)(checkoutMain), new (_revertCmd().RevertCmd)(checkoutMain));
500
521
  return checkoutMain;
501
522
  }
502
523
  }
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutMain","constructor","workspace","logger","componentWriter","importer","remove","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","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","scope","legacyScope","scopeImporter","importManyIfMissingWithoutDeps","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","componentStatus","failureMessage","shouldBeRemoved","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","currentComponent","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","leftUnresolvedConflicts","componentWriterResults","length","manyComponentsWriterOpts","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","skipUpdatingBitMap","skipUpdatingBitmap","writeMany","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","componentIdsToRemove","undefined","removeLocallyByIds","force","removedComponents","n","toString","installationError","compilationError","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","OutsideWorkspaceError","importCurrentObjects","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","hasScope","changeScope","scopeComponentsImporter","importWithoutDeps","toVersionLatest","cache","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","versionPerId","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","latestVersionIfExist","newVersion","hasVersion","existingBitMapId","getBitId","ignoreVersion","divergeDataForMergePending","getDivergeDataForMergePending","isMergePending","isDiverged","currentVersionObject","loadVersion","isModified","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","RemoveAspect","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 RemoveAspect, { RemoveMain } from '@teambit/remove';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\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';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n ComponentStatusBase,\n} from './checkout-version';\n\nexport type CheckoutProps = {\n version?: string; // if reset/head/latest 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 versionPerId?: ComponentID[]; // if given, the ComponentID.version is the version to checkout to.\n skipUpdatingBitmap?: boolean; // needed for stash\n};\n\nexport type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {\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(\n private workspace: Workspace,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private remove: RemoveMain\n ) {}\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 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 .filter((componentStatus) => !componentStatus.shouldBeRemoved)\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(\n succeededComponents,\n ({ id, currentComponent: componentFromFS, mergeResults }) => {\n return applyVersion(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);\n }\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 skipUpdatingBitMap: checkoutProps.skipUpdatingBitmap,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\n await deleteFilesIfNeeded(componentsResults, this.workspace);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n if (componentIdsToRemove.length) {\n await this.remove.removeLocallyByIds(componentIdsToRemove, { force: true });\n }\n\n return {\n components: appliedVersionComponents,\n removedComponents: componentIdsToRemove,\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 await this.importer.importCurrentObjects(); // important. among others, it fetches the remote lane object and its new components.\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.importWithoutDeps(BitIds.fromArray(notExported || []).toVersionLatest(), {\n cache: false,\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, if these components are really new, ignore the 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 // current lane object is up to date due to the previous `importCurrentObjects()` call\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, versionPerId } = checkoutProps;\n const repo = consumer.scope.objects;\n const componentModel = await consumer.scope.getModelComponentIfExist(component.id);\n const componentStatus: ComponentStatusBeforeMergeAttempt = { 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) {\n const latest = componentModel.latestVersionIfExist();\n return latest || componentModel.headIncludeRemote(repo);\n }\n if (versionPerId) {\n return versionPerId.find((id) => id._legacy.isEqualWithoutVersion(component.id))?.version as string;\n }\n\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 if (!reset) {\n const divergeDataForMergePending = await componentModel.getDivergeDataForMergePending(repo);\n const isMergePending = divergeDataForMergePending.isDiverged();\n if (isMergePending) {\n return returnFailure(`component is merge-pending and cannot be checked out, run \"bit status\" for more info`);\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 | undefined;\n if (componentVersion?.isRemoved() && existingBitMapId) {\n componentStatus.shouldBeRemoved = true;\n return returnFailure(`component has been removed`, true);\n }\n\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 { currentComponent: component, componentFromModel: componentVersion, id: newId };\n }\n\n const propsForMerge = {\n currentlyUsedVersion,\n componentModel,\n };\n\n return { currentComponent: component, componentFromModel: componentVersion, id: newId, propsForMerge };\n }\n\n private async getMergeStatus({\n currentComponent: 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 { currentComponent: componentFromFS, componentFromModel, id, mergeResults };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, ComponentWriterAspect, ImporterAspect, RemoveAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain, compWriter, importer, remove]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n RemoveMain\n ]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger, compWriter, importer, remove);\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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA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C;IACtFgM,GAAG,CAACM,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCA7XY3M,YAAY,WA2WR,EAAE;AAAA,gCA3WNA,YAAY,kBA4WD,CAAC8M,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wCAAqB,EAAEC,mBAAc,EAAEC,iBAAY,CAAC;AAAA,gCA5W1GnN,YAAY,aA8WNoN,kBAAW;AAiB9BV,0BAAc,CAACW,UAAU,CAACrN,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
1
+ {"version":3,"names":["CheckoutMain","constructor","workspace","logger","componentWriter","importer","remove","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","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","scope","legacyScope","scopeImporter","importManyIfMissingWithoutDeps","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","componentStatus","failureMessage","shouldBeRemoved","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","currentComponent","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","leftUnresolvedConflicts","componentWriterResults","length","manyComponentsWriterOpts","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","skipUpdatingBitMap","skipUpdatingBitmap","writeMany","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","componentIdsToRemove","undefined","removeLocallyByIds","force","removedComponents","n","toString","installationError","compilationError","checkoutByCLIValues","to","componentPattern","revert","setStatusLine","BEFORE_CHECKOUT","OutsideWorkspaceError","importCurrentObjects","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","hasScope","changeScope","scopeComponentsImporter","importWithoutDeps","toVersionLatest","cache","error","unavailableOnMain","getUnavailableOnMainComponents","bitMap","makeComponentsAvailableOnMain","HEAD","LATEST","latest","main","BitId","isValidVersion","BitError","console","idsOnWorkspace","idsByPattern","listIds","currentLane","getCurrentLaneObject","currentLaneIds","toBitIds","hasWithoutVersion","lane","laneBitIds","newIds","bitId","isEqualWithoutVersion","newComponentIds","resolveMultipleComponentIds","nonRemovedNewIds","isRemoved","isComponentRemoved","headVersion","latestVersion","versionPerId","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","latestVersionIfExist","newVersion","hasVersion","existingBitMapId","getBitId","ignoreVersion","divergeDataForMergePending","getDivergeDataForMergePending","isMergePending","isDiverged","currentVersionObject","loadVersion","isModified","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","RevertCmd","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","RemoveAspect","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 RemoveAspect, { RemoveMain } from '@teambit/remove';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer';\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';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n ComponentStatusBase,\n} from './checkout-version';\nimport { RevertCmd } from './revert-cmd';\n\nexport type CheckoutProps = {\n version?: string; // if reset/head/latest is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n latest?: boolean;\n main?: boolean; // relevant for \"revert\" only\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 revert?: boolean;\n all?: boolean; // checkout all ids\n isLane?: boolean;\n workspaceOnly?: boolean;\n versionPerId?: ComponentID[]; // if given, the ComponentID.version is the version to checkout to.\n skipUpdatingBitmap?: boolean; // needed for stash\n};\n\nexport type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {\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' | 'main' | string;\n\nexport class CheckoutMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private remove: RemoveMain\n ) {}\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 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 .filter((componentStatus) => !componentStatus.shouldBeRemoved)\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(\n succeededComponents,\n ({ id, currentComponent: componentFromFS, mergeResults }) => {\n return applyVersion(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);\n }\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 skipUpdatingBitMap: checkoutProps.skipUpdatingBitmap,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\n await deleteFilesIfNeeded(componentsResults, this.workspace);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n if (componentIdsToRemove.length) {\n await this.remove.removeLocallyByIds(componentIdsToRemove, { force: true });\n }\n\n return {\n components: appliedVersionComponents,\n removedComponents: componentIdsToRemove,\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 const { revert } = checkoutProps;\n this.logger.setStatusLine(revert ? 'reverting components...' : BEFORE_CHECKOUT);\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n await this.importer.importCurrentObjects(); // important. among others, it fetches the remote lane object and its new components.\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.importWithoutDeps(BitIds.fromArray(notExported || []).toVersionLatest(), {\n cache: false,\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, if these components are really new, ignore the 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 if (to === 'main') checkoutProps.main = 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 if (checkoutProps.revert) {\n checkoutProps.skipUpdatingBitmap = true;\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 // current lane object is up to date due to the previous `importCurrentObjects()` call\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, revert, main, latest: latestVersion, versionPerId } = checkoutProps;\n const repo = consumer.scope.objects;\n const componentModel = await consumer.scope.getModelComponentIfExist(component.id);\n const componentStatus: ComponentStatusBeforeMergeAttempt = { 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 if (main && !componentModel.head) {\n return returnFailure(`component ${component.id.toString()} is not available on main`);\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 if (headVersion) return componentModel.headIncludeRemote(repo);\n // we verified previously that head exists in case of \"main\"\n if (main) return componentModel.head?.toString() as string;\n if (latestVersion) {\n const latest = componentModel.latestVersionIfExist();\n return latest || componentModel.headIncludeRemote(repo);\n }\n if (versionPerId) {\n return versionPerId.find((id) => id._legacy.isEqualWithoutVersion(component.id))?.version as string;\n }\n\n // if all above are false, the version is defined\n return version as string;\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 if (!reset) {\n const divergeDataForMergePending = await componentModel.getDivergeDataForMergePending(repo);\n const isMergePending = divergeDataForMergePending.isDiverged();\n if (isMergePending) {\n return returnFailure(`component is merge-pending and cannot be checked out, run \"bit status\" for more info`);\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 | undefined;\n if (componentVersion?.isRemoved() && existingBitMapId) {\n componentStatus.shouldBeRemoved = true;\n return returnFailure(`component has been removed`, true);\n }\n\n const newId = component.id.changeVersion(newVersion);\n\n if (reset || !isModified || revert) {\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 { currentComponent: component, componentFromModel: componentVersion, id: newId };\n }\n\n const propsForMerge = {\n currentlyUsedVersion,\n componentModel,\n };\n\n return { currentComponent: component, componentFromModel: componentVersion, id: newId, propsForMerge };\n }\n\n private async getMergeStatus({\n currentComponent: 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 { currentComponent: componentFromFS, componentFromModel, id, mergeResults };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, ComponentWriterAspect, ImporterAspect, RemoveAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain, compWriter, importer, remove]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n RemoveMain\n ]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger, compWriter, importer, remove);\n cli.register(new CheckoutCmd(checkoutMain), new RevertCmd(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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAyC;AAAA;AAAA;AAAA;AAgClC,MAAMA,YAAY,CAAC;EACxBC,WAAW,CACDC,SAAoB,EACpBC,MAAc,EACdC,eAAoC,EACpCC,QAAsB,EACtBC,MAAkB,EAC1B;IAAA,KALQJ,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,MAAc,GAAdA,MAAc;IAAA,KACdC,eAAoC,GA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,YAAY,CAAC,CAAC;IACxE,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCAtYY7M,YAAY,WAoXR,EAAE;AAAA,gCApXNA,YAAY,kBAqXD,CAACiN,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,EAAEC,wCAAqB,EAAEC,mBAAc,EAAEC,iBAAY,CAAC;AAAA,gCArX1GtN,YAAY,aAuXNuN,kBAAW;AAiB9BX,0BAAc,CAACY,UAAU,CAACxN,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
@@ -0,0 +1,20 @@
1
+ import { Command, CommandOptions } from '@teambit/cli';
2
+ import { CheckoutMain } from './checkout.main.runtime';
3
+ export declare class RevertCmd implements Command {
4
+ private checkout;
5
+ name: string;
6
+ arguments: {
7
+ name: string;
8
+ description: string;
9
+ }[];
10
+ description: string;
11
+ group: string;
12
+ alias: string;
13
+ options: CommandOptions;
14
+ loader: boolean;
15
+ constructor(checkout: CheckoutMain);
16
+ report([componentPattern, to]: [string, string], { verbose, skipDependencyInstallation, }: {
17
+ verbose?: boolean;
18
+ skipDependencyInstallation?: boolean;
19
+ }): Promise<string>;
20
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.array.iterator.js");
5
+ require("core-js/modules/es.promise.js");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.RevertCmd = void 0;
10
+ function _defineProperty2() {
11
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ _defineProperty2 = function () {
13
+ return data;
14
+ };
15
+ return data;
16
+ }
17
+ function _constants() {
18
+ const data = require("@teambit/legacy/dist/constants");
19
+ _constants = function () {
20
+ return data;
21
+ };
22
+ return data;
23
+ }
24
+ function _checkoutCmd() {
25
+ const data = require("./checkout-cmd");
26
+ _checkoutCmd = function () {
27
+ return data;
28
+ };
29
+ return data;
30
+ }
31
+ class RevertCmd {
32
+ constructor(checkout) {
33
+ this.checkout = checkout;
34
+ (0, _defineProperty2().default)(this, "name", 'revert <component-pattern> <to>');
35
+ (0, _defineProperty2().default)(this, "arguments", [{
36
+ name: 'component-pattern',
37
+ description: _constants().COMPONENT_PATTERN_HELP
38
+ }, {
39
+ name: 'to',
40
+ description: "permitted values: [main, specific-version]. 'main' - head version on main."
41
+ }]);
42
+ (0, _defineProperty2().default)(this, "description", 'replace the current component files by the specified version, leave the version intact');
43
+ (0, _defineProperty2().default)(this, "group", 'development');
44
+ (0, _defineProperty2().default)(this, "alias", '');
45
+ (0, _defineProperty2().default)(this, "options", [['v', 'verbose', 'showing verbose output for inspection'], ['x', 'skip-dependency-installation', 'do not install packages of the imported components']]);
46
+ (0, _defineProperty2().default)(this, "loader", true);
47
+ }
48
+ async report([componentPattern, to], {
49
+ verbose = false,
50
+ skipDependencyInstallation = false
51
+ }) {
52
+ return new (_checkoutCmd().CheckoutCmd)(this.checkout).report([to, componentPattern], {
53
+ verbose,
54
+ skipDependencyInstallation,
55
+ revert: true
56
+ });
57
+ }
58
+ }
59
+ exports.RevertCmd = RevertCmd;
60
+
61
+ //# sourceMappingURL=revert-cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RevertCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","componentPattern","to","verbose","skipDependencyInstallation","CheckoutCmd","revert"],"sources":["revert-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { CheckoutMain } from './checkout.main.runtime';\nimport { CheckoutCmd } from './checkout-cmd';\n\nexport class RevertCmd implements Command {\n name = 'revert <component-pattern> <to>';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'to',\n description: \"permitted values: [main, specific-version]. 'main' - head version on main.\",\n },\n ];\n description = 'replace the current component files by the specified version, leave the version intact';\n group = 'development';\n alias = '';\n options = [\n ['v', 'verbose', 'showing verbose output for inspection'],\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 [componentPattern, to]: [string, string],\n {\n verbose = false,\n skipDependencyInstallation = false,\n }: {\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n }\n ) {\n return new CheckoutCmd(this.checkout).report([to, componentPattern], {\n verbose,\n skipDependencyInstallation,\n revert: true,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,SAAS,CAAoB;EAqBxCC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,8CApBnC,iCAAiC;IAAA,mDAC5B,CACV;MACEC,IAAI,EAAE,mBAAmB;MACzBC,WAAW,EAAEC;IACf,CAAC,EACD;MACEF,IAAI,EAAE,IAAI;MACVC,WAAW,EAAE;IACf,CAAC,CACF;IAAA,qDACa,wFAAwF;IAAA,+CAC9F,aAAa;IAAA,+CACb,EAAE;IAAA,iDACA,CACR,CAAC,GAAG,EAAE,SAAS,EAAE,uCAAuC,CAAC,EACzD,CAAC,GAAG,EAAE,8BAA8B,EAAE,oDAAoD,CAAC,CAC5F;IAAA,gDACQ,IAAI;EAEgC;EAE7C,MAAME,MAAM,CACV,CAACC,gBAAgB,EAAEC,EAAE,CAAmB,EACxC;IACEC,OAAO,GAAG,KAAK;IACfC,0BAA0B,GAAG;EAI/B,CAAC,EACD;IACA,OAAO,KAAIC,0BAAW,EAAC,IAAI,CAACT,QAAQ,CAAC,CAACI,MAAM,CAAC,CAACE,EAAE,EAAED,gBAAgB,CAAC,EAAE;MACnEE,OAAO;MACPC,0BAA0B;MAC1BE,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;AACF;AAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/checkout",
3
- "version": "0.0.273",
3
+ "version": "0.0.275",
4
4
  "homepage": "https://bit.cloud/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.273"
9
+ "version": "0.0.275"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,14 +17,14 @@
17
17
  "@teambit/legacy-bit-id": "0.0.423",
18
18
  "@teambit/harmony": "0.4.6",
19
19
  "@teambit/component-id": "0.0.427",
20
- "@teambit/cli": "0.0.740",
21
- "@teambit/merging": "0.0.419",
22
- "@teambit/workspace": "0.0.1104",
20
+ "@teambit/cli": "0.0.741",
21
+ "@teambit/merging": "0.0.421",
22
+ "@teambit/workspace": "0.0.1106",
23
23
  "@teambit/bit-error": "0.0.402",
24
- "@teambit/component-writer": "0.0.140",
25
- "@teambit/importer": "0.0.533",
26
- "@teambit/logger": "0.0.833",
27
- "@teambit/remove": "0.0.281"
24
+ "@teambit/component-writer": "0.0.142",
25
+ "@teambit/importer": "0.0.535",
26
+ "@teambit/logger": "0.0.834",
27
+ "@teambit/remove": "0.0.283"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/lodash": "4.14.165",
@@ -36,7 +36,7 @@
36
36
  "@types/testing-library__jest-dom": "5.9.5"
37
37
  },
38
38
  "peerDependencies": {
39
- "@teambit/legacy": "1.0.521",
39
+ "@teambit/legacy": "1.0.522",
40
40
  "react": "^16.8.0 || ^17.0.0",
41
41
  "react-dom": "^16.8.0 || ^17.0.0"
42
42
  },