@teambit/checkout 0.0.66 → 0.0.68

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,13 +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, verbose, skipNpmInstall, skipDependencyInstallation, }: {
18
+ report([to, componentPattern]: [string, string], { interactiveMerge, ours, theirs, manual, reset, all, entireLane, 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
26
  verbose?: boolean;
26
27
  skipNpmInstall?: boolean;
27
28
  skipDependencyInstallation?: boolean;
@@ -62,7 +62,7 @@ class CheckoutCmd {
62
62
  \`bit checkout latest [component-pattern]\` => checkout to the latest satisfying semver tag, omit [component-pattern] to checkout latest for all
63
63
  \`bit checkout reset [component-pattern]\` => remove local modifications from the specified ids (or all components when --all is used)`);
64
64
  (0, _defineProperty2().default)(this, "alias", 'U');
65
- (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'], ['v', 'verbose', 'showing verbose output for inspection'], ['', 'reset', 'DEPRECATED. run "bit checkout reset" instead'], ['', 'skip-npm-install', 'DEPRECATED. use "--skip-dependency-installation" instead'], ['', 'skip-dependency-installation', 'do not install packages of the imported components']]);
65
+ (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'], ['', 'skip-dependency-installation', 'do not install packages of the imported components']]);
66
66
  (0, _defineProperty2().default)(this, "loader", true);
67
67
  }
68
68
  async report([to, componentPattern], {
@@ -72,6 +72,7 @@ class CheckoutCmd {
72
72
  manual = false,
73
73
  reset = false,
74
74
  all = false,
75
+ entireLane = false,
75
76
  verbose = false,
76
77
  skipNpmInstall = false,
77
78
  skipDependencyInstallation = false
@@ -90,35 +91,38 @@ class CheckoutCmd {
90
91
  all,
91
92
  verbose,
92
93
  isLane: false,
93
- skipNpmInstall: skipDependencyInstallation
94
+ skipNpmInstall: skipDependencyInstallation,
95
+ entireLane
94
96
  };
95
97
  const {
96
98
  components,
97
99
  version,
98
100
  failedComponents,
99
- leftUnresolvedConflicts
101
+ leftUnresolvedConflicts,
102
+ newFromLane,
103
+ newFromLaneAdded
100
104
  } = await this.checkout.checkoutByCLIValues(to, componentPattern || '', checkoutProps);
101
105
  const isHead = to === 'head';
102
106
  const isReset = to === 'reset';
103
107
  const isLatest = to === 'latest';
108
+ // components that failed for no legitimate reason. e.g. merge-conflict.
109
+ const realFailedComponents = (failedComponents || []).filter(f => !f.unchangedLegitimately);
110
+ // components that weren't checked out for legitimate reasons, e.g. up-to-date.
111
+ const notCheckedOutComponents = (failedComponents || []).filter(f => f.unchangedLegitimately);
104
112
  const getFailureOutput = () => {
105
- // components that failed for no legitimate reason. e.g. merge-conflict.
106
- const realFailedComponents = failedComponents === null || failedComponents === void 0 ? void 0 : failedComponents.filter(f => !f.unchangedLegitimately);
107
- if (!realFailedComponents || !realFailedComponents.length) return '';
108
- const title = 'the checkout has been canceled on the following component(s)';
113
+ if (!realFailedComponents.length) return '';
114
+ const title = 'the checkout has been failed on the following component(s)';
109
115
  const body = realFailedComponents.map(failedComponent => `${_chalk().default.bold(failedComponent.id.toString())} - ${_chalk().default.red(failedComponent.failureMessage)}`).join('\n');
110
- return `${title}\n${body}\n\n`;
116
+ return `${_chalk().default.underline(title)}\n${body}\n\n`;
111
117
  };
112
- const getNeutralOutput = () => {
113
- // components that weren't checked out for legitimate reasons, e.g. up-to-date.
114
- const neutralComponents = (failedComponents || []).filter(f => f.unchangedLegitimately);
115
- if (!neutralComponents.length) return '';
118
+ const getNotCheckedOutOutput = () => {
119
+ if (!notCheckedOutComponents.length) return '';
116
120
  if (!verbose && all) {
117
- return _chalk().default.green(`checkout was not needed for ${_chalk().default.bold(neutralComponents.length.toString())} components (use --verbose to get more details)\n`);
121
+ return _chalk().default.green(`checkout was not needed for ${_chalk().default.bold(notCheckedOutComponents.length.toString())} components (use --verbose to get more details)\n`);
118
122
  }
119
123
  const title = 'the checkout was not needed on the following component(s)';
120
- const body = neutralComponents.map(failedComponent => `${_chalk().default.bold(failedComponent.id.toString())} - ${failedComponent.failureMessage}`).join('\n');
121
- return `${title}\n${body}\n\n`;
124
+ const body = notCheckedOutComponents.map(failedComponent => `${failedComponent.id.toString()} - ${failedComponent.failureMessage}`).join('\n');
125
+ return `${_chalk().default.underline(title)}\n${body}\n\n`;
122
126
  };
123
127
  const getConflictSummary = () => {
124
128
  if (!components || !components.length || !leftUnresolvedConflicts) return '';
@@ -136,12 +140,12 @@ once ready, snap/tag the components to persist the changes`;
136
140
  const title = `successfully switched ${_chalk().default.bold(componentName)} to version ${_chalk().default.bold(
137
141
  // @ts-ignore version is defined when !isReset
138
142
  isHead || isLatest ? component.id.version : version)}\n`;
139
- return `${title} ${(0, _mergeVersion().applyVersionReport)(components, false)}`;
143
+ return `${_chalk().default.underline(title)} ${(0, _mergeVersion().applyVersionReport)(components, false)}`;
140
144
  }
141
145
  if (isReset) {
142
146
  const title = 'successfully reset the following components\n\n';
143
147
  const body = components.map(component => _chalk().default.bold(component.id.toString())).join('\n');
144
- return title + body;
148
+ return _chalk().default.underline(title) + body;
145
149
  }
146
150
  const getVerOutput = () => {
147
151
  if (isHead) return 'their head version';
@@ -153,9 +157,29 @@ once ready, snap/tag the components to persist the changes`;
153
157
  const title = `successfully switched the following components to ${versionOutput}\n\n`;
154
158
  const showVersion = isHead || isReset;
155
159
  const componentsStr = (0, _mergeVersion().applyVersionReport)(components, true, showVersion);
156
- return title + componentsStr;
160
+ return _chalk().default.underline(title) + componentsStr;
157
161
  };
158
- return getFailureOutput() + getNeutralOutput() + getSuccessfulOutput() + getConflictSummary();
162
+ const getNewOnLaneOutput = () => {
163
+ if (!(newFromLane !== null && newFromLane !== void 0 && newFromLane.length)) return '';
164
+ 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`;
165
+ const body = newFromLane.join('\n');
166
+ return `\n\n${_chalk().default.underline(title)}\n${body}`;
167
+ };
168
+ const getSummary = () => {
169
+ const checkedOut = (components === null || components === void 0 ? void 0 : components.length) || 0;
170
+ const notCheckedOutLegitimately = notCheckedOutComponents.length;
171
+ const failedToCheckOut = realFailedComponents.length;
172
+ const newLines = '\n\n';
173
+ const title = _chalk().default.bold.underline('Checkout Summary');
174
+ const checkedOutStr = `\nTotal CheckedOut: ${_chalk().default.bold(checkedOut.toString())}`;
175
+ const unchangedLegitimatelyStr = `\nTotal Unchanged: ${_chalk().default.bold(notCheckedOutLegitimately.toString())}`;
176
+ const failedToCheckOutStr = `\nTotal Failed: ${_chalk().default.bold(failedToCheckOut.toString())}`;
177
+ const newOnLaneNum = (newFromLane === null || newFromLane === void 0 ? void 0 : newFromLane.length) || 0;
178
+ const newOnLaneAddedStr = newFromLaneAdded ? ' (added)' : ' (not added)';
179
+ const newOnLaneStr = newOnLaneNum ? `\nNew on lane${newOnLaneAddedStr}: ${_chalk().default.bold(newOnLaneNum.toString())}` : '';
180
+ return newLines + title + checkedOutStr + unchangedLegitimatelyStr + failedToCheckOutStr + newOnLaneStr;
181
+ };
182
+ return getFailureOutput() + getNotCheckedOutOutput() + getSuccessfulOutput() + getNewOnLaneOutput() + getConflictSummary() + getSummary();
159
183
  }
160
184
  }
161
185
  exports.CheckoutCmd = CheckoutCmd;
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","ours","theirs","manual","reset","all","verbose","skipNpmInstall","skipDependencyInstallation","BitError","console","log","chalk","yellow","checkoutProps","promptMergeOptions","mergeStrategy","getMergeStrategy","isLane","components","version","failedComponents","leftUnresolvedConflicts","checkoutByCLIValues","isHead","isReset","isLatest","getFailureOutput","realFailedComponents","filter","f","unchangedLegitimately","length","title","body","map","failedComponent","bold","id","toString","red","failureMessage","join","getNeutralOutput","neutralComponents","green","getConflictSummary","suggestion","underline","conflictSummaryReport","getSuccessfulOutput","component","componentName","toStringWithoutVersion","applyVersionReport","getVerOutput","versionOutput","showVersion","componentsStr"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport {\n ApplyVersionResults,\n getMergeStrategy,\n applyVersionReport,\n conflictSummaryReport,\n} 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 ['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 ['', '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 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 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 };\n const { components, version, failedComponents, leftUnresolvedConflicts }: ApplyVersionResults =\n await this.checkout.checkoutByCLIValues(to, componentPattern || '', checkoutProps);\n const isHead = to === 'head';\n const isReset = to === 'reset';\n const isLatest = to === 'latest';\n const getFailureOutput = () => {\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = failedComponents?.filter((f) => !f.unchangedLegitimately);\n if (!realFailedComponents || !realFailedComponents.length) return '';\n const title = 'the checkout has been canceled 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 `${title}\\n${body}\\n\\n`;\n };\n const getNeutralOutput = () => {\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const neutralComponents = (failedComponents || []).filter((f) => f.unchangedLegitimately);\n if (!neutralComponents.length) return '';\n if (!verbose && all) {\n return chalk.green(\n `checkout was not needed for ${chalk.bold(\n neutralComponents.length.toString()\n )} components (use --verbose to get more details)\\n`\n );\n }\n\n const title = 'the checkout was not needed on the following component(s)';\n const body = neutralComponents\n .map((failedComponent) => `${chalk.bold(failedComponent.id.toString())} - ${failedComponent.failureMessage}`)\n .join('\\n');\n return `${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\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 `${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 title + body;\n }\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 title + componentsStr;\n };\n\n return getFailureOutput() + getNeutralOutput() + getSuccessfulOutput() + getConflictSummary();\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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,MAAMA,WAAW,CAAoB;EAwC1CC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,8CAvCnC,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,iD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","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","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"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport {\n ApplyVersionResults,\n getMergeStrategy,\n applyVersionReport,\n conflictSummaryReport,\n} 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 ['', '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 }: 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 );\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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,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,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAC9B,CAAC,GAAG,EAAE,aAAa,EAAE,4FAA4F,CAAC,EAClH,CAAC,GAAG,EAAE,SAAS,EAAE,uCAAuC,CAAC,EACzD,CAAC,EAAE,EAAE,OAAO,EAAE,8CAA8C,CAAC,EAC7D,CAAC,EAAE,EAAE,kBAAkB,EAA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C;MAC1C,MAAM6B,yBAAyB,GAAG/B,uBAAuB,CAACE,MAAM;MAChE,MAAM8B,gBAAgB,GAAGpC,oBAAoB,CAACM,MAAM;MACpD,MAAM+B,QAAQ,GAAG,MAAM;MACvB,MAAM9B,KAAK,GAAGxB,gBAAK,CAAC4B,IAAI,CAACM,SAAS,CAAC,kBAAkB,CAAC;MACtD,MAAMqB,aAAa,GAAI,uBAAsBvD,gBAAK,CAAC4B,IAAI,CAACuB,UAAU,CAACrB,QAAQ,EAAE,CAAE,EAAC;MAChF,MAAM0B,wBAAwB,GAAI,sBAAqBxD,gBAAK,CAAC4B,IAAI,CAACwB,yBAAyB,CAACtB,QAAQ,EAAE,CAAE,EAAC;MACzG,MAAM2B,mBAAmB,GAAI,mBAAkBzD,gBAAK,CAAC4B,IAAI,CAACyB,gBAAgB,CAACvB,QAAQ,EAAE,CAAE,EAAC;MACxF,MAAM4B,YAAY,GAAG,CAAA/C,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEY,MAAM,KAAI,CAAC;MAC7C,MAAMoC,iBAAiB,GAAG/C,gBAAgB,GAAG,UAAU,GAAG,cAAc;MACxE,MAAMgD,YAAY,GAAGF,YAAY,GAC5B,gBAAeC,iBAAkB,KAAI3D,gBAAK,CAAC4B,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;EAEhB;AACF;AAAC"}
@@ -1,7 +1,10 @@
1
1
  import { CLIMain } from '@teambit/cli';
2
2
  import { Logger, LoggerMain } from '@teambit/logger';
3
3
  import { Workspace } from '@teambit/workspace';
4
+ import { BitId } from '@teambit/legacy-bit-id';
4
5
  import { ApplyVersionResults, MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
6
+ import { Version, ModelComponent } from '@teambit/legacy/dist/scope/models';
7
+ import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
5
8
  import { ComponentID } from '@teambit/component-id';
6
9
  export declare type CheckoutProps = {
7
10
  version?: string;
@@ -15,6 +18,18 @@ export declare type CheckoutProps = {
15
18
  reset?: boolean;
16
19
  all?: boolean;
17
20
  isLane?: boolean;
21
+ entireLane?: boolean;
22
+ };
23
+ export declare type ComponentStatusBeforeMergeAttempt = {
24
+ componentFromFS?: ConsumerComponent;
25
+ componentFromModel?: Version;
26
+ id: BitId;
27
+ failureMessage?: string;
28
+ unchangedLegitimately?: boolean;
29
+ propsForMerge?: {
30
+ currentlyUsedVersion: string;
31
+ componentModel: ModelComponent;
32
+ };
18
33
  };
19
34
  declare type CheckoutTo = 'head' | 'reset' | string;
20
35
  export declare class CheckoutMain {
@@ -25,7 +40,9 @@ export declare class CheckoutMain {
25
40
  checkoutByCLIValues(to: CheckoutTo, componentPattern: string, checkoutProps: CheckoutProps): Promise<ApplyVersionResults>;
26
41
  private syncNewComponents;
27
42
  private parseValues;
28
- private getComponentStatus;
43
+ private getNewComponentsFromLane;
44
+ private getComponentStatusBeforeMergeAttempt;
45
+ private getMergeStatus;
29
46
  static slots: never[];
30
47
  static dependencies: import("@teambit/harmony").Aspect[];
31
48
  static runtime: import("@teambit/harmony").RuntimeDefinition;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.array.flat.js");
4
5
  require("core-js/modules/es.array.iterator.js");
6
+ require("core-js/modules/es.array.unscopables.flat.js");
5
7
  require("core-js/modules/es.promise.js");
6
8
  Object.defineProperty(exports, "__esModule", {
7
9
  value: true
@@ -49,6 +51,13 @@ function _bitError() {
49
51
  };
50
52
  return data;
51
53
  }
54
+ function _lodash() {
55
+ const data = require("lodash");
56
+ _lodash = function () {
57
+ return data;
58
+ };
59
+ return data;
60
+ }
52
61
  function _loaderMessages() {
53
62
  const data = require("@teambit/legacy/dist/cli/loader/loader-messages");
54
63
  _loaderMessages = function () {
@@ -141,7 +150,7 @@ class CheckoutMain {
141
150
  this.logger = logger;
142
151
  }
143
152
  async checkout(checkoutProps) {
144
- var _checkoutProps$ids;
153
+ var _checkoutProps$ids, _newFromLane;
145
154
  const consumer = this.workspace.consumer;
146
155
  const {
147
156
  version,
@@ -154,19 +163,34 @@ class CheckoutMain {
154
163
  const {
155
164
  components
156
165
  } = await consumer.loadComponents(bitIds);
157
- const getAllComponentsStatus = async () => {
166
+ const allComponentStatusBeforeMerge = await Promise.all(components.map(component => this.getComponentStatusBeforeMergeAttempt(component, checkoutProps)));
167
+ const compsNeedMerge = allComponentStatusBeforeMerge.filter(c => c.propsForMerge);
168
+ const compsNotNeedMerge = allComponentStatusBeforeMerge.filter(c => !c.propsForMerge);
169
+
170
+ // in case the requested versions to checkout don't exist locally, import them.
171
+ const toImport = allComponentStatusBeforeMerge.map(compStatus => {
172
+ const idsToImport = [compStatus.id];
173
+ if (compStatus.propsForMerge) {
174
+ idsToImport.push(compStatus.id.changeVersion(compStatus.propsForMerge.currentlyUsedVersion));
175
+ }
176
+ return idsToImport;
177
+ }).flat();
178
+ await this.workspace.scope.legacyScope.scopeImporter.importManyIfMissingWithoutDeps({
179
+ ids: _bitId().BitIds.fromArray(toImport)
180
+ });
181
+ const getComponentsStatusOfMergeNeeded = async () => {
158
182
  const tmp = new (_repositories().Tmp)(consumer.scope);
159
183
  try {
160
- const componentsStatusP = components.map(component => this.getComponentStatus(component, checkoutProps));
161
- const componentsStatus = await Promise.all(componentsStatusP);
184
+ const afterMergeAttempt = await Promise.all(compsNeedMerge.map(c => this.getMergeStatus(c)));
162
185
  await tmp.clear();
163
- return componentsStatus;
186
+ return afterMergeAttempt;
164
187
  } catch (err) {
165
188
  await tmp.clear();
166
189
  throw err;
167
190
  }
168
191
  };
169
- const allComponentsStatus = await getAllComponentsStatus();
192
+ const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();
193
+ const allComponentsStatus = [...compStatusMergeNeeded, ...compsNotNeedMerge];
170
194
  const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
171
195
  if (componentWithConflict) {
172
196
  if (!promptMergeOptions && !checkoutProps.mergeStrategy) {
@@ -193,7 +217,17 @@ class CheckoutMain {
193
217
  return (0, _checkoutVersion().applyVersion)(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);
194
218
  });
195
219
  (0, _checkoutVersion().markFilesToBeRemovedIfNeeded)(succeededComponents, componentsResults);
196
- const componentsWithDependencies = componentsResults.map(c => c.component).filter(c => c);
220
+ const componentsWithDependencies = (0, _lodash().compact)(componentsResults.map(c => c.component));
221
+ let newFromLane;
222
+ let newFromLaneAdded = false;
223
+ if (checkoutProps.head) {
224
+ newFromLane = await this.getNewComponentsFromLane(checkoutProps.ids || []);
225
+ if (checkoutProps.entireLane) {
226
+ const compsNewFromLane = await Promise.all(newFromLane.map(id => consumer.loadComponentWithDependenciesFromModel(id._legacy)));
227
+ componentsWithDependencies.push(...compsNewFromLane);
228
+ newFromLaneAdded = true;
229
+ }
230
+ }
197
231
  const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';
198
232
  if (componentsWithDependencies.length) {
199
233
  const manyComponentsWriter = new (_manyComponentsWriter().default)({
@@ -212,7 +246,9 @@ class CheckoutMain {
212
246
  components: appliedVersionComponents,
213
247
  version,
214
248
  failedComponents,
215
- leftUnresolvedConflicts
249
+ leftUnresolvedConflicts,
250
+ newFromLane: (_newFromLane = newFromLane) === null || _newFromLane === void 0 ? void 0 : _newFromLane.map(n => n.toString()),
251
+ newFromLaneAdded
216
252
  };
217
253
  }
218
254
  async checkoutByCLIValues(to, componentPattern, checkoutProps) {
@@ -232,7 +268,10 @@ class CheckoutMain {
232
268
  const notExported = ids === null || ids === void 0 ? void 0 : ids.filter(id => !id._legacy.hasScope()).map(id => id._legacy.changeScope(id.scope));
233
269
  const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;
234
270
  try {
235
- await scopeComponentsImporter.importManyDeltaWithoutDeps(_bitId().BitIds.fromArray(notExported || []), true);
271
+ await scopeComponentsImporter.importManyDeltaWithoutDeps({
272
+ ids: _bitId().BitIds.fromArray(notExported || []),
273
+ fromHead: true
274
+ });
236
275
  } catch (err) {
237
276
  // don't stop the process. it's possible that the scope doesn't exist yet because these are new components
238
277
  this.logger.error(`unable to sync new components due to an error`, err);
@@ -261,10 +300,23 @@ class CheckoutMain {
261
300
  if (!componentPattern && !checkoutProps.all) {
262
301
  throw new (_generalError().default)('please specify [component-pattern] or use --all flag');
263
302
  }
303
+ if (checkoutProps.entireLane && !checkoutProps.head) {
304
+ throw new (_bitError().BitError)(`--entire-lane flag can only be used with "head" (bit checkout head --entire-lane)`);
305
+ }
264
306
  const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();
265
307
  checkoutProps.ids = ids.map(id => checkoutProps.head || checkoutProps.latest ? id.changeVersion(_constants().LATEST) : id);
266
308
  }
267
- async getComponentStatus(component, checkoutProps) {
309
+ async getNewComponentsFromLane(ids) {
310
+ const lane = await this.workspace.consumer.getCurrentLaneObject();
311
+ if (!lane) {
312
+ return [];
313
+ }
314
+ const laneBitIds = lane.toBitIds();
315
+ const newIds = laneBitIds.filter(bitId => !ids.find(id => id._legacy.isEqualWithoutVersion(bitId)));
316
+ const newComponentIds = await this.workspace.resolveMultipleComponentIds(newIds);
317
+ return newComponentIds;
318
+ }
319
+ async getComponentStatusBeforeMergeAttempt(component, checkoutProps) {
268
320
  const consumer = this.workspace.consumer;
269
321
  const {
270
322
  version,
@@ -310,7 +362,7 @@ class CheckoutMain {
310
362
  }
311
363
  if (version && currentlyUsedVersion === version) {
312
364
  // it won't be relevant for 'reset' as it doesn't have a version
313
- return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`);
365
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`, true);
314
366
  }
315
367
  if (headVersion && currentlyUsedVersion === newVersion) {
316
368
  return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`, true);
@@ -318,8 +370,47 @@ class CheckoutMain {
318
370
  const currentVersionObject = await componentModel.loadVersion(currentlyUsedVersion, repo);
319
371
  const isModified = await consumer.isComponentModified(currentVersionObject, component);
320
372
  if (!isModified && reset) {
321
- return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`);
373
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`, true);
374
+ }
375
+ const versionRef = componentModel.getRef(newVersion);
376
+ if (!versionRef) throw new Error(`unable to get ref ${newVersion} from ${componentModel.id()}`);
377
+ const componentVersion = await consumer.scope.getObject(versionRef.hash);
378
+ const newId = component.id.changeVersion(newVersion);
379
+ if (reset || !isModified) {
380
+ // if the component is not modified, no need to try merge the files, they will be written later on according to the
381
+ // checked out version. same thing when no version is specified, it'll be reset to the model-version later.
382
+ return {
383
+ componentFromFS: component,
384
+ componentFromModel: componentVersion,
385
+ id: newId
386
+ };
322
387
  }
388
+ const propsForMerge = {
389
+ currentlyUsedVersion,
390
+ componentModel
391
+ };
392
+ return {
393
+ componentFromFS: component,
394
+ componentFromModel: componentVersion,
395
+ id: newId,
396
+ propsForMerge
397
+ };
398
+ }
399
+ async getMergeStatus({
400
+ componentFromFS,
401
+ componentFromModel,
402
+ id,
403
+ propsForMerge
404
+ }) {
405
+ if (!propsForMerge) throw new Error(`propsForMerge is missing for ${id.toString()}`);
406
+ if (!componentFromFS) throw new Error(`componentFromFS is missing for ${id.toString()}`);
407
+ const consumer = this.workspace.consumer;
408
+ const repo = consumer.scope.objects;
409
+ const {
410
+ currentlyUsedVersion,
411
+ componentModel
412
+ } = propsForMerge;
413
+
323
414
  // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.
324
415
  // 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
325
416
  // 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
@@ -329,30 +420,21 @@ class CheckoutMain {
329
420
  // to be added to 0.0.1
330
421
  // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.
331
422
  const baseVersion = currentlyUsedVersion;
423
+ const newVersion = id.version;
332
424
  const baseComponent = await componentModel.loadVersion(baseVersion, repo);
333
- let mergeResults;
334
- // if the component is not modified, no need to try merge the files, they will be written later on according to the
335
- // checked out version. same thing when no version is specified, it'll be reset to the model-version later.
336
- if (!reset && isModified) {
337
- const otherComponent = await componentModel.loadVersion(newVersion, repo);
338
- mergeResults = await (0, _mergeVersion().threeWayMerge)({
339
- consumer,
340
- otherComponent,
341
- otherLabel: newVersion,
342
- currentComponent: component,
343
- currentLabel: `${currentlyUsedVersion} modified`,
344
- baseComponent
345
- });
346
- }
347
- const versionRef = componentModel.getRef(newVersion);
348
- // @ts-ignore
349
- const componentVersion = await consumer.scope.getObject(versionRef.hash);
350
- const newId = component.id.changeVersion(newVersion);
351
- // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
425
+ const otherComponent = await componentModel.loadVersion(newVersion, repo);
426
+ const mergeResults = await (0, _mergeVersion().threeWayMerge)({
427
+ consumer,
428
+ otherComponent,
429
+ otherLabel: newVersion,
430
+ currentComponent: componentFromFS,
431
+ currentLabel: `${currentlyUsedVersion} modified`,
432
+ baseComponent
433
+ });
352
434
  return {
353
- componentFromFS: component,
354
- componentFromModel: componentVersion,
355
- id: newId,
435
+ componentFromFS,
436
+ componentFromModel,
437
+ id,
356
438
  mergeResults
357
439
  };
358
440
  }
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutMain","constructor","workspace","logger","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","bitIds","BitIds","fromArray","map","id","_legacy","scope","import","components","loadComponents","getAllComponentsStatus","tmp","Tmp","componentsStatusP","component","getComponentStatus","componentsStatus","Promise","all","clear","err","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","filter","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsWithDependencies","c","leftUnresolvedConflicts","length","manyComponentsWriter","ManyComponentsWriter","installNpmPackages","skipNpmInstall","override","verbose","resetConfig","reset","writeAll","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","ConsumerNotFound","parseValues","checkoutResults","onDestroy","head","notExported","hasScope","changeScope","scopeComponentsImporter","scopeImporter","importManyDeltaWithoutDeps","error","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsByPattern","listIds","changeVersion","headVersion","latestVersion","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","toString","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","newVersion","hasVersion","existingBitMapId","bitMap","getBitId","ignoreVersion","currentlyUsedVersion","currentVersionObject","loadVersion","isModified","isComponentModified","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","versionRef","getRef","componentVersion","getObject","hash","newId","componentFromModel","provider","cli","loggerMain","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { BitError } from '@teambit/bit-error';\nimport { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n} from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n ApplyVersionResults,\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 { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport mapSeries from 'p-map-series';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { ComponentWithDependencies } from '@teambit/legacy/dist/scope';\nimport Version from '@teambit/legacy/dist/scope/models/version';\nimport { Tmp } from '@teambit/legacy/dist/scope/repositories';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\nimport { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge';\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};\n\ntype CheckoutTo = 'head' | 'reset' | string;\n\nexport class CheckoutMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\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 await consumer.scope.import(bitIds, false);\n const { components } = await consumer.loadComponents(bitIds);\n\n const getAllComponentsStatus = async (): Promise<ComponentStatus[]> => {\n const tmp = new Tmp(consumer.scope);\n try {\n const componentsStatusP = components.map((component) => this.getComponentStatus(component, checkoutProps));\n const componentsStatus = await Promise.all(componentsStatusP);\n await tmp.clear();\n return componentsStatus;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n\n const allComponentsStatus: ComponentStatus[] = await getAllComponentsStatus();\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 componentsWithDependencies = componentsResults\n .map((c) => c.component)\n .filter((c) => c) as ComponentWithDependencies[];\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n if (componentsWithDependencies.length) {\n const manyComponentsWriter = new ManyComponentsWriter({\n consumer,\n componentsWithDependencies,\n installNpmPackages: !checkoutProps.skipNpmInstall && !leftUnresolvedConflicts,\n override: true,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n });\n await manyComponentsWriter.writeAll();\n await deleteFilesIfNeeded(componentsResults, consumer);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n return { components: appliedVersionComponents, version, failedComponents, leftUnresolvedConflicts };\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 ConsumerNotFound();\n const consumer = this.workspace.consumer;\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(BitIds.fromArray(notExported || []), true);\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 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 const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async getComponentStatus(\n component: ConsumerComponent,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatus> {\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}`);\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`);\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 baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n let mergeResults: MergeResultsThreeWay | null | undefined;\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 if (!reset && isModified) {\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n mergeResults = await threeWayMerge({\n consumer,\n otherComponent,\n otherLabel: newVersion,\n currentComponent: component,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n }\n const versionRef = componentModel.getRef(newVersion);\n // @ts-ignore\n const componentVersion = await consumer.scope.getObject(versionRef.hash);\n const newId = component.id.changeVersion(newVersion);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n return { componentFromFS: component, componentFromModel: componentVersion, id: newId, mergeResults };\n }\n\n static slots = [];\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger);\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;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;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;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAmD;AAAA;AAkB5C,MAAMA,YAAY,CAAC;EACxBC,WAAW,CAASC,SAAoB,EAAUC,MAAc,EAAE;IAAA,KAA9CD,SAAoB,GAApBA,SAAoB;IAAA,KAAU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,gCA7NNA,YAAY,kBA8ND,CAACgJ,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,CAAC;AAAA,gCA9NrDlJ,YAAY,aAgONmJ,kBAAW;AAU9BP,0BAAc,CAACQ,UAAU,CAACpJ,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
1
+ {"version":3,"names":["CheckoutMain","constructor","workspace","logger","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","bitIds","BitIds","fromArray","map","id","_legacy","scope","import","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","componentsWithDependencies","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","entireLane","compsNewFromLane","loadComponentWithDependenciesFromModel","leftUnresolvedConflicts","length","manyComponentsWriter","ManyComponentsWriter","installNpmPackages","skipNpmInstall","override","verbose","resetConfig","reset","writeAll","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","n","toString","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","ConsumerNotFound","parseValues","checkoutResults","onDestroy","notExported","hasScope","changeScope","scopeComponentsImporter","importManyDeltaWithoutDeps","fromHead","error","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsByPattern","listIds","lane","getCurrentLaneObject","laneBitIds","toBitIds","newIds","bitId","isEqualWithoutVersion","newComponentIds","resolveMultipleComponentIds","headVersion","latestVersion","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","name","getNewVersion","headIncludeRemote","newVersion","hasVersion","existingBitMapId","bitMap","getBitId","ignoreVersion","currentVersionObject","loadVersion","isModified","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","baseVersion","baseComponent","otherComponent","threeWayMerge","otherLabel","currentComponent","currentLabel","provider","cli","loggerMain","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","CLIAspect","WorkspaceAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { 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 { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport {\n applyVersion,\n markFilesToBeRemovedIfNeeded,\n ComponentStatus,\n deleteFilesIfNeeded,\n} from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n ApplyVersionResults,\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 { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\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 ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\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) {}\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 await consumer.scope.import(bitIds, false);\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 componentsWithDependencies = 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.loadComponentWithDependenciesFromModel(id._legacy))\n );\n componentsWithDependencies.push(...compsNewFromLane);\n newFromLaneAdded = true;\n }\n }\n\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n if (componentsWithDependencies.length) {\n const manyComponentsWriter = new ManyComponentsWriter({\n consumer,\n componentsWithDependencies,\n installNpmPackages: !checkoutProps.skipNpmInstall && !leftUnresolvedConflicts,\n override: true,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n });\n await manyComponentsWriter.writeAll();\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 };\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 ConsumerNotFound();\n const consumer = this.workspace.consumer;\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 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 ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();\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 return newComponentIds;\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];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain]: [CLIMain, Workspace, LoggerMain]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger);\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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;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;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAmD;AAAA;AA+B5C,MAAMA,YAAY,CAAC;EACxBC,WAAW,CAASC,SAAoB,EAAUC,MAAc,EAAE;IAAA,KAA9CD,SAAoB,GAApBA,SAAoB;IAAA,KAAUC,MAAc,GAAdA,MAAc;EAAG;EAEnE,MAAMC,QAAQ,CAACC,aAA4B,EAAgC;IAAA;IACzE,MAAMC,QAAQ,GAAG,IAAI,CA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;MACtBuB,gBAAgB,EAAEnG,eAAe;MACjCoG,YAAY,EAAG,GAAElI,oBAAqB,WAAU;MAChD6H;IACF,CAAC,CAAC;IAEF,OAAO;MAAE/F,eAAe;MAAE6F,kBAAkB;MAAEhJ,EAAE;MAAEqC;IAAa,CAAC;EAClE;EAOA,aAAamH,QAAQ,CAAC,CAACC,GAAG,EAAEtK,SAAS,EAAEuK,UAAU,CAAmC,EAAE;IACpF,MAAMtK,MAAM,GAAGsK,UAAU,CAACC,YAAY,CAACC,0BAAc,CAAC5J,EAAE,CAAC;IACzD,MAAM6J,YAAY,GAAG,IAAI5K,YAAY,CAACE,SAAS,EAAEC,MAAM,CAAC;IACxDqK,GAAG,CAACK,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCAzTY5K,YAAY,WA8SR,EAAE;AAAA,gCA9SNA,YAAY,kBA+SD,CAAC+K,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,CAAC;AAAA,gCA/SrDjL,YAAY,aAiTNkL,kBAAW;AAU9BP,0BAAc,CAACQ,UAAU,CAACnL,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
package/package.json CHANGED
@@ -1,27 +1,29 @@
1
1
  {
2
2
  "name": "@teambit/checkout",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
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.66"
9
+ "version": "0.0.68"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
13
+ "lodash": "4.17.21",
13
14
  "p-map-series": "2.1.0",
14
15
  "@babel/runtime": "7.20.0",
15
16
  "core-js": "^3.0.0",
16
17
  "@teambit/harmony": "0.3.3",
17
18
  "@teambit/bit-error": "0.0.402",
18
- "@teambit/cli": "0.0.599",
19
+ "@teambit/cli": "0.0.601",
19
20
  "@teambit/component-id": "0.0.425",
20
21
  "@teambit/legacy-bit-id": "0.0.421",
21
- "@teambit/logger": "0.0.692",
22
- "@teambit/workspace": "0.0.897"
22
+ "@teambit/logger": "0.0.694",
23
+ "@teambit/workspace": "0.0.899"
23
24
  },
24
25
  "devDependencies": {
26
+ "@types/lodash": "4.14.165",
25
27
  "@types/mocha": "9.1.0",
26
28
  "@types/testing-library__jest-dom": "5.9.5",
27
29
  "@types/jest": "^26.0.0",
@@ -30,7 +32,7 @@
30
32
  "@types/node": "12.20.4"
31
33
  },
32
34
  "peerDependencies": {
33
- "@teambit/legacy": "1.0.382",
35
+ "@teambit/legacy": "1.0.385",
34
36
  "react-dom": "^16.8.0 || ^17.0.0",
35
37
  "react": "^16.8.0 || ^17.0.0"
36
38
  },