@teambit/checkout 0.0.50 → 0.0.51
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.js +4 -37
- package/dist/checkout-cmd.js.map +1 -1
- package/dist/checkout.aspect.js +0 -5
- package/dist/checkout.aspect.js.map +1 -1
- package/dist/checkout.main.runtime.js +12 -118
- package/dist/checkout.main.runtime.js.map +1 -1
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/package-tar/teambit-checkout-0.0.51.tgz +0 -0
- package/package.json +3 -3
- /package/{preview-1666409808293.js → preview-1666496165706.js} +0 -0
- package/package-tar/teambit-checkout-0.0.50.tgz +0 -0
package/dist/checkout-cmd.js
CHANGED
|
@@ -1,66 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.CheckoutCmd = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _chalk() {
|
|
25
18
|
const data = _interopRequireDefault(require("chalk"));
|
|
26
|
-
|
|
27
19
|
_chalk = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _bitError() {
|
|
35
25
|
const data = require("@teambit/bit-error");
|
|
36
|
-
|
|
37
26
|
_bitError = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _constants() {
|
|
45
32
|
const data = require("@teambit/legacy/dist/constants");
|
|
46
|
-
|
|
47
33
|
_constants = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _mergeVersion() {
|
|
55
39
|
const data = require("@teambit/legacy/dist/consumer/versions-ops/merge-version");
|
|
56
|
-
|
|
57
40
|
_mergeVersion = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
class CheckoutCmd {
|
|
65
46
|
constructor(checkout) {
|
|
66
47
|
this.checkout = checkout;
|
|
@@ -82,7 +63,6 @@ class CheckoutCmd {
|
|
|
82
63
|
(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']]);
|
|
83
64
|
(0, _defineProperty2().default)(this, "loader", true);
|
|
84
65
|
}
|
|
85
|
-
|
|
86
66
|
async report([to, componentPattern], {
|
|
87
67
|
interactiveMerge = false,
|
|
88
68
|
ours = false,
|
|
@@ -97,13 +77,11 @@ class CheckoutCmd {
|
|
|
97
77
|
if (reset) {
|
|
98
78
|
throw new (_bitError().BitError)(`--reset flag has been removed. please run "bit checkout reset" instead`);
|
|
99
79
|
}
|
|
100
|
-
|
|
101
80
|
if (skipNpmInstall) {
|
|
102
81
|
// eslint-disable-next-line no-console
|
|
103
82
|
console.log(_chalk().default.yellow(`"--skip-npm-install" has been deprecated, please use "--skip-dependency-installation" instead`));
|
|
104
83
|
skipDependencyInstallation = true;
|
|
105
84
|
}
|
|
106
|
-
|
|
107
85
|
const checkoutProps = {
|
|
108
86
|
promptMergeOptions: interactiveMerge,
|
|
109
87
|
mergeStrategy: (0, _mergeVersion().getMergeStrategy)(ours, theirs, manual),
|
|
@@ -120,7 +98,6 @@ class CheckoutCmd {
|
|
|
120
98
|
} = await this.checkout.checkoutByCLIValues(to, componentPattern || '', checkoutProps);
|
|
121
99
|
const isLatest = to === 'head';
|
|
122
100
|
const isReset = to === 'reset';
|
|
123
|
-
|
|
124
101
|
const getFailureOutput = () => {
|
|
125
102
|
// components that failed for no legitimate reason. e.g. merge-conflict.
|
|
126
103
|
const realFailedComponents = failedComponents === null || failedComponents === void 0 ? void 0 : failedComponents.filter(f => !f.unchangedLegitimately);
|
|
@@ -129,21 +106,17 @@ class CheckoutCmd {
|
|
|
129
106
|
const body = realFailedComponents.map(failedComponent => `${_chalk().default.bold(failedComponent.id.toString())} - ${_chalk().default.red(failedComponent.failureMessage)}`).join('\n');
|
|
130
107
|
return `${title}\n${body}\n\n`;
|
|
131
108
|
};
|
|
132
|
-
|
|
133
109
|
const getNeutralOutput = () => {
|
|
134
110
|
// components that weren't checked out for legitimate reasons, e.g. up-to-date.
|
|
135
111
|
const neutralComponents = (failedComponents || []).filter(f => f.unchangedLegitimately);
|
|
136
112
|
if (!neutralComponents.length) return '';
|
|
137
|
-
|
|
138
113
|
if (!verbose && all) {
|
|
139
114
|
return _chalk().default.green(`checkout was not needed for ${_chalk().default.bold(neutralComponents.length.toString())} components (use --verbose to get more details)\n`);
|
|
140
115
|
}
|
|
141
|
-
|
|
142
116
|
const title = 'the checkout was not needed on the following component(s)';
|
|
143
117
|
const body = neutralComponents.map(failedComponent => `${_chalk().default.bold(failedComponent.id.toString())} - ${failedComponent.failureMessage}`).join('\n');
|
|
144
118
|
return `${title}\n${body}\n\n`;
|
|
145
119
|
};
|
|
146
|
-
|
|
147
120
|
const getConflictSummary = () => {
|
|
148
121
|
if (!components || !components.length || !leftUnresolvedConflicts) return '';
|
|
149
122
|
const title = `\n\nfiles with conflicts summary\n`;
|
|
@@ -151,40 +124,34 @@ class CheckoutCmd {
|
|
|
151
124
|
once ready, snap/tag the components to persist the changes`;
|
|
152
125
|
return _chalk().default.underline(title) + (0, _mergeVersion().conflictSummaryReport)(components) + _chalk().default.yellow(suggestion);
|
|
153
126
|
};
|
|
154
|
-
|
|
155
127
|
const getSuccessfulOutput = () => {
|
|
156
128
|
if (!components || !components.length) return '';
|
|
157
|
-
|
|
158
129
|
if (components.length === 1) {
|
|
159
130
|
const component = components[0];
|
|
160
131
|
const componentName = isReset ? component.id.toString() : component.id.toStringWithoutVersion();
|
|
161
132
|
if (isReset) return `successfully reset ${_chalk().default.bold(componentName)}\n`;
|
|
162
|
-
const title = `successfully switched ${_chalk().default.bold(componentName)} to version ${_chalk().default.bold(
|
|
133
|
+
const title = `successfully switched ${_chalk().default.bold(componentName)} to version ${_chalk().default.bold(
|
|
134
|
+
// $FlowFixMe version is defined when !isReset
|
|
163
135
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
164
136
|
isLatest ? component.id.version : version)}\n`;
|
|
165
137
|
return `${title} ${(0, _mergeVersion().applyVersionReport)(components, false)}`;
|
|
166
138
|
}
|
|
167
|
-
|
|
168
139
|
if (isReset) {
|
|
169
140
|
const title = 'successfully reset the following components\n\n';
|
|
170
141
|
const body = components.map(component => _chalk().default.bold(component.id.toString())).join('\n');
|
|
171
142
|
return title + body;
|
|
172
|
-
}
|
|
143
|
+
}
|
|
144
|
+
// $FlowFixMe version is defined when !isReset
|
|
173
145
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
174
|
-
|
|
175
|
-
|
|
176
146
|
const versionOutput = isLatest ? 'their latest version' : `version ${_chalk().default.bold(version)}`;
|
|
177
147
|
const title = `successfully switched the following components to ${versionOutput}\n\n`;
|
|
178
148
|
const showVersion = isLatest || isReset;
|
|
179
149
|
const componentsStr = (0, _mergeVersion().applyVersionReport)(components, true, showVersion);
|
|
180
150
|
return title + componentsStr;
|
|
181
151
|
};
|
|
182
|
-
|
|
183
152
|
return getFailureOutput() + getNeutralOutput() + getSuccessfulOutput() + getConflictSummary();
|
|
184
153
|
}
|
|
185
|
-
|
|
186
154
|
}
|
|
187
|
-
|
|
188
155
|
exports.CheckoutCmd = CheckoutCmd;
|
|
189
156
|
|
|
190
157
|
//# sourceMappingURL=checkout-cmd.js.map
|
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","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 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,WAAN,CAAqC;EAsC1CC,WAAW,CAASC,QAAT,EAAiC;IAAA,KAAxBA,QAAwB,GAAxBA,QAAwB;IAAA,8CArCrC,mCAqCqC;IAAA,mDApChC,CACV;MACEC,IAAI,EAAE,IADR;MAEEC,WAAW,EACT;IAHJ,CADU,EAMV;MACED,IAAI,EAAE,mBADR;MAEEC,WAA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
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 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;EAsC1CC,WAAW,CAASC,QAAsB,EAAE;IAAA,KAAxBA,QAAsB,GAAtBA,QAAsB;IAAA,8CArCnC,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,+CACjE,aAAa;IAAA,6DACE;AACzB;AACA;AACA,yIAAyI;IAAA,+CAC/H,GAAG;IAAA,iDACD,CACR,CACE,GAAG,EACH,mBAAmB,EACnB,qGAAqG,CACtG,EACD,CAAC,GAAG,EAAE,MAAM,EAAE,gFAAgF,CAAC,EAC/F,CAAC,GAAG,EAAE,QAAQ,EAAE,qFAAqF,CAAC,EACtG,CAAC,GAAG,EAAE,QAAQ,EAAE,6FAA6F,CAAC,EAC9G,CAAC,GAAG,EAAE,OAAO,EAAE,6CAA6C,CAAC,EAC7D,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAC9B,CAAC,GAAG,EAAE,SAAS,EAAE,uCAAuC,CAAC,EACzD,CAAC,EAAE,EAAE,OAAO,EAAE,8CAA8C,CAAC,EAC7D,CAAC,EAAE,EAAE,kBAAkB,EAAE,0DAA0D,CAAC,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AC,IAAI,CAAC;QAC1F,OAAOT,KAAK,GAAGC,IAAI;MACrB;MACA;MACA;MACA,MAAMqB,aAAa,GAAG9B,QAAQ,GAAG,sBAAsB,GAAI,WAAUZ,gBAAK,CAACwB,IAAI,CAAChB,OAAO,CAAE,EAAC;MAC1F,MAAMY,KAAK,GAAI,qDAAoDsB,aAAc,MAAK;MACtF,MAAMC,WAAW,GAAG/B,QAAQ,IAAIC,OAAO;MACvC,MAAM+B,aAAa,GAAG,IAAAH,kCAAkB,EAAClC,UAAU,EAAE,IAAI,EAAEoC,WAAW,CAAC;MACvE,OAAOvB,KAAK,GAAGwB,aAAa;IAC9B,CAAC;IAED,OAAO9B,gBAAgB,EAAE,GAAGgB,gBAAgB,EAAE,GAAGO,mBAAmB,EAAE,GAAGJ,kBAAkB,EAAE;EAC/F;AACF;AAAC"}
|
package/dist/checkout.aspect.js
CHANGED
|
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CheckoutAspect = void 0;
|
|
7
|
-
|
|
8
7
|
function _harmony() {
|
|
9
8
|
const data = require("@teambit/harmony");
|
|
10
|
-
|
|
11
9
|
_harmony = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
const CheckoutAspect = _harmony().Aspect.create({
|
|
19
15
|
id: 'teambit.component/checkout'
|
|
20
16
|
});
|
|
21
|
-
|
|
22
17
|
exports.CheckoutAspect = CheckoutAspect;
|
|
23
18
|
|
|
24
19
|
//# sourceMappingURL=checkout.aspect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CheckoutAspect","Aspect","create","id"],"sources":["checkout.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const CheckoutAspect = Aspect.create({\n id: 'teambit.component/checkout',\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CheckoutAspect","Aspect","create","id"],"sources":["checkout.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const CheckoutAspect = Aspect.create({\n id: 'teambit.component/checkout',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,cAAc,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC1CC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
|
|
@@ -1,219 +1,154 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.default = exports.CheckoutMain = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _cli() {
|
|
25
18
|
const data = require("@teambit/cli");
|
|
26
|
-
|
|
27
19
|
_cli = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _logger() {
|
|
35
25
|
const data = require("@teambit/logger");
|
|
36
|
-
|
|
37
26
|
_logger = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _workspace() {
|
|
45
32
|
const data = _interopRequireDefault(require("@teambit/workspace"));
|
|
46
|
-
|
|
47
33
|
_workspace = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _legacyBitId() {
|
|
55
39
|
const data = require("@teambit/legacy-bit-id");
|
|
56
|
-
|
|
57
40
|
_legacyBitId = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _bitError() {
|
|
65
46
|
const data = require("@teambit/bit-error");
|
|
66
|
-
|
|
67
47
|
_bitError = function () {
|
|
68
48
|
return data;
|
|
69
49
|
};
|
|
70
|
-
|
|
71
50
|
return data;
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
function _loaderMessages() {
|
|
75
53
|
const data = require("@teambit/legacy/dist/cli/loader/loader-messages");
|
|
76
|
-
|
|
77
54
|
_loaderMessages = function () {
|
|
78
55
|
return data;
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
return data;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
function _constants() {
|
|
85
60
|
const data = require("@teambit/legacy/dist/constants");
|
|
86
|
-
|
|
87
61
|
_constants = function () {
|
|
88
62
|
return data;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
64
|
return data;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
function _checkoutVersion() {
|
|
95
67
|
const data = require("@teambit/legacy/dist/consumer/versions-ops/checkout-version");
|
|
96
|
-
|
|
97
68
|
_checkoutVersion = function () {
|
|
98
69
|
return data;
|
|
99
70
|
};
|
|
100
|
-
|
|
101
71
|
return data;
|
|
102
72
|
}
|
|
103
|
-
|
|
104
73
|
function _mergeVersion() {
|
|
105
74
|
const data = require("@teambit/legacy/dist/consumer/versions-ops/merge-version");
|
|
106
|
-
|
|
107
75
|
_mergeVersion = function () {
|
|
108
76
|
return data;
|
|
109
77
|
};
|
|
110
|
-
|
|
111
78
|
return data;
|
|
112
79
|
}
|
|
113
|
-
|
|
114
80
|
function _generalError() {
|
|
115
81
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/error/general-error"));
|
|
116
|
-
|
|
117
82
|
_generalError = function () {
|
|
118
83
|
return data;
|
|
119
84
|
};
|
|
120
|
-
|
|
121
85
|
return data;
|
|
122
86
|
}
|
|
123
|
-
|
|
124
87
|
function _exceptions() {
|
|
125
88
|
const data = require("@teambit/legacy/dist/consumer/exceptions");
|
|
126
|
-
|
|
127
89
|
_exceptions = function () {
|
|
128
90
|
return data;
|
|
129
91
|
};
|
|
130
|
-
|
|
131
92
|
return data;
|
|
132
93
|
}
|
|
133
|
-
|
|
134
94
|
function _pMapSeries() {
|
|
135
95
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
136
|
-
|
|
137
96
|
_pMapSeries = function () {
|
|
138
97
|
return data;
|
|
139
98
|
};
|
|
140
|
-
|
|
141
99
|
return data;
|
|
142
100
|
}
|
|
143
|
-
|
|
144
101
|
function _bitId() {
|
|
145
102
|
const data = require("@teambit/legacy/dist/bit-id");
|
|
146
|
-
|
|
147
103
|
_bitId = function () {
|
|
148
104
|
return data;
|
|
149
105
|
};
|
|
150
|
-
|
|
151
106
|
return data;
|
|
152
107
|
}
|
|
153
|
-
|
|
154
108
|
function _repositories() {
|
|
155
109
|
const data = require("@teambit/legacy/dist/scope/repositories");
|
|
156
|
-
|
|
157
110
|
_repositories = function () {
|
|
158
111
|
return data;
|
|
159
112
|
};
|
|
160
|
-
|
|
161
113
|
return data;
|
|
162
114
|
}
|
|
163
|
-
|
|
164
115
|
function _manyComponentsWriter() {
|
|
165
116
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/many-components-writer"));
|
|
166
|
-
|
|
167
117
|
_manyComponentsWriter = function () {
|
|
168
118
|
return data;
|
|
169
119
|
};
|
|
170
|
-
|
|
171
120
|
return data;
|
|
172
121
|
}
|
|
173
|
-
|
|
174
122
|
function _scopeComponentsImporter() {
|
|
175
123
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/component-ops/scope-components-importer"));
|
|
176
|
-
|
|
177
124
|
_scopeComponentsImporter = function () {
|
|
178
125
|
return data;
|
|
179
126
|
};
|
|
180
|
-
|
|
181
127
|
return data;
|
|
182
128
|
}
|
|
183
|
-
|
|
184
129
|
function _checkoutCmd() {
|
|
185
130
|
const data = require("./checkout-cmd");
|
|
186
|
-
|
|
187
131
|
_checkoutCmd = function () {
|
|
188
132
|
return data;
|
|
189
133
|
};
|
|
190
|
-
|
|
191
134
|
return data;
|
|
192
135
|
}
|
|
193
|
-
|
|
194
136
|
function _checkout() {
|
|
195
137
|
const data = require("./checkout.aspect");
|
|
196
|
-
|
|
197
138
|
_checkout = function () {
|
|
198
139
|
return data;
|
|
199
140
|
};
|
|
200
|
-
|
|
201
141
|
return data;
|
|
202
142
|
}
|
|
203
|
-
|
|
204
143
|
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
144
|
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
|
-
|
|
208
145
|
class CheckoutMain {
|
|
209
146
|
constructor(workspace, logger) {
|
|
210
147
|
this.workspace = workspace;
|
|
211
148
|
this.logger = logger;
|
|
212
149
|
}
|
|
213
|
-
|
|
214
150
|
async checkout(checkoutProps) {
|
|
215
151
|
var _checkoutProps$ids;
|
|
216
|
-
|
|
217
152
|
const consumer = this.workspace.consumer;
|
|
218
153
|
const {
|
|
219
154
|
version,
|
|
@@ -221,17 +156,13 @@ class CheckoutMain {
|
|
|
221
156
|
promptMergeOptions
|
|
222
157
|
} = checkoutProps;
|
|
223
158
|
await this.syncNewComponents(checkoutProps);
|
|
224
|
-
|
|
225
159
|
const bitIds = _bitId().BitIds.fromArray((ids === null || ids === void 0 ? void 0 : ids.map(id => id._legacy)) || []);
|
|
226
|
-
|
|
227
160
|
await consumer.scope.import(bitIds, false);
|
|
228
161
|
const {
|
|
229
162
|
components
|
|
230
163
|
} = await consumer.loadComponents(bitIds);
|
|
231
|
-
|
|
232
164
|
const getAllComponentsStatus = async () => {
|
|
233
165
|
const tmp = new (_repositories().Tmp)(consumer.scope);
|
|
234
|
-
|
|
235
166
|
try {
|
|
236
167
|
const componentsStatusP = components.map(component => this.getComponentStatus(component, checkoutProps));
|
|
237
168
|
const componentsStatus = await Promise.all(componentsStatusP);
|
|
@@ -242,30 +173,25 @@ class CheckoutMain {
|
|
|
242
173
|
throw err;
|
|
243
174
|
}
|
|
244
175
|
};
|
|
245
|
-
|
|
246
176
|
const allComponentsStatus = await getAllComponentsStatus();
|
|
247
177
|
const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
|
|
248
|
-
|
|
249
178
|
if (componentWithConflict) {
|
|
250
179
|
if (!promptMergeOptions && !checkoutProps.mergeStrategy) {
|
|
251
180
|
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
181
|
}
|
|
253
|
-
|
|
254
182
|
if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await (0, _mergeVersion().getMergeStrategyInteractive)();
|
|
255
183
|
}
|
|
256
|
-
|
|
257
184
|
const failedComponents = allComponentsStatus.filter(componentStatus => componentStatus.failureMessage).map(componentStatus => ({
|
|
258
185
|
id: componentStatus.id,
|
|
259
186
|
failureMessage: componentStatus.failureMessage,
|
|
260
187
|
unchangedLegitimately: componentStatus.unchangedLegitimately
|
|
261
188
|
}));
|
|
262
|
-
const succeededComponents = allComponentsStatus.filter(componentStatus => !componentStatus.failureMessage);
|
|
189
|
+
const succeededComponents = allComponentsStatus.filter(componentStatus => !componentStatus.failureMessage);
|
|
190
|
+
// do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,
|
|
263
191
|
// which can be an issue when some components are also dependencies of others
|
|
264
|
-
|
|
265
192
|
const checkoutPropsLegacy = _objectSpread(_objectSpread({}, checkoutProps), {}, {
|
|
266
193
|
ids: (_checkoutProps$ids = checkoutProps.ids) === null || _checkoutProps$ids === void 0 ? void 0 : _checkoutProps$ids.map(id => id._legacy)
|
|
267
194
|
});
|
|
268
|
-
|
|
269
195
|
const componentsResults = await (0, _pMapSeries().default)(succeededComponents, ({
|
|
270
196
|
id,
|
|
271
197
|
componentFromFS,
|
|
@@ -276,7 +202,6 @@ class CheckoutMain {
|
|
|
276
202
|
(0, _checkoutVersion().markFilesToBeRemovedIfNeeded)(succeededComponents, componentsResults);
|
|
277
203
|
const componentsWithDependencies = componentsResults.map(c => c.component).filter(c => c);
|
|
278
204
|
const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';
|
|
279
|
-
|
|
280
205
|
if (componentsWithDependencies.length) {
|
|
281
206
|
const manyComponentsWriter = new (_manyComponentsWriter().default)({
|
|
282
207
|
consumer,
|
|
@@ -289,7 +214,6 @@ class CheckoutMain {
|
|
|
289
214
|
await manyComponentsWriter.writeAll();
|
|
290
215
|
await (0, _checkoutVersion().deleteFilesIfNeeded)(componentsResults, consumer);
|
|
291
216
|
}
|
|
292
|
-
|
|
293
217
|
const appliedVersionComponents = componentsResults.map(c => c.applyVersionResult);
|
|
294
218
|
return {
|
|
295
219
|
components: appliedVersionComponents,
|
|
@@ -298,7 +222,6 @@ class CheckoutMain {
|
|
|
298
222
|
leftUnresolvedConflicts
|
|
299
223
|
};
|
|
300
224
|
}
|
|
301
|
-
|
|
302
225
|
async checkoutByCLIValues(to, componentPattern, checkoutProps) {
|
|
303
226
|
this.logger.setStatusLine(_loaderMessages().BEFORE_CHECKOUT);
|
|
304
227
|
if (!this.workspace) throw new (_exceptions().ConsumerNotFound)();
|
|
@@ -308,7 +231,6 @@ class CheckoutMain {
|
|
|
308
231
|
await consumer.onDestroy();
|
|
309
232
|
return checkoutResults;
|
|
310
233
|
}
|
|
311
|
-
|
|
312
234
|
async syncNewComponents({
|
|
313
235
|
ids,
|
|
314
236
|
head
|
|
@@ -316,7 +238,6 @@ class CheckoutMain {
|
|
|
316
238
|
if (!head) return;
|
|
317
239
|
const notExported = ids === null || ids === void 0 ? void 0 : ids.filter(id => !id._legacy.hasScope()).map(id => id._legacy.changeScope(id.scope));
|
|
318
240
|
const scopeComponentsImporter = new (_scopeComponentsImporter().default)(this.workspace.consumer.scope);
|
|
319
|
-
|
|
320
241
|
try {
|
|
321
242
|
await scopeComponentsImporter.importManyDeltaWithoutDeps(_bitId().BitIds.fromArray(notExported || []), true);
|
|
322
243
|
} catch (err) {
|
|
@@ -324,33 +245,26 @@ class CheckoutMain {
|
|
|
324
245
|
this.logger.error(`unable to sync new components due to an error`, err);
|
|
325
246
|
}
|
|
326
247
|
}
|
|
327
|
-
|
|
328
248
|
async parseValues(to, componentPattern, checkoutProps) {
|
|
329
249
|
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
250
|
if (!_legacyBitId().BitId.isValidVersion(to)) throw new (_bitError().BitError)(`the specified version "${to}" is not a valid version`);
|
|
331
251
|
checkoutProps.version = to;
|
|
332
252
|
}
|
|
333
|
-
|
|
334
253
|
if (checkoutProps.head && !componentPattern) {
|
|
335
254
|
if (checkoutProps.all) {
|
|
336
255
|
this.logger.console(`"--all" is deprecated for "bit checkout ${_constants().HEAD}", please omit it.`);
|
|
337
256
|
}
|
|
338
|
-
|
|
339
257
|
checkoutProps.all = true;
|
|
340
258
|
}
|
|
341
|
-
|
|
342
259
|
if (componentPattern && checkoutProps.all) {
|
|
343
260
|
throw new (_generalError().default)('please specify either [component-pattern] or --all, not both');
|
|
344
261
|
}
|
|
345
|
-
|
|
346
262
|
if (!componentPattern && !checkoutProps.all) {
|
|
347
263
|
throw new (_generalError().default)('please specify [component-pattern] or use --all flag');
|
|
348
264
|
}
|
|
349
|
-
|
|
350
265
|
const ids = componentPattern ? await this.workspace.idsByPattern(componentPattern) : await this.workspace.listIds();
|
|
351
266
|
checkoutProps.ids = ids.map(id => checkoutProps.head ? id.changeVersion(_constants().LATEST) : id);
|
|
352
267
|
}
|
|
353
|
-
|
|
354
268
|
async getComponentStatus(component, checkoutProps) {
|
|
355
269
|
const consumer = this.workspace.consumer;
|
|
356
270
|
const {
|
|
@@ -363,61 +277,49 @@ class CheckoutMain {
|
|
|
363
277
|
const componentStatus = {
|
|
364
278
|
id: component.id
|
|
365
279
|
};
|
|
366
|
-
|
|
367
280
|
const returnFailure = (msg, unchangedLegitimately = false) => {
|
|
368
281
|
componentStatus.failureMessage = msg;
|
|
369
282
|
componentStatus.unchangedLegitimately = unchangedLegitimately;
|
|
370
283
|
return componentStatus;
|
|
371
284
|
};
|
|
372
|
-
|
|
373
285
|
if (!componentModel) {
|
|
374
286
|
return returnFailure(`component ${component.id.toString()} is new, no version to checkout`, true);
|
|
375
287
|
}
|
|
376
|
-
|
|
377
288
|
const unmerged = repo.unmergedComponents.getEntry(component.name);
|
|
378
|
-
|
|
379
289
|
if (!reset && unmerged) {
|
|
380
290
|
return returnFailure(`component ${component.id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`);
|
|
381
291
|
}
|
|
382
|
-
|
|
383
292
|
const getNewVersion = async () => {
|
|
384
293
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
385
|
-
if (reset) return component.id.version;
|
|
386
|
-
|
|
294
|
+
if (reset) return component.id.version;
|
|
295
|
+
// @ts-ignore if !reset the version is defined
|
|
387
296
|
return latestVersion ? componentModel.latestIncludeRemote(repo) : version;
|
|
388
297
|
};
|
|
389
|
-
|
|
390
298
|
const newVersion = await getNewVersion();
|
|
391
|
-
|
|
392
299
|
if (version && !latestVersion) {
|
|
393
300
|
const hasVersion = await componentModel.hasVersion(version, repo);
|
|
394
301
|
if (!hasVersion) return returnFailure(`component ${component.id.toStringWithoutVersion()} doesn't have version ${version}`);
|
|
395
302
|
}
|
|
396
|
-
|
|
397
303
|
const existingBitMapId = consumer.bitMap.getBitId(component.id, {
|
|
398
304
|
ignoreVersion: true
|
|
399
305
|
});
|
|
400
306
|
const currentlyUsedVersion = existingBitMapId.version;
|
|
401
|
-
|
|
402
307
|
if (!currentlyUsedVersion) {
|
|
403
308
|
return returnFailure(`component ${component.id.toStringWithoutVersion()} is new`);
|
|
404
309
|
}
|
|
405
|
-
|
|
406
310
|
if (version && currentlyUsedVersion === version) {
|
|
407
311
|
// it won't be relevant for 'reset' as it doesn't have a version
|
|
408
312
|
return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at version ${version}`);
|
|
409
313
|
}
|
|
410
|
-
|
|
411
314
|
if (latestVersion && currentlyUsedVersion === newVersion) {
|
|
412
315
|
return returnFailure(`component ${component.id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`, true);
|
|
413
316
|
}
|
|
414
|
-
|
|
415
317
|
const currentVersionObject = await componentModel.loadVersion(currentlyUsedVersion, repo);
|
|
416
318
|
const isModified = await consumer.isComponentModified(currentVersionObject, component);
|
|
417
|
-
|
|
418
319
|
if (!isModified && reset) {
|
|
419
320
|
return returnFailure(`component ${component.id.toStringWithoutVersion()} is not modified`);
|
|
420
|
-
}
|
|
321
|
+
}
|
|
322
|
+
// this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.
|
|
421
323
|
// 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
324
|
// 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
325
|
// 0.0.2+modification. in other words, it won't make any change.
|
|
@@ -425,13 +327,11 @@ class CheckoutMain {
|
|
|
425
327
|
// experience of "git stash", then "git checkout", then "git stash pop". practically, we want the changes done on 0.0.2
|
|
426
328
|
// to be added to 0.0.1
|
|
427
329
|
// if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.
|
|
428
|
-
|
|
429
|
-
|
|
430
330
|
const baseVersion = currentlyUsedVersion;
|
|
431
331
|
const baseComponent = await componentModel.loadVersion(baseVersion, repo);
|
|
432
|
-
let mergeResults;
|
|
332
|
+
let mergeResults;
|
|
333
|
+
// if the component is not modified, no need to try merge the files, they will be written later on according to the
|
|
433
334
|
// checked out version. same thing when no version is specified, it'll be reset to the model-version later.
|
|
434
|
-
|
|
435
335
|
if (!reset && isModified) {
|
|
436
336
|
const otherComponent = await componentModel.loadVersion(newVersion, repo);
|
|
437
337
|
mergeResults = await (0, _mergeVersion().threeWayMerge)({
|
|
@@ -443,12 +343,11 @@ class CheckoutMain {
|
|
|
443
343
|
baseComponent
|
|
444
344
|
});
|
|
445
345
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
346
|
+
const versionRef = componentModel.getRef(newVersion);
|
|
347
|
+
// @ts-ignore
|
|
449
348
|
const componentVersion = await consumer.scope.getObject(versionRef.hash);
|
|
450
|
-
const newId = component.id.changeVersion(newVersion);
|
|
451
|
-
|
|
349
|
+
const newId = component.id.changeVersion(newVersion);
|
|
350
|
+
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
452
351
|
return {
|
|
453
352
|
componentFromFS: component,
|
|
454
353
|
componentFromModel: componentVersion,
|
|
@@ -456,23 +355,18 @@ class CheckoutMain {
|
|
|
456
355
|
mergeResults
|
|
457
356
|
};
|
|
458
357
|
}
|
|
459
|
-
|
|
460
358
|
static async provider([cli, workspace, loggerMain]) {
|
|
461
359
|
const logger = loggerMain.createLogger(_checkout().CheckoutAspect.id);
|
|
462
360
|
const checkoutMain = new CheckoutMain(workspace, logger);
|
|
463
361
|
cli.register(new (_checkoutCmd().CheckoutCmd)(checkoutMain));
|
|
464
362
|
return checkoutMain;
|
|
465
363
|
}
|
|
466
|
-
|
|
467
364
|
}
|
|
468
|
-
|
|
469
365
|
exports.CheckoutMain = CheckoutMain;
|
|
470
366
|
(0, _defineProperty2().default)(CheckoutMain, "slots", []);
|
|
471
367
|
(0, _defineProperty2().default)(CheckoutMain, "dependencies", [_cli().CLIAspect, _workspace().default, _logger().LoggerAspect]);
|
|
472
368
|
(0, _defineProperty2().default)(CheckoutMain, "runtime", _cli().MainRuntime);
|
|
473
|
-
|
|
474
369
|
_checkout().CheckoutAspect.addRuntime(CheckoutMain);
|
|
475
|
-
|
|
476
370
|
var _default = CheckoutMain;
|
|
477
371
|
exports.default = _default;
|
|
478
372
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CheckoutMain","constructor","workspace","logger","checkout","checkoutProps","consumer","version","ids","promptMergeOptions","syncNewComponents","bitIds","BitIds","fromArray","map","id","_legacy","scope","import","components","loadComponents","getAllComponentsStatus","tmp","Tmp","componentsStatusP","component","getComponentStatus","componentsStatus","Promise","all","clear","err","allComponentsStatus","componentWithConflict","find","mergeResults","hasConflicts","mergeStrategy","GeneralError","toStringWithoutVersion","getMergeStrategyInteractive","failedComponents","filter","componentStatus","failureMessage","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","mapSeries","componentFromFS","applyVersion","markFilesToBeRemovedIfNeeded","componentsWithDependencies","c","leftUnresolvedConflicts","length","manyComponentsWriter","ManyComponentsWriter","installNpmPackages","skipNpmInstall","override","verbose","resetConfig","reset","writeAll","deleteFilesIfNeeded","appliedVersionComponents","applyVersionResult","checkoutByCLIValues","to","componentPattern","setStatusLine","BEFORE_CHECKOUT","ConsumerNotFound","parseValues","checkoutResults","onDestroy","head","notExported","hasScope","changeScope","scopeComponentsImporter","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;;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,CAAC8B,MAAf,CAAsBnB,UAAtB,CAAnB,CA5E0B,CA6E1B;;IACA,MAAMoB,gBAAgB,GAAG,MAAM3H,QAAQ,CAACW,KAAT,CAAeiH,SAAf,CAAyBH,UAAU,CAACI,IAApC,CAA/B;IACA,MAAMC,KAAK,GAAG3G,SAAS,CAACV,EAAV,CAAa+E,aAAb,CAA2Be,UAA3B,CAAd,CA/E0B,CAgF1B;;IACA,OAAO;MAAE3D,eAAe,EAAEzB,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"}
|
|
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;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAmD;AAAA;AAiB5C,MAAMA,YAAY,CAAC;EACxBC,WAAW,CAASC,SAAoB,EAAUC,MAAc,EAAE;IAAA,KAA9CD,SAAoB,GAApBA,SAAoB;IAAA,KAAUC,MAAc,GAAdA,MAAc;EAAG;EAEnE,MAAMC,QAAQ,CAACC,aAA4B,EAAgC;IAAA;IACzE,MAAMC,QAAQ,GAAG,IAAI,CAACJ,SAAS,CAACI,QAAQ;IACxC,MAAM;MAAEC,OAAO;MAAEC,GAAG;MAAEC;IAAmB,CAAC,GAAGJ,aAAa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D;IACA,MAAMoB,gBAAgB,GAAG,MAAM3H,QAAQ,CAACW,KAAK,CAACiH,SAAS,CAACH,UAAU,CAACI,IAAI,CAAC;IACxE,MAAMC,KAAK,GAAG3G,SAAS,CAACV,EAAE,CAAC+E,aAAa,CAACe,UAAU,CAAC;IACpD;IACA,OAAO;MAAE3D,eAAe,EAAEzB,SAAS;MAAE4G,kBAAkB,EAAEJ,gBAAgB;MAAElH,EAAE,EAAEqH,KAAK;MAAEjG;IAAa,CAAC;EACtG;EAOA,aAAamG,QAAQ,CAAC,CAACC,GAAG,EAAErI,SAAS,EAAEsI,UAAU,CAAmC,EAAE;IACpF,MAAMrI,MAAM,GAAGqI,UAAU,CAACC,YAAY,CAACC,0BAAc,CAAC3H,EAAE,CAAC;IACzD,MAAM4H,YAAY,GAAG,IAAI3I,YAAY,CAACE,SAAS,EAAEC,MAAM,CAAC;IACxDoI,GAAG,CAACK,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,CAAC;IAC3C,OAAOA,YAAY;EACrB;AACF;AAAC;AAAA,gCAhOY3I,YAAY,WAqNR,EAAE;AAAA,gCArNNA,YAAY,kBAsND,CAAC8I,gBAAS,EAAEC,oBAAe,EAAEC,sBAAY,CAAC;AAAA,gCAtNrDhJ,YAAY,aAwNNiJ,kBAAW;AAU9BP,0BAAc,CAACQ,UAAU,CAAClJ,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
|
package/dist/index.js
CHANGED
|
@@ -10,19 +10,14 @@ Object.defineProperty(exports, "CheckoutAspect", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.default = void 0;
|
|
13
|
-
|
|
14
13
|
function _checkout() {
|
|
15
14
|
const data = require("./checkout.aspect");
|
|
16
|
-
|
|
17
15
|
_checkout = function () {
|
|
18
16
|
return data;
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
return data;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
20
|
var _default = _checkout().CheckoutAspect;
|
|
25
|
-
|
|
26
21
|
exports.default = _default;
|
|
27
22
|
|
|
28
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CheckoutAspect"],"sources":["index.ts"],"sourcesContent":["import { CheckoutAspect } from './checkout.aspect';\n\nexport type { CheckoutMain } from './checkout.main.runtime';\nexport default CheckoutAspect;\nexport { CheckoutAspect };\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CheckoutAspect"],"sources":["index.ts"],"sourcesContent":["import { CheckoutAspect } from './checkout.aspect';\n\nexport type { CheckoutMain } from './checkout.main.runtime';\nexport default CheckoutAspect;\nexport { CheckoutAspect };\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAmD,eAGpCA,0BAAc;AAAA"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/checkout",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.51",
|
|
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.51"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@teambit/component-id": "0.0.418",
|
|
20
20
|
"@teambit/legacy-bit-id": "0.0.414",
|
|
21
21
|
"@teambit/logger": "0.0.684",
|
|
22
|
-
"@teambit/workspace": "0.0.
|
|
22
|
+
"@teambit/workspace": "0.0.882"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/mocha": "9.1.0",
|
|
File without changes
|
|
Binary file
|