@teambit/checkout 0.0.67 → 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.
- package/dist/checkout-cmd.d.ts +2 -1
- package/dist/checkout-cmd.js +43 -19
- package/dist/checkout-cmd.js.map +1 -1
- package/dist/checkout.main.runtime.d.ts +2 -0
- package/dist/checkout.main.runtime.js +35 -3
- package/dist/checkout.main.runtime.js.map +1 -1
- package/package-tar/teambit-checkout-0.0.68.tgz +0 -0
- package/package.json +8 -6
- /package/{preview-1668310914843.js → preview-1668606008821.js} +0 -0
- package/package-tar/teambit-checkout-0.0.67.tgz +0 -0
package/dist/checkout-cmd.d.ts
CHANGED
|
@@ -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;
|
package/dist/checkout-cmd.js
CHANGED
|
@@ -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
|
-
|
|
106
|
-
const
|
|
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
|
|
113
|
-
|
|
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(
|
|
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 =
|
|
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
|
-
|
|
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;
|
package/dist/checkout-cmd.js.map
CHANGED
|
@@ -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,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,OA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AAM,IAAG,IAAAqB,kCAAkB,EAACnC,UAAU,EAAE,KAAK,CAAE,EAAC;MAC5D;MACA,IAAIM,OAAO,EAAE;QACX,MAAMQ,KAAK,GAAG,iDAAiD;QAC/D,MAAMC,IAAI,GAAGf,UAAU,CAACgB,GAAG,CAAEgB,SAAS,IAAKvC,gBAAK,CAACyB,IAAI,CAACc,SAAS,CAACb,EAAE,CAACC,QAAQ,EAAE,CAAC,CAAC,CAACG,IAAI,CAAC,IAAI,CAAC;QAC1F,OAAOT,KAAK,GAAGC,IAAI;MACrB;MAEA,MAAMqB,YAAY,GAAG,MAAM;QACzB,IAAI/B,MAAM,EAAE,OAAO,oBAAoB;QACvC,IAAIE,QAAQ,EAAE,OAAO,sBAAsB;QAC3C;QACA,OAAQ,WAAUd,gBAAK,CAACyB,IAAI,CAACjB,OAAO,CAAE,EAAC;MACzC,CAAC;MACD,MAAMoC,aAAa,GAAGD,YAAY,EAAE;MACpC,MAAMtB,KAAK,GAAI,qDAAoDuB,aAAc,MAAK;MACtF,MAAMC,WAAW,GAAGjC,MAAM,IAAIC,OAAO;MACrC,MAAMiC,aAAa,GAAG,IAAAJ,kCAAkB,EAACnC,UAAU,EAAE,IAAI,EAAEsC,WAAW,CAAC;MACvE,OAAOxB,KAAK,GAAGyB,aAAa;IAC9B,CAAC;IAED,OAAO/B,gBAAgB,EAAE,GAAGgB,gBAAgB,EAAE,GAAGO,mBAAmB,EAAE,GAAGJ,kBAAkB,EAAE;EAC/F;AACF;AAAC"}
|
|
1
|
+
{"version":3,"names":["CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","ours","theirs","manual","reset","all","entireLane","verbose","skipNpmInstall","skipDependencyInstallation","BitError","console","log","chalk","yellow","checkoutProps","promptMergeOptions","mergeStrategy","getMergeStrategy","isLane","components","version","failedComponents","leftUnresolvedConflicts","newFromLane","newFromLaneAdded","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;EAA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D,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"}
|
|
@@ -18,6 +18,7 @@ export declare type CheckoutProps = {
|
|
|
18
18
|
reset?: boolean;
|
|
19
19
|
all?: boolean;
|
|
20
20
|
isLane?: boolean;
|
|
21
|
+
entireLane?: boolean;
|
|
21
22
|
};
|
|
22
23
|
export declare type ComponentStatusBeforeMergeAttempt = {
|
|
23
24
|
componentFromFS?: ConsumerComponent;
|
|
@@ -39,6 +40,7 @@ export declare class CheckoutMain {
|
|
|
39
40
|
checkoutByCLIValues(to: CheckoutTo, componentPattern: string, checkoutProps: CheckoutProps): Promise<ApplyVersionResults>;
|
|
40
41
|
private syncNewComponents;
|
|
41
42
|
private parseValues;
|
|
43
|
+
private getNewComponentsFromLane;
|
|
42
44
|
private getComponentStatusBeforeMergeAttempt;
|
|
43
45
|
private getMergeStatus;
|
|
44
46
|
static slots: never[];
|
|
@@ -51,6 +51,13 @@ function _bitError() {
|
|
|
51
51
|
};
|
|
52
52
|
return data;
|
|
53
53
|
}
|
|
54
|
+
function _lodash() {
|
|
55
|
+
const data = require("lodash");
|
|
56
|
+
_lodash = function () {
|
|
57
|
+
return data;
|
|
58
|
+
};
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
54
61
|
function _loaderMessages() {
|
|
55
62
|
const data = require("@teambit/legacy/dist/cli/loader/loader-messages");
|
|
56
63
|
_loaderMessages = function () {
|
|
@@ -143,7 +150,7 @@ class CheckoutMain {
|
|
|
143
150
|
this.logger = logger;
|
|
144
151
|
}
|
|
145
152
|
async checkout(checkoutProps) {
|
|
146
|
-
var _checkoutProps$ids;
|
|
153
|
+
var _checkoutProps$ids, _newFromLane;
|
|
147
154
|
const consumer = this.workspace.consumer;
|
|
148
155
|
const {
|
|
149
156
|
version,
|
|
@@ -210,7 +217,17 @@ class CheckoutMain {
|
|
|
210
217
|
return (0, _checkoutVersion().applyVersion)(consumer, id, componentFromFS, mergeResults, checkoutPropsLegacy);
|
|
211
218
|
});
|
|
212
219
|
(0, _checkoutVersion().markFilesToBeRemovedIfNeeded)(succeededComponents, componentsResults);
|
|
213
|
-
const componentsWithDependencies = componentsResults.map(c => c.component)
|
|
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
|
+
}
|
|
214
231
|
const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';
|
|
215
232
|
if (componentsWithDependencies.length) {
|
|
216
233
|
const manyComponentsWriter = new (_manyComponentsWriter().default)({
|
|
@@ -229,7 +246,9 @@ class CheckoutMain {
|
|
|
229
246
|
components: appliedVersionComponents,
|
|
230
247
|
version,
|
|
231
248
|
failedComponents,
|
|
232
|
-
leftUnresolvedConflicts
|
|
249
|
+
leftUnresolvedConflicts,
|
|
250
|
+
newFromLane: (_newFromLane = newFromLane) === null || _newFromLane === void 0 ? void 0 : _newFromLane.map(n => n.toString()),
|
|
251
|
+
newFromLaneAdded
|
|
233
252
|
};
|
|
234
253
|
}
|
|
235
254
|
async checkoutByCLIValues(to, componentPattern, checkoutProps) {
|
|
@@ -281,9 +300,22 @@ class CheckoutMain {
|
|
|
281
300
|
if (!componentPattern && !checkoutProps.all) {
|
|
282
301
|
throw new (_generalError().default)('please specify [component-pattern] or use --all flag');
|
|
283
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
|
+
}
|
|
284
306
|
const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();
|
|
285
307
|
checkoutProps.ids = ids.map(id => checkoutProps.head || checkoutProps.latest ? id.changeVersion(_constants().LATEST) : id);
|
|
286
308
|
}
|
|
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
|
+
}
|
|
287
319
|
async getComponentStatusBeforeMergeAttempt(component, checkoutProps) {
|
|
288
320
|
const consumer = this.workspace.consumer;
|
|
289
321
|
const {
|
|
@@ -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","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","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","importManyDeltaWithoutDeps","fromHead","error","HEAD","LATEST","latest","BitId","isValidVersion","BitError","console","idsByPattern","listIds","headVersion","latestVersion","repo","objects","componentModel","getModelComponentIfExist","returnFailure","msg","toString","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 { 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, 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};\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 = 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({\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 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 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;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;E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or","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":";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AAEtK,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"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/checkout",
|
|
3
|
-
"version": "0.0.
|
|
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.
|
|
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.
|
|
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.
|
|
22
|
-
"@teambit/workspace": "0.0.
|
|
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.
|
|
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
|
},
|
|
File without changes
|
|
Binary file
|