@teambit/checkout 0.0.12 → 0.0.13

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.
@@ -3,6 +3,10 @@ import { CheckoutMain } from './checkout.main.runtime';
3
3
  export declare class CheckoutCmd implements Command {
4
4
  private checkout;
5
5
  name: string;
6
+ arguments: {
7
+ name: string;
8
+ description: string;
9
+ }[];
6
10
  description: string;
7
11
  group: string;
8
12
  extendedDescription: string;
@@ -10,7 +14,7 @@ export declare class CheckoutCmd implements Command {
10
14
  options: CommandOptions;
11
15
  loader: boolean;
12
16
  constructor(checkout: CheckoutMain);
13
- report([values]: [string[]], { interactiveMerge, ours, theirs, manual, reset, all, verbose, skipNpmInstall, skipDependencyInstallation, ignorePackageJson, conf, ignoreDist, }: {
17
+ report([to, componentPattern]: [string, string], { interactiveMerge, ours, theirs, manual, reset, all, verbose, skipNpmInstall, skipDependencyInstallation, }: {
14
18
  interactiveMerge?: boolean;
15
19
  ours?: boolean;
16
20
  theirs?: boolean;
@@ -20,8 +24,5 @@ export declare class CheckoutCmd implements Command {
20
24
  verbose?: boolean;
21
25
  skipNpmInstall?: boolean;
22
26
  skipDependencyInstallation?: boolean;
23
- ignorePackageJson?: boolean;
24
- conf?: string;
25
- ignoreDist?: boolean;
26
27
  }): Promise<string>;
27
28
  }
@@ -31,6 +31,16 @@ function _chalk() {
31
31
  return data;
32
32
  }
33
33
 
34
+ function _bitError() {
35
+ const data = require("@teambit/bit-error");
36
+
37
+ _bitError = function () {
38
+ return data;
39
+ };
40
+
41
+ return data;
42
+ }
43
+
34
44
  function _constants() {
35
45
  const data = require("@teambit/legacy/dist/constants");
36
46
 
@@ -54,21 +64,26 @@ function _mergeVersion() {
54
64
  class CheckoutCmd {
55
65
  constructor(checkout) {
56
66
  this.checkout = checkout;
57
- (0, _defineProperty2().default)(this, "name", 'checkout [values...]');
67
+ (0, _defineProperty2().default)(this, "name", 'checkout <to> [component-pattern]');
68
+ (0, _defineProperty2().default)(this, "arguments", [{
69
+ name: 'to',
70
+ description: "permitted values: [head, reset, specific-version]. 'head' - last snap/tag. 'reset' - removes local changes"
71
+ }, {
72
+ name: 'component-pattern',
73
+ description: _constants().COMPONENT_PATTERN_HELP
74
+ }]);
58
75
  (0, _defineProperty2().default)(this, "description", 'switch between component versions or remove local changes');
59
76
  (0, _defineProperty2().default)(this, "group", 'development');
60
77
  (0, _defineProperty2().default)(this, "extendedDescription", `
61
- \`bit checkout <version> [ids...]\` => checkout the specified ids (or all components when --all is used) to the specified version
62
- \`bit checkout head\` => checkout all components to their latest versions
63
- \`bit checkout head [ids...]\` => checkout the specified ids to their latest versions
64
- \`bit checkout [ids...] --reset\` => remove local modifications from the specified ids (or all components when --all is used)
65
- ${(0, _constants().WILDCARD_HELP)('checkout 0.0.1')}`);
78
+ \`bit checkout <version> [component-pattern]\` => checkout the specified ids (or all components when --all is used) to the specified version
79
+ \`bit checkout head [component-pattern]\` => checkout to the last snap/tag, omit [component-pattern] to checkout head for all
80
+ \`bit checkout reset [component-pattern]\` => remove local modifications from the specified ids (or all components when --all is used)`);
66
81
  (0, _defineProperty2().default)(this, "alias", 'U');
67
- (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'], ['', 'skip-npm-install', 'DEPRECATED. use "--skip-dependency-installation" instead'], ['', 'skip-dependency-installation', 'do not install packages of the imported components'], ['', 'ignore-package-json', 'do not generate package.json for the imported component(s). (it automatically enables skip-npm-install and save-dependencies-as-components flags)'], ['', 'conf [path]', 'write the configuration file (bit.json) and the envs configuration files (use --conf without path to write to the default dir)'], ['', 'ignore-dist', 'do not write dist files (when exist)']]);
82
+ (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']]);
68
83
  (0, _defineProperty2().default)(this, "loader", true);
69
84
  }
70
85
 
71
- async report([values = []], {
86
+ async report([to, componentPattern], {
72
87
  interactiveMerge = false,
73
88
  ours = false,
74
89
  theirs = false,
@@ -77,11 +92,12 @@ class CheckoutCmd {
77
92
  all = false,
78
93
  verbose = false,
79
94
  skipNpmInstall = false,
80
- skipDependencyInstallation = false,
81
- ignorePackageJson = false,
82
- conf,
83
- ignoreDist = false
95
+ skipDependencyInstallation = false
84
96
  }) {
97
+ if (reset) {
98
+ throw new (_bitError().BitError)(`--reset flag has been removed. please run "bit checkout reset" instead`);
99
+ }
100
+
85
101
  if (skipNpmInstall) {
86
102
  // eslint-disable-next-line no-console
87
103
  console.log(_chalk().default.yellow(`"--skip-npm-install" has been deprecated, please use "--skip-dependency-installation" instead`));
@@ -91,23 +107,19 @@ class CheckoutCmd {
91
107
  const checkoutProps = {
92
108
  promptMergeOptions: interactiveMerge,
93
109
  mergeStrategy: (0, _mergeVersion().getMergeStrategy)(ours, theirs, manual),
94
- reset,
95
110
  all,
96
111
  verbose,
97
112
  isLane: false,
98
- skipNpmInstall: skipDependencyInstallation,
99
- ignoreDist,
100
- ignorePackageJson,
101
- writeConfig: !!conf
113
+ skipNpmInstall: skipDependencyInstallation
102
114
  };
103
115
  const {
104
116
  components,
105
117
  version,
106
118
  failedComponents,
107
119
  leftUnresolvedConflicts
108
- } = await this.checkout.checkout(values, checkoutProps);
109
- const isLatest = Boolean(version && version === _constants().LATEST);
110
- const isReset = !version;
120
+ } = await this.checkout.checkoutByCLIValues(to, componentPattern || '', checkoutProps);
121
+ const isLatest = to === 'head';
122
+ const isReset = to === 'reset';
111
123
 
112
124
  const getFailureOutput = () => {
113
125
  // components that failed for no legitimate reason. e.g. merge-conflict.
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutCmd","constructor","checkout","WILDCARD_HELP","report","values","interactiveMerge","ours","theirs","manual","reset","all","verbose","skipNpmInstall","skipDependencyInstallation","ignorePackageJson","conf","ignoreDist","console","log","chalk","yellow","checkoutProps","promptMergeOptions","mergeStrategy","getMergeStrategy","isLane","writeConfig","components","version","failedComponents","leftUnresolvedConflicts","isLatest","Boolean","LATEST","isReset","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","versionOutput","showVersion","componentsStr"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { LATEST, WILDCARD_HELP } from '@teambit/legacy/dist/constants';\nimport { CheckoutProps } from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport {\n ApplyVersionResults,\n getMergeStrategy,\n applyVersionReport,\n conflictSummaryReport,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { CheckoutMain } from './checkout.main.runtime';\n\nexport class CheckoutCmd implements Command {\n name = 'checkout [values...]';\n description = 'switch between component versions or remove local changes';\n group = 'development';\n extendedDescription = `\n \\`bit checkout <version> [ids...]\\` => checkout the specified ids (or all components when --all is used) to the specified version\n \\`bit checkout head\\` => checkout all components to their latest versions\n \\`bit checkout head [ids...]\\` => checkout the specified ids to their latest versions\n \\`bit checkout [ids...] --reset\\` => remove local modifications from the specified ids (or all components when --all is used)\n ${WILDCARD_HELP('checkout 0.0.1')}`;\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 ['', 'skip-npm-install', 'DEPRECATED. use \"--skip-dependency-installation\" instead'],\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n [\n '',\n 'ignore-package-json',\n 'do not generate package.json for the imported component(s). (it automatically enables skip-npm-install and save-dependencies-as-components flags)',\n ],\n [\n '',\n 'conf [path]',\n 'write the configuration file (bit.json) and the envs configuration files (use --conf without path to write to the default dir)',\n ],\n ['', 'ignore-dist', 'do not write dist files (when exist)'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [values = []]: [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 ignorePackageJson = false,\n conf,\n ignoreDist = 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 ignorePackageJson?: boolean;\n conf?: string;\n ignoreDist?: boolean;\n }\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 reset,\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n ignoreDist,\n ignorePackageJson,\n writeConfig: !!conf,\n };\n const { components, version, failedComponents, leftUnresolvedConflicts }: ApplyVersionResults =\n await this.checkout.checkout(values, checkoutProps);\n const isLatest = Boolean(version && version === LATEST);\n const isReset = !version;\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 // $FlowFixMe version is defined when !isReset\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n 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 // $FlowFixMe version is defined when !isReset\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const versionOutput = isLatest ? 'their latest version' : `version ${chalk.bold(version)}`;\n const title = `successfully switched the following components to ${versionOutput}\\n\\n`;\n const showVersion = isLatest || 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;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQO,MAAMA,WAAN,CAAqC;EAuC1CC,WAAW,CAASC,QAAT,EAAiC;IAAA,KAAxBA,QAAwB,GAAxBA,QAAwB;IAAA,8CAtCrC,sBAsCqC;IAAA,qDArC9B,2DAqC8B;IAAA,+CApCpC,aAoCoC;IAAA,6DAnCrB;AACzB;AACA;AACA;AACA;AACA,IAAI,IAAAC,0BAAA,EAAc,gBAAd,CAAgC,EA8BU;IAAA,+CA7BpC,GA6BoC;IAAA,iDA5BlC,CACR,CACE,GADF,EAEE,mBAFF,EAGE,qGAHF,CADQ,EAMR,CAAC,GAAD,EAAM,MAAN,EAAc,gFAAd,CANQ,EAOR,CAAC,GAAD,EAAM,QAAN,EAAgB,qFAAhB,CAPQ,EAQR,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AAWe,aAAX,CAA0B,IAAvD;QACb,MAAMnB,KAAK,GAAI,yBAAwBtB,gBAAA,CAAM0B,IAAN,CAAWe,aAAX,CAA0B,eAAczC,gBAAA,CAAM0B,IAAN,EAC7E;QACA;QACAd,QAAQ,GAAG4B,SAAS,CAACb,EAAV,CAAalB,OAAhB,GAA0BA,OAH2C,CAI7E,IAJF;QAKA,OAAQ,GAAEa,KAAM,IAAG,IAAAqB,kCAAA,EAAmBnC,UAAnB,EAA+B,KAA/B,CAAsC,EAAzD;MACD;;MACD,IAAIO,OAAJ,EAAa;QACX,MAAMO,KAAK,GAAG,iDAAd;QACA,MAAMC,IAAI,GAAGf,UAAU,CAACgB,GAAX,CAAgBgB,SAAD,IAAexC,gBAAA,CAAM0B,IAAN,CAAWc,SAAS,CAACb,EAAV,CAAaC,QAAb,EAAX,CAA9B,EAAmEG,IAAnE,CAAwE,IAAxE,CAAb;QACA,OAAOT,KAAK,GAAGC,IAAf;MACD,CAjB+B,CAkBhC;MACA;;;MACA,MAAMqB,aAAa,GAAGhC,QAAQ,GAAG,sBAAH,GAA6B,WAAUZ,gBAAA,CAAM0B,IAAN,CAAWjB,OAAX,CAAoB,EAAzF;MACA,MAAMa,KAAK,GAAI,qDAAoDsB,aAAc,MAAjF;MACA,MAAMC,WAAW,GAAGjC,QAAQ,IAAIG,OAAhC;MACA,MAAM+B,aAAa,GAAG,IAAAH,kCAAA,EAAmBnC,UAAnB,EAA+B,IAA/B,EAAqCqC,WAArC,CAAtB;MACA,OAAOvB,KAAK,GAAGwB,aAAf;IACD,CAzBD;;IA2BA,OAAO9B,gBAAgB,KAAKgB,gBAAgB,EAArC,GAA0CO,mBAAmB,EAA7D,GAAkEJ,kBAAkB,EAA3F;EACD;;AAjKyC"}
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","isLatest","isReset","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","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, reset, specific-version]. 'head' - last snap/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 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 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 isLatest = to === 'head';\n const isReset = to === 'reset';\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 // $FlowFixMe version is defined when !isReset\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n 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 // $FlowFixMe version is defined when !isReset\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const versionOutput = isLatest ? 'their latest version' : `version ${chalk.bold(version)}`;\n const title = `successfully switched the following components to ${versionOutput}\\n\\n`;\n const showVersion = isLatest || isReset;\n const componentsStr = applyVersionReport(components, true, showVersion);\n return title + componentsStr;\n };\n\n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AGC,IAAf;MACD,CAjB+B,CAkBhC;MACA;;;MACA,MAAMqB,aAAa,GAAG9B,QAAQ,GAAG,sBAAH,GAA6B,WAAUZ,gBAAA,CAAMwB,IAAN,CAAWhB,OAAX,CAAoB,EAAzF;MACA,MAAMY,KAAK,GAAI,qDAAoDsB,aAAc,MAAjF;MACA,MAAMC,WAAW,GAAG/B,QAAQ,IAAIC,OAAhC;MACA,MAAM+B,aAAa,GAAG,IAAAH,kCAAA,EAAmBlC,UAAnB,EAA+B,IAA/B,EAAqCoC,WAArC,CAAtB;MACA,OAAOvB,KAAK,GAAGwB,aAAf;IACD,CAzBD;;IA2BA,OAAO9B,gBAAgB,KAAKgB,gBAAgB,EAArC,GAA0CO,mBAAmB,EAA7D,GAAkEJ,kBAAkB,EAA3F;EACD;;AAzJyC"}
@@ -1,20 +1,30 @@
1
1
  import { CLIMain } from '@teambit/cli';
2
2
  import { Logger, LoggerMain } from '@teambit/logger';
3
3
  import { Workspace } from '@teambit/workspace';
4
- import { CheckoutProps } from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';
5
- import { ApplyVersionResults } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
4
+ import { ApplyVersionResults, MergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
5
+ import { ComponentID } from '@teambit/component-id';
6
+ export declare type CheckoutProps = {
7
+ version?: string;
8
+ ids?: ComponentID[];
9
+ head?: boolean;
10
+ promptMergeOptions?: boolean;
11
+ mergeStrategy?: MergeStrategy | null;
12
+ verbose?: boolean;
13
+ skipNpmInstall?: boolean;
14
+ reset?: boolean;
15
+ all?: boolean;
16
+ isLane?: boolean;
17
+ };
18
+ declare type CheckoutTo = 'head' | 'reset' | string;
6
19
  export declare class CheckoutMain {
7
20
  private workspace;
8
21
  private logger;
9
22
  constructor(workspace: Workspace, logger: Logger);
10
- checkout(values: string[], checkoutProps: CheckoutProps): Promise<ApplyVersionResults>;
23
+ checkout(checkoutProps: CheckoutProps): Promise<ApplyVersionResults>;
24
+ checkoutByCLIValues(to: CheckoutTo, componentPattern: string, checkoutProps: CheckoutProps): Promise<ApplyVersionResults>;
25
+ private syncNewComponents;
11
26
  private parseValues;
12
- /**
13
- * when user didn't enter any id and used '--all' flag, populate all ids.
14
- */
15
- private populateAllIds;
16
- private getIdsMatchedByWildcard;
17
- private getCandidateIds;
27
+ private getComponentStatus;
18
28
  static slots: never[];
19
29
  static dependencies: import("@teambit/harmony").Aspect[];
20
30
  static runtime: import("@teambit/harmony").RuntimeDefinition;
@@ -51,20 +51,20 @@ function _workspace() {
51
51
  return data;
52
52
  }
53
53
 
54
- function _ramda() {
55
- const data = _interopRequireDefault(require("ramda"));
54
+ function _legacyBitId() {
55
+ const data = require("@teambit/legacy-bit-id");
56
56
 
57
- _ramda = function () {
57
+ _legacyBitId = function () {
58
58
  return data;
59
59
  };
60
60
 
61
61
  return data;
62
62
  }
63
63
 
64
- function _bitId() {
65
- const data = require("@teambit/legacy/dist/bit-id");
64
+ function _bitError() {
65
+ const data = require("@teambit/bit-error");
66
66
 
67
- _bitId = function () {
67
+ _bitError = function () {
68
68
  return data;
69
69
  };
70
70
 
@@ -91,20 +91,20 @@ function _constants() {
91
91
  return data;
92
92
  }
93
93
 
94
- function _componentsList() {
95
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/components-list"));
94
+ function _checkoutVersion() {
95
+ const data = require("@teambit/legacy/dist/consumer/versions-ops/checkout-version");
96
96
 
97
- _componentsList = function () {
97
+ _checkoutVersion = function () {
98
98
  return data;
99
99
  };
100
100
 
101
101
  return data;
102
102
  }
103
103
 
104
- function _checkoutVersion() {
105
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/versions-ops/checkout-version"));
104
+ function _mergeVersion() {
105
+ const data = require("@teambit/legacy/dist/consumer/versions-ops/merge-version");
106
106
 
107
- _checkoutVersion = function () {
107
+ _mergeVersion = function () {
108
108
  return data;
109
109
  };
110
110
 
@@ -121,30 +121,60 @@ function _generalError() {
121
121
  return data;
122
122
  }
123
123
 
124
- function _hasWildcard() {
125
- const data = _interopRequireDefault(require("@teambit/legacy/dist/utils/string/has-wildcard"));
124
+ function _exceptions() {
125
+ const data = require("@teambit/legacy/dist/consumer/exceptions");
126
126
 
127
- _hasWildcard = function () {
127
+ _exceptions = function () {
128
128
  return data;
129
129
  };
130
130
 
131
131
  return data;
132
132
  }
133
133
 
134
- function _exceptions() {
135
- const data = require("@teambit/legacy/dist/consumer/exceptions");
134
+ function _pMapSeries() {
135
+ const data = _interopRequireDefault(require("p-map-series"));
136
136
 
137
- _exceptions = function () {
137
+ _pMapSeries = function () {
138
138
  return data;
139
139
  };
140
140
 
141
141
  return data;
142
142
  }
143
143
 
144
- function _noIdMatchWildcard() {
145
- const data = _interopRequireDefault(require("@teambit/legacy/dist/api/consumer/lib/exceptions/no-id-match-wildcard"));
144
+ function _bitId() {
145
+ const data = require("@teambit/legacy/dist/bit-id");
146
146
 
147
- _noIdMatchWildcard = function () {
147
+ _bitId = function () {
148
+ return data;
149
+ };
150
+
151
+ return data;
152
+ }
153
+
154
+ function _repositories() {
155
+ const data = require("@teambit/legacy/dist/scope/repositories");
156
+
157
+ _repositories = function () {
158
+ return data;
159
+ };
160
+
161
+ return data;
162
+ }
163
+
164
+ function _manyComponentsWriter() {
165
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/many-components-writer"));
166
+
167
+ _manyComponentsWriter = function () {
168
+ return data;
169
+ };
170
+
171
+ return data;
172
+ }
173
+
174
+ function _scopeComponentsImporter() {
175
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/component-ops/scope-components-importer"));
176
+
177
+ _scopeComponentsImporter = function () {
148
178
  return data;
149
179
  };
150
180
 
@@ -171,37 +201,137 @@ function _checkout() {
171
201
  return data;
172
202
  }
173
203
 
204
+ 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; }
205
+
206
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
207
+
174
208
  class CheckoutMain {
175
209
  constructor(workspace, logger) {
176
210
  this.workspace = workspace;
177
211
  this.logger = logger;
178
212
  }
179
213
 
180
- async checkout(values, checkoutProps) {
214
+ async checkout(checkoutProps) {
215
+ var _checkoutProps$ids;
216
+
217
+ const consumer = this.workspace.consumer;
218
+ const {
219
+ version,
220
+ ids,
221
+ promptMergeOptions
222
+ } = checkoutProps;
223
+ await this.syncNewComponents(checkoutProps);
224
+
225
+ const bitIds = _bitId().BitIds.fromArray((ids === null || ids === void 0 ? void 0 : ids.map(id => id._legacy)) || []);
226
+
227
+ await consumer.scope.import(bitIds, false);
228
+ const {
229
+ components
230
+ } = await consumer.loadComponents(bitIds);
231
+
232
+ const getAllComponentsStatus = async () => {
233
+ const tmp = new (_repositories().Tmp)(consumer.scope);
234
+
235
+ try {
236
+ const componentsStatusP = components.map(component => this.getComponentStatus(component, checkoutProps));
237
+ const componentsStatus = await Promise.all(componentsStatusP);
238
+ await tmp.clear();
239
+ return componentsStatus;
240
+ } catch (err) {
241
+ await tmp.clear();
242
+ throw err;
243
+ }
244
+ };
245
+
246
+ const allComponentsStatus = await getAllComponentsStatus();
247
+ const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
248
+
249
+ if (componentWithConflict) {
250
+ if (!promptMergeOptions && !checkoutProps.mergeStrategy) {
251
+ throw new (_generalError().default)(`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`);
252
+ }
253
+
254
+ if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await (0, _mergeVersion().getMergeStrategyInteractive)();
255
+ }
256
+
257
+ const failedComponents = allComponentsStatus.filter(componentStatus => componentStatus.failureMessage).map(componentStatus => ({
258
+ id: componentStatus.id,
259
+ failureMessage: componentStatus.failureMessage,
260
+ unchangedLegitimately: componentStatus.unchangedLegitimately
261
+ }));
262
+ const succeededComponents = allComponentsStatus.filter(componentStatus => !componentStatus.failureMessage); // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,
263
+ // which can be an issue when some components are also dependencies of others
264
+
265
+ const checkoutPropsLegacy = _objectSpread(_objectSpread({}, checkoutProps), {}, {
266
+ ids: (_checkoutProps$ids = checkoutProps.ids) === null || _checkoutProps$ids === void 0 ? void 0 : _checkoutProps$ids.map(id => id._legacy)
267
+ });
268
+
269
+ const componentsResults = await (0, _pMapSeries().default)(succeededComponents, ({
270
+ id,
271
+ componentFromFS,
272
+ mergeResults
273
+ }) => {
274
+ return (0, _checkoutVersion().applyVersion)(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);
275
+ });
276
+ (0, _checkoutVersion().markFilesToBeRemovedIfNeeded)(succeededComponents, componentsResults);
277
+ const componentsWithDependencies = componentsResults.map(c => c.component).filter(c => c);
278
+ const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';
279
+
280
+ if (componentsWithDependencies.length) {
281
+ const manyComponentsWriter = new (_manyComponentsWriter().default)({
282
+ consumer,
283
+ componentsWithDependencies,
284
+ installNpmPackages: !checkoutProps.skipNpmInstall && !leftUnresolvedConflicts,
285
+ override: true,
286
+ verbose: checkoutProps.verbose,
287
+ resetConfig: checkoutProps.reset
288
+ });
289
+ await manyComponentsWriter.writeAll();
290
+ await (0, _checkoutVersion().deleteFilesIfNeeded)(componentsResults, consumer);
291
+ }
292
+
293
+ const appliedVersionComponents = componentsResults.map(c => c.applyVersionResult);
294
+ return {
295
+ components: appliedVersionComponents,
296
+ version,
297
+ failedComponents,
298
+ leftUnresolvedConflicts
299
+ };
300
+ }
301
+
302
+ async checkoutByCLIValues(to, componentPattern, checkoutProps) {
181
303
  this.logger.setStatusLine(_loaderMessages().BEFORE_CHECKOUT);
182
304
  if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
183
305
  const consumer = this.workspace.consumer;
184
- await this.parseValues(values, checkoutProps);
185
- const checkoutResults = await (0, _checkoutVersion().default)(consumer, checkoutProps);
306
+ await this.parseValues(to, componentPattern, checkoutProps);
307
+ const checkoutResults = await this.checkout(checkoutProps);
186
308
  await consumer.onDestroy();
187
309
  return checkoutResults;
188
310
  }
189
311
 
190
- async parseValues(values, checkoutProps) {
191
- const consumer = this.workspace.consumer;
192
-
193
- const firstValue = _ramda().default.head(values);
194
-
195
- checkoutProps.version = firstValue && (_bitId().BitId.isValidVersion(firstValue) || firstValue === _constants().LATEST || firstValue === _constants().HEAD) ? firstValue : undefined;
196
- const ids = checkoutProps.version ? _ramda().default.tail(values) : values; // if first value is a version, the rest are ids
197
-
198
- checkoutProps.latestVersion = Boolean(checkoutProps.version && (checkoutProps.version === _constants().LATEST || checkoutProps.version === _constants().HEAD));
312
+ async syncNewComponents({
313
+ ids,
314
+ head
315
+ }) {
316
+ if (!head) return;
317
+ const notExported = ids === null || ids === void 0 ? void 0 : ids.filter(id => !id._legacy.hasScope()).map(id => id._legacy.changeScope(id.scope));
318
+ const scopeComponentsImporter = new (_scopeComponentsImporter().default)(this.workspace.consumer.scope);
319
+
320
+ try {
321
+ await scopeComponentsImporter.importManyDeltaWithoutDeps(_bitId().BitIds.fromArray(notExported || []), true);
322
+ } catch (err) {
323
+ // don't stop the process. it's possible that the scope doesn't exist yet because these are new components
324
+ this.logger.error(`unable to sync new components due to an error`, err);
325
+ }
326
+ }
199
327
 
200
- if (checkoutProps.latestVersion && checkoutProps.version === _constants().LATEST) {
201
- this.logger.console(`"latest" is deprecated. please use "${_constants().HEAD}" instead`);
328
+ async parseValues(to, componentPattern, checkoutProps) {
329
+ if (to === _constants().HEAD) checkoutProps.head = true;else if (to === _constants().LATEST) throw new (_bitError().BitError)(`"latest" was deprecated a while ago, please use "head" instead`);else if (to === 'reset') checkoutProps.reset = true;else {
330
+ if (!_legacyBitId().BitId.isValidVersion(to)) throw new (_bitError().BitError)(`the specified version "${to}" is not a valid version`);
331
+ checkoutProps.version = to;
202
332
  }
203
333
 
204
- if (checkoutProps.latestVersion && !ids.length) {
334
+ if (checkoutProps.head && !componentPattern) {
205
335
  if (checkoutProps.all) {
206
336
  this.logger.console(`"--all" is deprecated for "bit checkout ${_constants().HEAD}", please omit it.`);
207
337
  }
@@ -209,57 +339,122 @@ class CheckoutMain {
209
339
  checkoutProps.all = true;
210
340
  }
211
341
 
212
- if (!firstValue && !checkoutProps.reset && !checkoutProps.all) {
213
- throw new (_generalError().default)('please enter [values...] or use --reset --all flags');
342
+ if (componentPattern && checkoutProps.all) {
343
+ throw new (_generalError().default)('please specify either [component-pattern] or --all, not both');
214
344
  }
215
345
 
216
- if (checkoutProps.reset && checkoutProps.version) {
217
- throw new (_generalError().default)(`the first argument "${checkoutProps.version}" seems to be a version. however, --reset flag doesn't support a version`);
346
+ if (!componentPattern && !checkoutProps.all) {
347
+ throw new (_generalError().default)('please specify [component-pattern] or use --all flag');
218
348
  }
219
349
 
220
- if (ids.length && checkoutProps.all) {
221
- throw new (_generalError().default)('please specify either [ids...] or --all, not both');
350
+ const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();
351
+ checkoutProps.ids = ids.map(id => checkoutProps.head ? id.changeVersion(_constants().LATEST) : id);
352
+ }
353
+
354
+ async getComponentStatus(component, checkoutProps) {
355
+ const consumer = this.workspace.consumer;
356
+ const {
357
+ version,
358
+ head: latestVersion,
359
+ reset
360
+ } = checkoutProps;
361
+ const repo = consumer.scope.objects;
362
+ const componentModel = await consumer.scope.getModelComponentIfExist(component.id);
363
+ const componentStatus = {
364
+ id: component.id
365
+ };
366
+
367
+ const returnFailure = (msg, unchangedLegitimately = false) => {
368
+ componentStatus.failureMessage = msg;
369
+ componentStatus.unchangedLegitimately = unchangedLegitimately;
370
+ return componentStatus;
371
+ };
372
+
373
+ if (!componentModel) {
374
+ return returnFailure(`component ${component.id.toString()} is new, no version to checkout`, true);
222
375
  }
223
376
 
224
- if (!checkoutProps.reset && !checkoutProps.version) {
225
- if (ids.length) throw new (_generalError().default)(`the specified version "${ids[0]}" is not a valid version`);else throw new (_generalError().default)('please specify a version');
377
+ const unmerged = repo.unmergedComponents.getEntry(component.name);
378
+
379
+ if (!reset && unmerged) {
380
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`);
226
381
  }
227
382
 
228
- if (!ids.length) {
229
- this.populateAllIds(consumer, checkoutProps);
230
- } else {
231
- const idsHasWildcard = (0, _hasWildcard().default)(ids);
232
- checkoutProps.ids = idsHasWildcard ? this.getIdsMatchedByWildcard(consumer, checkoutProps, ids) : ids.map(id => consumer.getParsedId(id));
383
+ const getNewVersion = async () => {
384
+ // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
385
+ if (reset) return component.id.version; // @ts-ignore if !reset the version is defined
386
+
387
+ return latestVersion ? componentModel.latestIncludeRemote(repo) : version;
388
+ };
389
+
390
+ const newVersion = await getNewVersion();
391
+
392
+ if (version && !latestVersion) {
393
+ const hasVersion = await componentModel.hasVersion(version, repo);
394
+ if (!hasVersion) return returnFailure(`component ${component.id.toStringWithoutVersion()} doesn't have version ${version}`);
233
395
  }
234
- }
235
- /**
236
- * when user didn't enter any id and used '--all' flag, populate all ids.
237
- */
238
396
 
397
+ const existingBitMapId = consumer.bitMap.getBitId(component.id, {
398
+ ignoreVersion: true
399
+ });
400
+ const currentlyUsedVersion = existingBitMapId.version;
239
401
 
240
- populateAllIds(consumer, checkoutProps) {
241
- if (!checkoutProps.all) {
242
- throw new (_generalError().default)('please specify [ids...] or use --all flag');
402
+ if (!currentlyUsedVersion) {
403
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is new`);
243
404
  }
244
405
 
245
- checkoutProps.ids = this.getCandidateIds(consumer, checkoutProps);
246
- }
406
+ if (version && currentlyUsedVersion === version) {
407
+ // it won't be relevant for 'reset' as it doesn't have a version
408
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`);
409
+ }
247
410
 
248
- getIdsMatchedByWildcard(consumer, checkoutProps, ids) {
249
- const candidateIds = this.getCandidateIds(consumer, checkoutProps);
411
+ if (latestVersion && currentlyUsedVersion === newVersion) {
412
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`, true);
413
+ }
250
414
 
251
- const matchedIds = _componentsList().default.filterComponentsByWildcard(candidateIds, ids);
415
+ const currentVersionObject = await componentModel.loadVersion(currentlyUsedVersion, repo);
416
+ const isModified = await consumer.isComponentModified(currentVersionObject, component);
417
+
418
+ if (!isModified && reset) {
419
+ return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`);
420
+ } // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.
421
+ // 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
422
+ // 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
423
+ // 0.0.2+modification. in other words, it won't make any change.
424
+ // this scenario of checking out while there are modified files, is forbidden in Git. here, we want to simulate a similar
425
+ // experience of "git stash", then "git checkout", then "git stash pop". practically, we want the changes done on 0.0.2
426
+ // to be added to 0.0.1
427
+ // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.
428
+
429
+
430
+ const baseVersion = currentlyUsedVersion;
431
+ const baseComponent = await componentModel.loadVersion(baseVersion, repo);
432
+ let mergeResults; // if the component is not modified, no need to try merge the files, they will be written later on according to the
433
+ // checked out version. same thing when no version is specified, it'll be reset to the model-version later.
434
+
435
+ if (!reset && isModified) {
436
+ const otherComponent = await componentModel.loadVersion(newVersion, repo);
437
+ mergeResults = await (0, _mergeVersion().threeWayMerge)({
438
+ consumer,
439
+ otherComponent,
440
+ otherLabel: newVersion,
441
+ currentComponent: component,
442
+ currentLabel: `${currentlyUsedVersion} modified`,
443
+ baseComponent
444
+ });
445
+ }
252
446
 
253
- if (!matchedIds.length) throw new (_noIdMatchWildcard().default)(ids);
254
- return matchedIds;
255
- }
447
+ const versionRef = componentModel.getRef(newVersion); // @ts-ignore
256
448
 
257
- getCandidateIds(consumer, checkoutProps) {
258
- const idsFromBitMap = consumer.bitMap.getAllBitIds();
259
- return idsFromBitMap.map(bitId => {
260
- const version = checkoutProps.latestVersion ? _constants().LATEST : bitId.version;
261
- return bitId.changeVersion(version);
262
- });
449
+ const componentVersion = await consumer.scope.getObject(versionRef.hash);
450
+ const newId = component.id.changeVersion(newVersion); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
451
+
452
+ return {
453
+ componentFromFS: component,
454
+ componentFromModel: componentVersion,
455
+ id: newId,
456
+ mergeResults
457
+ };
263
458
  }
264
459
 
265
460
  static async provider([cli, workspace, loggerMain]) {
@@ -1 +1 @@
1
- {"version":3,"names":["CheckoutMain","constructor","workspace","logger","checkout","values","checkoutProps","setStatusLine","BEFORE_CHECKOUT","ConsumerNotFound","consumer","parseValues","checkoutResults","checkoutVersion","onDestroy","firstValue","R","head","version","BitId","isValidVersion","LATEST","HEAD","undefined","ids","tail","latestVersion","Boolean","console","length","all","reset","GeneralError","populateAllIds","idsHasWildcard","hasWildcard","getIdsMatchedByWildcard","map","id","getParsedId","getCandidateIds","candidateIds","matchedIds","ComponentsList","filterComponentsByWildcard","NoIdMatchWildcard","idsFromBitMap","bitMap","getAllBitIds","bitId","changeVersion","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 R from 'ramda';\nimport { BitId } from '@teambit/legacy/dist/bit-id';\nimport { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages';\nimport { HEAD, LATEST } from '@teambit/legacy/dist/constants';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport checkoutVersion, { CheckoutProps } from '@teambit/legacy/dist/consumer/versions-ops/checkout-version';\nimport { ApplyVersionResults } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\nimport NoIdMatchWildcard from '@teambit/legacy/dist/api/consumer/lib/exceptions/no-id-match-wildcard';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\n\nexport class CheckoutMain {\n constructor(private workspace: Workspace, private logger: Logger) {}\n async checkout(values: string[], checkoutProps: CheckoutProps): 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(values, checkoutProps);\n const checkoutResults = await checkoutVersion(consumer, checkoutProps);\n await consumer.onDestroy();\n return checkoutResults;\n }\n\n private async parseValues(values: string[], checkoutProps: CheckoutProps) {\n const consumer = this.workspace.consumer;\n const firstValue = R.head(values);\n checkoutProps.version =\n firstValue && (BitId.isValidVersion(firstValue) || firstValue === LATEST || firstValue === HEAD)\n ? firstValue\n : undefined;\n const ids = checkoutProps.version ? R.tail(values) : values; // if first value is a version, the rest are ids\n checkoutProps.latestVersion = Boolean(\n checkoutProps.version && (checkoutProps.version === LATEST || checkoutProps.version === HEAD)\n );\n if (checkoutProps.latestVersion && checkoutProps.version === LATEST) {\n this.logger.console(`\"latest\" is deprecated. please use \"${HEAD}\" instead`);\n }\n if (checkoutProps.latestVersion && !ids.length) {\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 (!firstValue && !checkoutProps.reset && !checkoutProps.all) {\n throw new GeneralError('please enter [values...] or use --reset --all flags');\n }\n if (checkoutProps.reset && checkoutProps.version) {\n throw new GeneralError(\n `the first argument \"${checkoutProps.version}\" seems to be a version. however, --reset flag doesn't support a version`\n );\n }\n if (ids.length && checkoutProps.all) {\n throw new GeneralError('please specify either [ids...] or --all, not both');\n }\n if (!checkoutProps.reset && !checkoutProps.version) {\n if (ids.length) throw new GeneralError(`the specified version \"${ids[0]}\" is not a valid version`);\n else throw new GeneralError('please specify a version');\n }\n if (!ids.length) {\n this.populateAllIds(consumer, checkoutProps);\n } else {\n const idsHasWildcard = hasWildcard(ids);\n checkoutProps.ids = idsHasWildcard\n ? this.getIdsMatchedByWildcard(consumer, checkoutProps, ids)\n : ids.map((id) => consumer.getParsedId(id));\n }\n }\n\n /**\n * when user didn't enter any id and used '--all' flag, populate all ids.\n */\n private populateAllIds(consumer: Consumer, checkoutProps: CheckoutProps) {\n if (!checkoutProps.all) {\n throw new GeneralError('please specify [ids...] or use --all flag');\n }\n checkoutProps.ids = this.getCandidateIds(consumer, checkoutProps);\n }\n\n private getIdsMatchedByWildcard(consumer: Consumer, checkoutProps: CheckoutProps, ids: string[]): BitId[] {\n const candidateIds = this.getCandidateIds(consumer, checkoutProps);\n const matchedIds = ComponentsList.filterComponentsByWildcard(candidateIds, ids);\n if (!matchedIds.length) throw new NoIdMatchWildcard(ids);\n return matchedIds;\n }\n\n private getCandidateIds(consumer: Consumer, checkoutProps: CheckoutProps): BitId[] {\n const idsFromBitMap = consumer.bitMap.getAllBitIds();\n return idsFromBitMap.map((bitId) => {\n const version = checkoutProps.latestVersion ? LATEST : bitId.version;\n return bitId.changeVersion(version);\n });\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;;AAEA;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;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,YAAN,CAAmB;EACxBC,WAAW,CAASC,SAAT,EAAuCC,MAAvC,EAAuD;IAAA,KAA9CD,SAA8C,GAA9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C,YAAX,CAAwBC,0BAAA,CAAejB,EAAvC,CAAf;IACA,MAAMkB,YAAY,GAAG,IAAIxD,YAAJ,CAAiBE,SAAjB,EAA4BC,MAA5B,CAArB;IACAiD,GAAG,CAACK,QAAJ,CAAa,KAAIC,0BAAJ,EAAgBF,YAAhB,CAAb;IACA,OAAOA,YAAP;EACD;;AA5FuB;;;gCAAbxD,Y,WAkFI,E;gCAlFJA,Y,kBAmFW,CAAC2D,gBAAD,EAAYC,oBAAZ,EAA6BC,sBAA7B,C;gCAnFX7D,Y,aAqFM8D,kB;;AAUnBP,0BAAA,CAAeQ,UAAf,CAA0B/D,YAA1B;;eAEeA,Y"}
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","ScopeComponentsImporter","importManyDeltaWithoutDeps","error","HEAD","LATEST","BitError","BitId","isValidVersion","console","idsByPattern","listIds","changeVersion","latestVersion","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","toString","unmerged","unmergedComponents","getEntry","name","getNewVersion","latestIncludeRemote","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 ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\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 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 = new ScopeComponentsImporter(this.workspace.consumer.scope);\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) throw new BitError(`\"latest\" was deprecated a while ago, please use \"head\" instead`);\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 (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 ? 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: latestVersion, reset } = 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 // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (reset) return component.id.version;\n // @ts-ignore if !reset the version is defined\n return latestVersion ? componentModel.latestIncludeRemote(repo) : version;\n };\n const newVersion = await getNewVersion();\n if (version && !latestVersion) {\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 (latestVersion && 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;;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SAAnB;MAA8B4G,kBAAkB,EAAEJ,gBAAlD;MAAoElH,EAAE,EAAEqH,KAAxE;MAA+EjG;IAA/E,CAAP;EACD;;EAOoB,aAARmG,QAAQ,CAAC,CAACC,GAAD,EAAMrI,SAAN,EAAiBsI,UAAjB,CAAD,EAAiE;IACpF,MAAMrI,MAAM,GAAGqI,UAAU,CAACC,YAAX,CAAwBC,0BAAA,CAAe3H,EAAvC,CAAf;IACA,MAAM4H,YAAY,GAAG,IAAI3I,YAAJ,CAAiBE,SAAjB,EAA4BC,MAA5B,CAArB;IACAoI,GAAG,CAACK,QAAJ,CAAa,KAAIC,0BAAJ,EAAgBF,YAAhB,CAAb;IACA,OAAOA,YAAP;EACD;;AA/NuB;;;gCAAb3I,Y,WAqNI,E;gCArNJA,Y,kBAsNW,CAAC8I,gBAAD,EAAYC,oBAAZ,EAA6BC,sBAA7B,C;gCAtNXhJ,Y,aAwNMiJ,kB;;AAUnBP,0BAAA,CAAeQ,UAAf,CAA0BlJ,YAA1B;;eAEeA,Y"}
package/package.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
2
  "name": "@teambit/checkout",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
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.12"
9
+ "version": "0.0.13"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
13
- "ramda": "0.27.1",
13
+ "p-map-series": "2.1.0",
14
14
  "@babel/runtime": "7.12.18",
15
15
  "core-js": "^3.0.0",
16
16
  "@teambit/harmony": "0.3.3",
17
- "@teambit/cli": "0.0.562",
18
- "@teambit/logger": "0.0.655",
19
- "@teambit/workspace": "0.0.843"
17
+ "@teambit/bit-error": "0.0.400",
18
+ "@teambit/cli": "0.0.563",
19
+ "@teambit/component-id": "0.0.417",
20
+ "@teambit/legacy-bit-id": "0.0.414",
21
+ "@teambit/logger": "0.0.656",
22
+ "@teambit/workspace": "0.0.844"
20
23
  },
21
24
  "devDependencies": {
22
25
  "@types/mocha": "9.1.0",
@@ -27,7 +30,7 @@
27
30
  "@types/node": "12.20.4"
28
31
  },
29
32
  "peerDependencies": {
30
- "@teambit/legacy": "1.0.343",
33
+ "@teambit/legacy": "1.0.344",
31
34
  "react-dom": "^16.8.0 || ^17.0.0",
32
35
  "react": "^16.8.0 || ^17.0.0"
33
36
  },