@teambit/merging 1.0.107 → 1.0.109
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/artifacts/preview/teambit_component_merging-preview.js +1 -0
- package/dist/config-merger.d.ts +2 -2
- package/dist/config-merger.js +12 -18
- package/dist/config-merger.js.map +1 -1
- package/dist/merge-cmd.js +8 -8
- package/dist/merge-cmd.js.map +1 -1
- package/dist/merge-status-provider.d.ts +4 -4
- package/dist/merge-status-provider.js +11 -19
- package/dist/merge-status-provider.js.map +1 -1
- package/dist/merging.main.runtime.d.ts +8 -8
- package/dist/merging.main.runtime.js +11 -20
- package/dist/merging.main.runtime.js.map +1 -1
- package/package.json +23 -33
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
- /package/dist/{preview-1703590665075.js → preview-1703698405864.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["teambit.component/merging-preview"]=o():e["teambit.component/merging-preview"]=o()}(self,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{compositions:()=>t,compositions_metadata:()=>n,overview:()=>r});const t=[],r=[],n={compositions:[]};return o})()));
|
package/dist/config-merger.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { Logger } from '@teambit/logger';
|
|
|
3
3
|
import { Lane } from '@teambit/legacy/dist/scope/models';
|
|
4
4
|
import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
|
|
5
5
|
import { ConfigMergeResult } from './config-merge-result';
|
|
6
|
-
export
|
|
6
|
+
export type GenericConfigOrRemoved = Record<string, any> | '-';
|
|
7
7
|
export declare const conflictIndicator = "CONFLICT::";
|
|
8
|
-
export
|
|
8
|
+
export type MergeStrategyResult = {
|
|
9
9
|
id: string;
|
|
10
10
|
mergedConfig?: GenericConfigOrRemoved;
|
|
11
11
|
conflict?: Record<string, any>;
|
package/dist/config-merger.js
CHANGED
|
@@ -99,7 +99,7 @@ class ConfigMerger {
|
|
|
99
99
|
_defineProperty(this, "handledExtIds", [_builder().default.id]);
|
|
100
100
|
// don't try to merge builder, it's possible that at one end it wasn't built yet, so it's empty
|
|
101
101
|
_defineProperty(this, "otherLaneIdsStr", void 0);
|
|
102
|
-
this.otherLaneIdsStr =
|
|
102
|
+
this.otherLaneIdsStr = otherLane?.toBitIds().map(id => id.toString()) || [];
|
|
103
103
|
}
|
|
104
104
|
merge() {
|
|
105
105
|
this.logger.debug(`\n************** start config-merger for ${this.compIdStr} **************`);
|
|
@@ -194,23 +194,20 @@ class ConfigMerger {
|
|
|
194
194
|
// populate version
|
|
195
195
|
const currentEnvAspect = this.currentAspects.findExtension(currentEnv, true);
|
|
196
196
|
if (currentEnvAspect) {
|
|
197
|
-
var _currentEnvAspect$ext;
|
|
198
197
|
this.handledExtIds.push(currentEnvAspect.stringId);
|
|
199
|
-
this.currentEnv.version =
|
|
198
|
+
this.currentEnv.version = currentEnvAspect.extensionId?.version;
|
|
200
199
|
this.currentEnv.config = this.getConfig(currentEnvAspect);
|
|
201
200
|
}
|
|
202
201
|
const otherEnvAspect = this.otherAspects.findExtension(otherEnv, true);
|
|
203
202
|
if (otherEnvAspect) {
|
|
204
|
-
var _otherEnvAspect$exten;
|
|
205
203
|
this.handledExtIds.push(otherEnvAspect.stringId);
|
|
206
|
-
this.otherEnv.version =
|
|
204
|
+
this.otherEnv.version = otherEnvAspect.extensionId?.version;
|
|
207
205
|
this.otherEnv.config = this.getConfig(otherEnvAspect);
|
|
208
206
|
}
|
|
209
207
|
if (this.baseEnv) {
|
|
210
208
|
const baseEnvAspect = this.baseAspects.findExtension(baseEnv, true);
|
|
211
209
|
if (baseEnvAspect) {
|
|
212
|
-
|
|
213
|
-
this.baseEnv.version = (_baseEnvAspect$extens = baseEnvAspect.extensionId) === null || _baseEnvAspect$extens === void 0 ? void 0 : _baseEnvAspect$extens.version;
|
|
210
|
+
this.baseEnv.version = baseEnvAspect.extensionId?.version;
|
|
214
211
|
this.baseEnv.config = this.getConfig(baseEnvAspect);
|
|
215
212
|
}
|
|
216
213
|
}
|
|
@@ -226,9 +223,8 @@ class ConfigMerger {
|
|
|
226
223
|
}
|
|
227
224
|
};
|
|
228
225
|
if (this.baseEnv) {
|
|
229
|
-
var _this$baseEnv, _this$baseEnv2;
|
|
230
226
|
mergeStrategyParams.baseConfig = {
|
|
231
|
-
env:
|
|
227
|
+
env: this.baseEnv?.version ? `${this.baseEnv.id}@${this.baseEnv.version}` : this.baseEnv?.id
|
|
232
228
|
};
|
|
233
229
|
}
|
|
234
230
|
if (this.currentEnv.id === this.otherEnv.id && this.currentEnv.version === this.otherEnv.version) {
|
|
@@ -314,10 +310,9 @@ class ConfigMerger {
|
|
|
314
310
|
this.logger.debug(`otherConfig, ${JSON.stringify(otherConfig, undefined, 2)}`);
|
|
315
311
|
this.logger.debug(`baseConfig, ${JSON.stringify(baseConfig, undefined, 2)}`);
|
|
316
312
|
const getAllDeps = ext => {
|
|
317
|
-
|
|
318
|
-
const data = (_ext$findCoreExtensio = ext.findCoreExtension(_dependencyResolver().DependencyResolverAspect.id)) === null || _ext$findCoreExtensio === void 0 ? void 0 : _ext$findCoreExtensio.data.dependencies;
|
|
313
|
+
const data = ext.findCoreExtension(_dependencyResolver().DependencyResolverAspect.id)?.data.dependencies;
|
|
319
314
|
if (!data) return [];
|
|
320
|
-
const policy =
|
|
315
|
+
const policy = ext.findCoreExtension(_dependencyResolver().DependencyResolverAspect.id)?.data.policy || [];
|
|
321
316
|
return data.map(d => {
|
|
322
317
|
const idWithoutVersion = d.__type === 'package' ? d.id : d.id.split('@')[0];
|
|
323
318
|
const existingPolicy = policy.find(p => p.dependencyId === idWithoutVersion);
|
|
@@ -336,8 +331,7 @@ class ConfigMerger {
|
|
|
336
331
|
});
|
|
337
332
|
};
|
|
338
333
|
const getDataPolicy = ext => {
|
|
339
|
-
|
|
340
|
-
return ((_ext$findCoreExtensio3 = ext.findCoreExtension(_dependencyResolver().DependencyResolverAspect.id)) === null || _ext$findCoreExtensio3 === void 0 ? void 0 : _ext$findCoreExtensio3.data.policy) || [];
|
|
334
|
+
return ext.findCoreExtension(_dependencyResolver().DependencyResolverAspect.id)?.data.policy || [];
|
|
341
335
|
};
|
|
342
336
|
const getAutoDeps = ext => {
|
|
343
337
|
const allDeps = getAllDeps(ext);
|
|
@@ -352,7 +346,7 @@ class ConfigMerger {
|
|
|
352
346
|
const baseData = getAutoDeps(this.baseAspects);
|
|
353
347
|
const getCompIdStrByPkgNameFromData = pkgName => {
|
|
354
348
|
const found = currentAndOtherComponentsData.find(d => d.packageName === pkgName);
|
|
355
|
-
return found
|
|
349
|
+
return found?.id;
|
|
356
350
|
};
|
|
357
351
|
const getFromCurrentDataByPackageName = pkgName => {
|
|
358
352
|
return currentAllData.find(d => {
|
|
@@ -438,7 +432,7 @@ class ConfigMerger {
|
|
|
438
432
|
const depType = lifecycleToDepType[dep.lifecycleType];
|
|
439
433
|
const currentDep = currentConfigPolicy.find(d => d.dependencyId === dep.dependencyId);
|
|
440
434
|
const otherDep = otherConfigPolicy.find(d => d.dependencyId === dep.dependencyId);
|
|
441
|
-
const baseDep = baseConfigPolicy
|
|
435
|
+
const baseDep = baseConfigPolicy?.find(d => d.dependencyId === dep.dependencyId);
|
|
442
436
|
if (!otherDep) {
|
|
443
437
|
return;
|
|
444
438
|
}
|
|
@@ -452,7 +446,7 @@ class ConfigMerger {
|
|
|
452
446
|
if (currentVer === otherVer) {
|
|
453
447
|
return;
|
|
454
448
|
}
|
|
455
|
-
const baseVer = baseDep
|
|
449
|
+
const baseVer = baseDep?.value.version;
|
|
456
450
|
if (baseVer && baseVer === otherVer) {
|
|
457
451
|
return;
|
|
458
452
|
}
|
|
@@ -538,7 +532,7 @@ class ConfigMerger {
|
|
|
538
532
|
if (currentVer === otherVer) {
|
|
539
533
|
return;
|
|
540
534
|
}
|
|
541
|
-
const baseVer =
|
|
535
|
+
const baseVer = baseDep?.policy || baseDep?.version;
|
|
542
536
|
if (baseVer && baseVer === otherVer) {
|
|
543
537
|
return;
|
|
544
538
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_semver","data","_interopRequireDefault","require","_builder","_componentVersion","_dependencyResolver","_envs","_lodash","_configMergeResult","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","conflictIndicator","exports","ConfigMerger","constructor","compIdStr","workspaceIds","otherLane","currentAspects","baseAspects","otherAspects","currentLabel","otherLabel","logger","BuilderAspect","id","otherLaneIdsStr","toBitIds","map","toString","merge","debug","populateEnvs","results","currentExt","stringId","handledExtIds","includes","baseExt","findExtension","otherExt","mergePerStrategy","conflict","currentConfig","getConfig","otherConfig","otherAspectsNotHandledResults","extensionId","hasVersion","idFromWorkspace","getIdFromWorkspace","toStringWithoutVersion","existingExt","_legacy","mergedConfig","envResult","envStrategy","ConfigMergeResult","compact","getEnvId","ext","envsAspect","findCoreExtension","EnvsAspect","Error","env","config","currentEnv","otherEnv","baseEnv","undefined","currentEnvAspect","_currentEnvAspect$ext","version","otherEnvAspect","_otherEnvAspect$exten","baseEnvAspect","_baseEnvAspect$extens","mergeStrategyParams","_this$baseEnv","_this$baseEnv2","baseConfig","isIdInWorkspaceOrOtherLane","basicConfigMerge","areConfigsEqual","configA","configB","JSON","stringify","depResolverResult","depResolverStrategy","params","DependencyResolverAspect","trace","currentConfigPolicy","getPolicy","otherConfigPolicy","baseConfigPolicy","getAllDeps","_ext$findCoreExtensio","_ext$findCoreExtensio2","dependencies","policy","d","idWithoutVersion","__type","split","existingPolicy","find","p","dependencyId","getPolicyVer","getDataPolicy","_ext$findCoreExtensio3","getAutoDeps","allDeps","source","currentAutoData","currentAllData","currentDataPolicy","otherData","currentAndOtherData","uniqBy","concat","currentAndOtherComponentsData","c","baseData","getCompIdStrByPkgNameFromData","pkgName","found","packageName","getFromCurrentDataByPackageName","getFromCurrentDataPolicyByPackageName","mergedPolicy","devDependencies","peerDependencies","conflictedPolicy","hasConflict","lifecycleToDepType","runtime","dev","peer","handleConfigMerge","addVariantPolicyEntryToPolicy","dep","fromCurrentData","force","isHash","semver","satisfies","fromCurrentDataPolicy","depType","lifecycleType","name","currentAndOtherConfig","currentDep","otherDep","baseDep","currentVer","otherVer","baseVer","hasConfigForDep","depName","getDepIdAsPkgName","addSerializedDepToPolicy","lifecycle","join","depData","isEnv","currentId","versionOnOtherLane","Boolean","rawConfig","omit","VariantPolicy","fromConfigObject","entries"],"sources":["config-merger.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport semver from 'semver';\nimport { Logger } from '@teambit/logger';\nimport BuilderAspect from '@teambit/builder';\nimport { isHash } from '@teambit/component-version';\nimport {\n DependencyResolverAspect,\n SerializedDependency,\n VariantPolicy,\n VariantPolicyEntry,\n} from '@teambit/dependency-resolver';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { EnvsAspect } from '@teambit/envs';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { compact, omit, uniqBy } from 'lodash';\nimport { ConfigMergeResult } from './config-merge-result';\n\nexport type GenericConfigOrRemoved = Record<string, any> | '-';\n\ntype EnvData = { id: string; version?: string; config?: GenericConfigOrRemoved };\n\ntype SerializedDependencyWithPolicy = SerializedDependency & { policy?: string; packageName?: string };\n\nexport const conflictIndicator = 'CONFLICT::';\n\nexport type MergeStrategyResult = {\n id: string;\n mergedConfig?: GenericConfigOrRemoved;\n conflict?: Record<string, any>;\n};\ntype MergeStrategyParamsWithRemoved = {\n id: string;\n currentConfig: GenericConfigOrRemoved;\n otherConfig: GenericConfigOrRemoved;\n baseConfig?: GenericConfigOrRemoved;\n};\ntype MergeStrategyParams = {\n id: string;\n currentExt: ExtensionDataEntry;\n otherExt: ExtensionDataEntry;\n baseExt?: ExtensionDataEntry;\n};\n\n/**\n * perform 3-way merge of component configuration (aspects).\n * normally this is needed when merging one lane into another. the component may have different aspects config in each lane.\n * the baseAspects are the aspects of the component in the diversion point (the common ancestor of the two lanes).\n * the currentAspects are the aspects of the component in the current lane.\n * the otherAspects are the aspects of the component in the other lane. this is the lane we merge into the current lane.\n *\n * the basic merging strategy is a simple comparison between the aspect-configs, if they're different, we have a conflict.\n * we have two special cases:\n *\n * 1. dependency-resolver: we do a deeper check for the policy, we compare each dependency separately. also, we take\n * into account not only the config, but also the data. this is needed because some dependencies are automatically\n * added by Bit (from the import statements in the code) and they're not in the config. the final config has the deps\n * from both sources, the config and the data. The way we know to differentiate between them is by the \"force\" prop.\n * the config has always force: true.\n *\n * 2. envs: if we don't treat it specially, the user will need to make the change not only in the envs aspect, but also\n * in the deps-resolver (because the env is added as a devDependency) and also in the aspect itself (because\n * teambit.envs/env has only the id and not the version). to make it simpler, we ignore the envs in the deps-resolver\n * we ignore the individual aspect that is the env itself. we only show teambit.envs/env and we put the env id and\n * version. later, when the component is loaded, we split the id and the version and put them in the correct places.\n * see workspace.componentExtension / adjustEnvsOnConfigMerge for more details.\n */\nexport class ConfigMerger {\n private currentEnv: EnvData;\n private otherEnv: EnvData;\n private baseEnv?: EnvData;\n private handledExtIds: string[] = [BuilderAspect.id]; // don't try to merge builder, it's possible that at one end it wasn't built yet, so it's empty\n private otherLaneIdsStr: string[];\n constructor(\n private compIdStr: string,\n private workspaceIds: ComponentID[],\n otherLane: Lane | undefined,\n private currentAspects: ExtensionDataList,\n private baseAspects: ExtensionDataList,\n private otherAspects: ExtensionDataList,\n private currentLabel: string,\n private otherLabel: string,\n private logger: Logger\n ) {\n this.otherLaneIdsStr = otherLane?.toBitIds().map((id) => id.toString()) || [];\n }\n\n merge(): ConfigMergeResult {\n this.logger.debug(`\\n************** start config-merger for ${this.compIdStr} **************`);\n this.logger.debug(`currentLabel: ${this.currentLabel}`);\n this.logger.debug(`otherLabel: ${this.otherLabel}`);\n this.populateEnvs();\n const results = this.currentAspects.map((currentExt) => {\n const id = currentExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n const baseExt = this.baseAspects.findExtension(id, true);\n const otherExt = this.otherAspects.findExtension(id, true);\n if (otherExt) {\n // try to 3-way-merge\n return this.mergePerStrategy({ id, currentExt, otherExt, baseExt });\n }\n // exist in current but not in other\n if (baseExt) {\n // was removed on other\n return { id, conflict: { currentConfig: this.getConfig(currentExt), otherConfig: '-' } };\n }\n // exist in current but not in other and base, so it got created on current. nothing to do.\n return null;\n });\n const otherAspectsNotHandledResults = this.otherAspects.map((otherExt) => {\n let id = otherExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n if (otherExt.extensionId && otherExt.extensionId.hasVersion()) {\n // avoid using the id from the other lane if it exits in the workspace. prefer the id from the workspace.\n const idFromWorkspace = this.getIdFromWorkspace(otherExt.extensionId.toStringWithoutVersion());\n if (idFromWorkspace) {\n const existingExt = this.currentAspects.findExtension(otherExt.extensionId.toStringWithoutVersion(), true);\n if (existingExt) return null; // the aspect is set currently, no need to add it again.\n id = idFromWorkspace._legacy.toString();\n }\n }\n const baseExt = this.baseAspects.findExtension(id, true);\n if (baseExt) {\n // was removed on current\n return { id, conflict: { currentConfig: '-', otherConfig: this.getConfig(otherExt) } };\n }\n // exist in other but not in current and base, so it got created on other.\n return { id, mergedConfig: this.getConfig(otherExt) };\n });\n const envResult = [this.envStrategy()] || [];\n this.logger.debug(`*** end config-merger for ${this.compIdStr} ***\\n`);\n return new ConfigMergeResult(\n this.compIdStr,\n this.currentLabel,\n this.otherLabel,\n compact([...results, ...otherAspectsNotHandledResults, ...envResult])\n );\n }\n\n private populateEnvs() {\n // populate ids\n const getEnvId = (ext: ExtensionDataList) => {\n const envsAspect = ext.findCoreExtension(EnvsAspect.id);\n if (!envsAspect) throw new Error(`unable to find ${EnvsAspect.id} aspect for ${this.compIdStr}`);\n const env = envsAspect.config.env || envsAspect.data.id;\n if (!env)\n throw new Error(`unable to find env for ${this.compIdStr}, the config and data of ${EnvsAspect.id} are empty}`);\n return env;\n };\n const currentEnv = getEnvId(this.currentAspects);\n this.currentEnv = { id: currentEnv };\n const otherEnv = getEnvId(this.otherAspects);\n this.otherEnv = { id: otherEnv };\n const baseEnv = this.baseAspects ? getEnvId(this.baseAspects) : undefined;\n if (baseEnv) this.baseEnv = { id: baseEnv };\n\n // populate version\n const currentEnvAspect = this.currentAspects.findExtension(currentEnv, true);\n if (currentEnvAspect) {\n this.handledExtIds.push(currentEnvAspect.stringId);\n this.currentEnv.version = currentEnvAspect.extensionId?.version;\n this.currentEnv.config = this.getConfig(currentEnvAspect);\n }\n const otherEnvAspect = this.otherAspects.findExtension(otherEnv, true);\n if (otherEnvAspect) {\n this.handledExtIds.push(otherEnvAspect.stringId);\n this.otherEnv.version = otherEnvAspect.extensionId?.version;\n this.otherEnv.config = this.getConfig(otherEnvAspect);\n }\n if (this.baseEnv) {\n const baseEnvAspect = this.baseAspects.findExtension(baseEnv, true);\n if (baseEnvAspect) {\n this.baseEnv.version = baseEnvAspect.extensionId?.version;\n this.baseEnv.config = this.getConfig(baseEnvAspect);\n }\n }\n }\n\n private envStrategy(): MergeStrategyResult | null {\n const mergeStrategyParams: MergeStrategyParamsWithRemoved = {\n id: EnvsAspect.id,\n currentConfig: {\n env: this.currentEnv.version ? `${this.currentEnv.id}@${this.currentEnv.version}` : this.currentEnv.id,\n },\n otherConfig: { env: this.otherEnv.version ? `${this.otherEnv.id}@${this.otherEnv.version}` : this.otherEnv.id },\n };\n if (this.baseEnv) {\n mergeStrategyParams.baseConfig = {\n env: this.baseEnv?.version ? `${this.baseEnv.id}@${this.baseEnv.version}` : this.baseEnv?.id,\n };\n }\n if (this.currentEnv.id === this.otherEnv.id && this.currentEnv.version === this.otherEnv.version) {\n return null;\n }\n if (this.isIdInWorkspaceOrOtherLane(this.currentEnv.id, this.otherEnv.version)) {\n // the env currently used is part of the workspace, that's what the user needs. don't try to resolve anything.\n return null;\n }\n return this.basicConfigMerge(mergeStrategyParams);\n }\n\n private areConfigsEqual(configA: GenericConfigOrRemoved, configB: GenericConfigOrRemoved) {\n return JSON.stringify(configA) === JSON.stringify(configB);\n }\n\n private mergePerStrategy(mergeStrategyParams: MergeStrategyParams): MergeStrategyResult | null {\n const { id, currentExt, otherExt, baseExt } = mergeStrategyParams;\n const depResolverResult = this.depResolverStrategy(mergeStrategyParams);\n\n if (depResolverResult) {\n // if (depResolverResult.mergedConfig || depResolverResult?.conflict) console.log(\"\\n\\nDepResolverResult\", this.compIdStr, '\\n', JSON.stringify(depResolverResult, undefined, 2))\n return depResolverResult;\n }\n const currentConfig = this.getConfig(currentExt);\n const otherConfig = this.getConfig(otherExt);\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n\n return this.basicConfigMerge({ id, currentConfig, otherConfig, baseConfig });\n }\n\n private basicConfigMerge(mergeStrategyParams: MergeStrategyParamsWithRemoved) {\n const { id, currentConfig, otherConfig, baseConfig } = mergeStrategyParams;\n if (this.areConfigsEqual(currentConfig, otherConfig)) {\n return null;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, otherConfig)) {\n // was changed on current\n return null;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n return { id, mergedConfig: otherConfig };\n }\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n return { id, conflict: { currentConfig, otherConfig, baseConfig } };\n }\n\n private depResolverStrategy(params: MergeStrategyParams): MergeStrategyResult | undefined {\n if (params.id !== DependencyResolverAspect.id) return undefined;\n this.logger.trace(`start depResolverStrategy for ${this.compIdStr}`);\n const { currentExt, otherExt, baseExt } = params;\n\n const currentConfig = this.getConfig(currentExt);\n const currentConfigPolicy = this.getPolicy(currentConfig);\n const otherConfig = this.getConfig(otherExt);\n const otherConfigPolicy = this.getPolicy(otherConfig);\n\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n const baseConfigPolicy = baseConfig ? this.getPolicy(baseConfig) : undefined;\n\n this.logger.debug(`currentConfig, ${JSON.stringify(currentConfig, undefined, 2)}`);\n this.logger.debug(`otherConfig, ${JSON.stringify(otherConfig, undefined, 2)}`);\n this.logger.debug(`baseConfig, ${JSON.stringify(baseConfig, undefined, 2)}`);\n\n const getAllDeps = (ext: ExtensionDataList): SerializedDependencyWithPolicy[] => {\n const data = ext.findCoreExtension(DependencyResolverAspect.id)?.data.dependencies;\n if (!data) return [];\n const policy = ext.findCoreExtension(DependencyResolverAspect.id)?.data.policy || [];\n return data.map((d) => {\n const idWithoutVersion = d.__type === 'package' ? d.id : d.id.split('@')[0];\n const existingPolicy = policy.find((p) => p.dependencyId === idWithoutVersion);\n const getPolicyVer = () => {\n if (d.__type === 'package') return undefined; // for packages, the policy is already the version\n if (existingPolicy) return existingPolicy.value.version; // currently it's missing, will be implemented by @Gilad\n return d.version;\n // if (!semver.valid(d.version)) return d.version; // could be a hash\n // // default to `^` or ~ if starts with zero, until we save the policy from the workspace during tag/snap.\n // return d.version.startsWith('0.') ? `~${d.version}` : `^${d.version}`;\n };\n return {\n ...d,\n id: idWithoutVersion,\n policy: getPolicyVer(),\n };\n });\n };\n const getDataPolicy = (ext: ExtensionDataList): VariantPolicyEntry[] => {\n return ext.findCoreExtension(DependencyResolverAspect.id)?.data.policy || [];\n };\n\n const getAutoDeps = (ext: ExtensionDataList): SerializedDependencyWithPolicy[] => {\n const allDeps = getAllDeps(ext);\n return allDeps.filter((d) => d.source === 'auto');\n };\n\n const currentAutoData = getAutoDeps(this.currentAspects);\n const currentAllData = getAllDeps(this.currentAspects);\n const currentDataPolicy = getDataPolicy(this.currentAspects);\n const otherData = getAutoDeps(this.otherAspects);\n const currentAndOtherData = uniqBy(currentAutoData.concat(otherData), (d) => d.id);\n const currentAndOtherComponentsData = currentAndOtherData.filter((c) => c.__type === 'component');\n const baseData = getAutoDeps(this.baseAspects);\n\n const getCompIdStrByPkgNameFromData = (pkgName: string): string | undefined => {\n const found = currentAndOtherComponentsData.find((d) => d.packageName === pkgName);\n return found?.id;\n };\n\n const getFromCurrentDataByPackageName = (pkgName: string) => {\n return currentAllData.find((d) => {\n if (d.__type === 'package') return d.id === pkgName;\n return d.packageName === pkgName;\n });\n };\n\n const getFromCurrentDataPolicyByPackageName = (pkgName: string) => {\n return currentDataPolicy.find((d) => d.dependencyId === pkgName);\n };\n\n const mergedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n const conflictedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n let hasConflict = false;\n const lifecycleToDepType = {\n runtime: 'dependencies',\n dev: 'devDependencies',\n peer: 'peerDependencies',\n };\n const handleConfigMerge = () => {\n const addVariantPolicyEntryToPolicy = (dep: VariantPolicyEntry) => {\n const compIdStr = getCompIdStrByPkgNameFromData(dep.dependencyId);\n if (compIdStr && this.isIdInWorkspaceOrOtherLane(compIdStr, dep.value.version)) {\n // no need to add if the id exists in the workspace (regardless the version)\n return;\n }\n const fromCurrentData = getFromCurrentDataByPackageName(dep.dependencyId);\n if (fromCurrentData && !dep.force) {\n if (fromCurrentData.version === dep.value.version) return;\n if (\n !isHash(fromCurrentData.version) &&\n !isHash(dep.value.version) &&\n semver.satisfies(fromCurrentData.version, dep.value.version)\n ) {\n return;\n }\n }\n const fromCurrentDataPolicy = getFromCurrentDataPolicyByPackageName(dep.dependencyId);\n if (fromCurrentDataPolicy && fromCurrentDataPolicy.value.version === dep.value.version) {\n // -- updated comment --\n // not sure why this block is needed. this gets called also from this if: `if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {`\n // and in this case, it's possible that current/base has 5 deps, and other just added one and it has 6.\n // in which case, we do need to add all these 5 in additional to the new one. otherwise, only the new one appears in the final\n // merged object, and all the 5 deps are lost.\n // --- previous comment ---\n // that's a bug. if it's in the data.policy, it should be in data.dependencies.\n // return;\n }\n const depType = lifecycleToDepType[dep.lifecycleType];\n mergedPolicy[depType].push({\n name: dep.dependencyId,\n version: dep.value.version,\n force: dep.force,\n });\n };\n\n if (this.areConfigsEqual(currentConfig, otherConfig)) {\n return;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, otherConfig)) {\n // was changed on current\n return;\n }\n if (currentConfig === '-' || otherConfig === '-') {\n throw new Error('not implemented. Is it possible to have it as minus?');\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n if (otherConfigPolicy.length) {\n otherConfigPolicy.forEach((dep) => {\n addVariantPolicyEntryToPolicy(dep);\n });\n }\n return;\n }\n\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n if (!currentConfig.policy && !otherConfig.policy) return;\n const currentAndOtherConfig = uniqBy(currentConfigPolicy.concat(otherConfigPolicy), (d) => d.dependencyId);\n currentAndOtherConfig.forEach((dep) => {\n const depType = lifecycleToDepType[dep.lifecycleType];\n const currentDep = currentConfigPolicy.find((d) => d.dependencyId === dep.dependencyId);\n const otherDep = otherConfigPolicy.find((d) => d.dependencyId === dep.dependencyId);\n const baseDep = baseConfigPolicy?.find((d) => d.dependencyId === dep.dependencyId);\n\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n // only on other\n addVariantPolicyEntryToPolicy(otherDep);\n return;\n }\n const currentVer = currentDep.value.version;\n const otherVer = otherDep.value.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseVer = baseDep?.value.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n if (baseVer && baseVer === currentVer) {\n addVariantPolicyEntryToPolicy(otherDep);\n return;\n }\n const compIdStr = getCompIdStrByPkgNameFromData(dep.dependencyId);\n if (compIdStr && this.isIdInWorkspaceOrOtherLane(compIdStr, otherVer)) {\n // no need to add if the id exists in the workspace (regardless the version)\n return;\n }\n\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: currentDep.dependencyId,\n version: `${conflictIndicator}${currentVer}::${otherVer}::`,\n force: currentDep.force,\n });\n });\n };\n\n handleConfigMerge();\n\n const hasConfigForDep = (depType: string, depName: string) => mergedPolicy[depType].find((d) => d.name === depName);\n const getDepIdAsPkgName = (dep: SerializedDependencyWithPolicy) => {\n if (dep.__type !== 'component') {\n return dep.id;\n }\n // @ts-ignore\n return dep.packageName;\n };\n\n const addSerializedDepToPolicy = (dep: SerializedDependencyWithPolicy) => {\n const depType = lifecycleToDepType[dep.lifecycle];\n if (dep.__type === 'component' && this.isIdInWorkspaceOrOtherLane(dep.id, dep.version)) {\n return;\n }\n if (hasConfigForDep(depType, dep.id)) {\n return; // there is already config for it.\n }\n mergedPolicy[depType].push({\n name: getDepIdAsPkgName(dep),\n version: dep.policy || dep.version,\n force: false,\n });\n };\n\n this.logger.debug(\n `currentData, ${currentAllData.length}\\n${currentAllData\n .map((d) => `${d.__type} ${d.id} ${d.version}`)\n .join('\\n')}`\n );\n this.logger.debug(\n `otherData, ${otherData.length}\\n${otherData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n')}`\n );\n this.logger.debug(\n `baseData, ${baseData.length}\\n${baseData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n')}`\n );\n\n // eslint-disable-next-line complexity\n currentAndOtherData.forEach((depData) => {\n this.logger.trace(`depData.id, ${depData.id}`);\n if (this.isEnv(depData.id)) {\n // ignore the envs\n return;\n }\n const currentDep = currentAllData.find((d) => d.id === depData.id);\n const otherDep = otherData.find((d) => d.id === depData.id);\n const baseDep = baseData.find((d) => d.id === depData.id);\n\n this.logger.trace(`currentDep`, currentDep);\n this.logger.trace(`otherDep`, otherDep);\n this.logger.trace(`baseDep`, baseDep);\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n if (baseDep) {\n // exists in other and base, so it was removed from current\n return;\n }\n // only on other\n addSerializedDepToPolicy(otherDep);\n return;\n }\n\n if (currentDep.policy && otherDep.policy) {\n if (semver.satisfies(currentDep.version, otherDep.policy)) {\n return;\n }\n if (semver.satisfies(otherDep.version, currentDep.policy)) {\n return;\n }\n }\n\n const currentVer = currentDep.policy || currentDep.version;\n const otherVer = otherDep.policy || otherDep.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseVer = baseDep?.policy || baseDep?.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n const currentId = currentDep.id;\n if (currentDep.__type === 'component' && this.isIdInWorkspaceOrOtherLane(currentId, otherDep.version)) {\n // dependencies that exist in the workspace, should be ignored. they'll be resolved later to the version in the ws.\n return;\n }\n const depType = lifecycleToDepType[currentDep.lifecycle];\n if (hasConfigForDep(depType, currentDep.id)) {\n return; // there is already config for it.\n }\n if (baseVer && baseVer === currentVer) {\n addSerializedDepToPolicy(otherDep);\n return;\n }\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: getDepIdAsPkgName(currentDep),\n version: `${conflictIndicator}${currentVer}::${otherVer}::`,\n force: false,\n });\n });\n\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {\n if (!mergedPolicy[depType].length) delete mergedPolicy[depType];\n if (!conflictedPolicy[depType].length) delete conflictedPolicy[depType];\n });\n\n const config = Object.keys(mergedPolicy).length ? { policy: mergedPolicy } : undefined;\n const conflict = hasConflict ? conflictedPolicy : undefined;\n\n this.logger.debug('final mergedConfig', config);\n this.logger.debug('final conflict', conflict);\n\n return { id: params.id, mergedConfig: config, conflict };\n }\n\n private isIdInWorkspaceOrOtherLane(id: string, versionOnOtherLane?: string): boolean {\n return Boolean(this.getIdFromWorkspace(id)) || this.otherLaneIdsStr.includes(`${id}@${versionOnOtherLane}`);\n }\n\n private getIdFromWorkspace(id: string): ComponentID | undefined {\n return this.workspaceIds.find((c) => c.toStringWithoutVersion() === id);\n }\n\n private isEnv(id: string) {\n return id === this.currentEnv.id || id === this.otherEnv.id;\n }\n\n private getConfig(ext: ExtensionDataEntry): GenericConfigOrRemoved {\n if (ext.rawConfig === '-') return ext.rawConfig;\n return omit(ext.rawConfig, ['__specific']);\n }\n\n private getPolicy(config): VariantPolicyEntry[] {\n if (!config.policy) return [];\n return VariantPolicy.fromConfigObject(config.policy).entries;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,oBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,mBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,mBAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,kBAAA,YAAAA,CAAA;IAAA,OAAAR,IAA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AC4F,IAAI,CAAEiB,CAAC,IAAKA,CAAC,CAAC1E,sBAAsB,CAAC,CAAC,KAAK1B,EAAE,CAAC;EACzE;EAEQ+I,KAAKA,CAAC/I,EAAU,EAAE;IACxB,OAAOA,EAAE,KAAK,IAAI,CAAC0C,UAAU,CAAC1C,EAAE,IAAIA,EAAE,KAAK,IAAI,CAAC2C,QAAQ,CAAC3C,EAAE;EAC7D;EAEQmB,SAASA,CAACgB,GAAuB,EAA0B;IACjE,IAAIA,GAAG,CAACgH,SAAS,KAAK,GAAG,EAAE,OAAOhH,GAAG,CAACgH,SAAS;IAC/C,OAAO,IAAAC,cAAI,EAACjH,GAAG,CAACgH,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC;EAC5C;EAEQ7E,SAASA,CAAC7B,MAAM,EAAwB;IAC9C,IAAI,CAACA,MAAM,CAACoC,MAAM,EAAE,OAAO,EAAE;IAC7B,OAAOwE,mCAAa,CAACC,gBAAgB,CAAC7G,MAAM,CAACoC,MAAM,CAAC,CAAC0E,OAAO;EAC9D;AACF;AAACpK,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
|
|
1
|
+
{"version":3,"names":["_semver","data","_interopRequireDefault","require","_builder","_componentVersion","_dependencyResolver","_envs","_lodash","_configMergeResult","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","conflictIndicator","exports","ConfigMerger","constructor","compIdStr","workspaceIds","otherLane","currentAspects","baseAspects","otherAspects","currentLabel","otherLabel","logger","BuilderAspect","id","otherLaneIdsStr","toBitIds","map","toString","merge","debug","populateEnvs","results","currentExt","stringId","handledExtIds","includes","baseExt","findExtension","otherExt","mergePerStrategy","conflict","currentConfig","getConfig","otherConfig","otherAspectsNotHandledResults","extensionId","hasVersion","idFromWorkspace","getIdFromWorkspace","toStringWithoutVersion","existingExt","_legacy","mergedConfig","envResult","envStrategy","ConfigMergeResult","compact","getEnvId","ext","envsAspect","findCoreExtension","EnvsAspect","Error","env","config","currentEnv","otherEnv","baseEnv","undefined","currentEnvAspect","version","otherEnvAspect","baseEnvAspect","mergeStrategyParams","baseConfig","isIdInWorkspaceOrOtherLane","basicConfigMerge","areConfigsEqual","configA","configB","JSON","stringify","depResolverResult","depResolverStrategy","params","DependencyResolverAspect","trace","currentConfigPolicy","getPolicy","otherConfigPolicy","baseConfigPolicy","getAllDeps","dependencies","policy","d","idWithoutVersion","__type","split","existingPolicy","find","p","dependencyId","getPolicyVer","getDataPolicy","getAutoDeps","allDeps","source","currentAutoData","currentAllData","currentDataPolicy","otherData","currentAndOtherData","uniqBy","concat","currentAndOtherComponentsData","c","baseData","getCompIdStrByPkgNameFromData","pkgName","found","packageName","getFromCurrentDataByPackageName","getFromCurrentDataPolicyByPackageName","mergedPolicy","devDependencies","peerDependencies","conflictedPolicy","hasConflict","lifecycleToDepType","runtime","dev","peer","handleConfigMerge","addVariantPolicyEntryToPolicy","dep","fromCurrentData","force","isHash","semver","satisfies","fromCurrentDataPolicy","depType","lifecycleType","name","currentAndOtherConfig","currentDep","otherDep","baseDep","currentVer","otherVer","baseVer","hasConfigForDep","depName","getDepIdAsPkgName","addSerializedDepToPolicy","lifecycle","join","depData","isEnv","currentId","versionOnOtherLane","Boolean","rawConfig","omit","VariantPolicy","fromConfigObject","entries"],"sources":["config-merger.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport semver from 'semver';\nimport { Logger } from '@teambit/logger';\nimport BuilderAspect from '@teambit/builder';\nimport { isHash } from '@teambit/component-version';\nimport {\n DependencyResolverAspect,\n SerializedDependency,\n VariantPolicy,\n VariantPolicyEntry,\n} from '@teambit/dependency-resolver';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { EnvsAspect } from '@teambit/envs';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { compact, omit, uniqBy } from 'lodash';\nimport { ConfigMergeResult } from './config-merge-result';\n\nexport type GenericConfigOrRemoved = Record<string, any> | '-';\n\ntype EnvData = { id: string; version?: string; config?: GenericConfigOrRemoved };\n\ntype SerializedDependencyWithPolicy = SerializedDependency & { policy?: string; packageName?: string };\n\nexport const conflictIndicator = 'CONFLICT::';\n\nexport type MergeStrategyResult = {\n id: string;\n mergedConfig?: GenericConfigOrRemoved;\n conflict?: Record<string, any>;\n};\ntype MergeStrategyParamsWithRemoved = {\n id: string;\n currentConfig: GenericConfigOrRemoved;\n otherConfig: GenericConfigOrRemoved;\n baseConfig?: GenericConfigOrRemoved;\n};\ntype MergeStrategyParams = {\n id: string;\n currentExt: ExtensionDataEntry;\n otherExt: ExtensionDataEntry;\n baseExt?: ExtensionDataEntry;\n};\n\n/**\n * perform 3-way merge of component configuration (aspects).\n * normally this is needed when merging one lane into another. the component may have different aspects config in each lane.\n * the baseAspects are the aspects of the component in the diversion point (the common ancestor of the two lanes).\n * the currentAspects are the aspects of the component in the current lane.\n * the otherAspects are the aspects of the component in the other lane. this is the lane we merge into the current lane.\n *\n * the basic merging strategy is a simple comparison between the aspect-configs, if they're different, we have a conflict.\n * we have two special cases:\n *\n * 1. dependency-resolver: we do a deeper check for the policy, we compare each dependency separately. also, we take\n * into account not only the config, but also the data. this is needed because some dependencies are automatically\n * added by Bit (from the import statements in the code) and they're not in the config. the final config has the deps\n * from both sources, the config and the data. The way we know to differentiate between them is by the \"force\" prop.\n * the config has always force: true.\n *\n * 2. envs: if we don't treat it specially, the user will need to make the change not only in the envs aspect, but also\n * in the deps-resolver (because the env is added as a devDependency) and also in the aspect itself (because\n * teambit.envs/env has only the id and not the version). to make it simpler, we ignore the envs in the deps-resolver\n * we ignore the individual aspect that is the env itself. we only show teambit.envs/env and we put the env id and\n * version. later, when the component is loaded, we split the id and the version and put them in the correct places.\n * see workspace.componentExtension / adjustEnvsOnConfigMerge for more details.\n */\nexport class ConfigMerger {\n private currentEnv: EnvData;\n private otherEnv: EnvData;\n private baseEnv?: EnvData;\n private handledExtIds: string[] = [BuilderAspect.id]; // don't try to merge builder, it's possible that at one end it wasn't built yet, so it's empty\n private otherLaneIdsStr: string[];\n constructor(\n private compIdStr: string,\n private workspaceIds: ComponentID[],\n otherLane: Lane | undefined,\n private currentAspects: ExtensionDataList,\n private baseAspects: ExtensionDataList,\n private otherAspects: ExtensionDataList,\n private currentLabel: string,\n private otherLabel: string,\n private logger: Logger\n ) {\n this.otherLaneIdsStr = otherLane?.toBitIds().map((id) => id.toString()) || [];\n }\n\n merge(): ConfigMergeResult {\n this.logger.debug(`\\n************** start config-merger for ${this.compIdStr} **************`);\n this.logger.debug(`currentLabel: ${this.currentLabel}`);\n this.logger.debug(`otherLabel: ${this.otherLabel}`);\n this.populateEnvs();\n const results = this.currentAspects.map((currentExt) => {\n const id = currentExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n const baseExt = this.baseAspects.findExtension(id, true);\n const otherExt = this.otherAspects.findExtension(id, true);\n if (otherExt) {\n // try to 3-way-merge\n return this.mergePerStrategy({ id, currentExt, otherExt, baseExt });\n }\n // exist in current but not in other\n if (baseExt) {\n // was removed on other\n return { id, conflict: { currentConfig: this.getConfig(currentExt), otherConfig: '-' } };\n }\n // exist in current but not in other and base, so it got created on current. nothing to do.\n return null;\n });\n const otherAspectsNotHandledResults = this.otherAspects.map((otherExt) => {\n let id = otherExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n if (otherExt.extensionId && otherExt.extensionId.hasVersion()) {\n // avoid using the id from the other lane if it exits in the workspace. prefer the id from the workspace.\n const idFromWorkspace = this.getIdFromWorkspace(otherExt.extensionId.toStringWithoutVersion());\n if (idFromWorkspace) {\n const existingExt = this.currentAspects.findExtension(otherExt.extensionId.toStringWithoutVersion(), true);\n if (existingExt) return null; // the aspect is set currently, no need to add it again.\n id = idFromWorkspace._legacy.toString();\n }\n }\n const baseExt = this.baseAspects.findExtension(id, true);\n if (baseExt) {\n // was removed on current\n return { id, conflict: { currentConfig: '-', otherConfig: this.getConfig(otherExt) } };\n }\n // exist in other but not in current and base, so it got created on other.\n return { id, mergedConfig: this.getConfig(otherExt) };\n });\n const envResult = [this.envStrategy()] || [];\n this.logger.debug(`*** end config-merger for ${this.compIdStr} ***\\n`);\n return new ConfigMergeResult(\n this.compIdStr,\n this.currentLabel,\n this.otherLabel,\n compact([...results, ...otherAspectsNotHandledResults, ...envResult])\n );\n }\n\n private populateEnvs() {\n // populate ids\n const getEnvId = (ext: ExtensionDataList) => {\n const envsAspect = ext.findCoreExtension(EnvsAspect.id);\n if (!envsAspect) throw new Error(`unable to find ${EnvsAspect.id} aspect for ${this.compIdStr}`);\n const env = envsAspect.config.env || envsAspect.data.id;\n if (!env)\n throw new Error(`unable to find env for ${this.compIdStr}, the config and data of ${EnvsAspect.id} are empty}`);\n return env;\n };\n const currentEnv = getEnvId(this.currentAspects);\n this.currentEnv = { id: currentEnv };\n const otherEnv = getEnvId(this.otherAspects);\n this.otherEnv = { id: otherEnv };\n const baseEnv = this.baseAspects ? getEnvId(this.baseAspects) : undefined;\n if (baseEnv) this.baseEnv = { id: baseEnv };\n\n // populate version\n const currentEnvAspect = this.currentAspects.findExtension(currentEnv, true);\n if (currentEnvAspect) {\n this.handledExtIds.push(currentEnvAspect.stringId);\n this.currentEnv.version = currentEnvAspect.extensionId?.version;\n this.currentEnv.config = this.getConfig(currentEnvAspect);\n }\n const otherEnvAspect = this.otherAspects.findExtension(otherEnv, true);\n if (otherEnvAspect) {\n this.handledExtIds.push(otherEnvAspect.stringId);\n this.otherEnv.version = otherEnvAspect.extensionId?.version;\n this.otherEnv.config = this.getConfig(otherEnvAspect);\n }\n if (this.baseEnv) {\n const baseEnvAspect = this.baseAspects.findExtension(baseEnv, true);\n if (baseEnvAspect) {\n this.baseEnv.version = baseEnvAspect.extensionId?.version;\n this.baseEnv.config = this.getConfig(baseEnvAspect);\n }\n }\n }\n\n private envStrategy(): MergeStrategyResult | null {\n const mergeStrategyParams: MergeStrategyParamsWithRemoved = {\n id: EnvsAspect.id,\n currentConfig: {\n env: this.currentEnv.version ? `${this.currentEnv.id}@${this.currentEnv.version}` : this.currentEnv.id,\n },\n otherConfig: { env: this.otherEnv.version ? `${this.otherEnv.id}@${this.otherEnv.version}` : this.otherEnv.id },\n };\n if (this.baseEnv) {\n mergeStrategyParams.baseConfig = {\n env: this.baseEnv?.version ? `${this.baseEnv.id}@${this.baseEnv.version}` : this.baseEnv?.id,\n };\n }\n if (this.currentEnv.id === this.otherEnv.id && this.currentEnv.version === this.otherEnv.version) {\n return null;\n }\n if (this.isIdInWorkspaceOrOtherLane(this.currentEnv.id, this.otherEnv.version)) {\n // the env currently used is part of the workspace, that's what the user needs. don't try to resolve anything.\n return null;\n }\n return this.basicConfigMerge(mergeStrategyParams);\n }\n\n private areConfigsEqual(configA: GenericConfigOrRemoved, configB: GenericConfigOrRemoved) {\n return JSON.stringify(configA) === JSON.stringify(configB);\n }\n\n private mergePerStrategy(mergeStrategyParams: MergeStrategyParams): MergeStrategyResult | null {\n const { id, currentExt, otherExt, baseExt } = mergeStrategyParams;\n const depResolverResult = this.depResolverStrategy(mergeStrategyParams);\n\n if (depResolverResult) {\n // if (depResolverResult.mergedConfig || depResolverResult?.conflict) console.log(\"\\n\\nDepResolverResult\", this.compIdStr, '\\n', JSON.stringify(depResolverResult, undefined, 2))\n return depResolverResult;\n }\n const currentConfig = this.getConfig(currentExt);\n const otherConfig = this.getConfig(otherExt);\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n\n return this.basicConfigMerge({ id, currentConfig, otherConfig, baseConfig });\n }\n\n private basicConfigMerge(mergeStrategyParams: MergeStrategyParamsWithRemoved) {\n const { id, currentConfig, otherConfig, baseConfig } = mergeStrategyParams;\n if (this.areConfigsEqual(currentConfig, otherConfig)) {\n return null;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, otherConfig)) {\n // was changed on current\n return null;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n return { id, mergedConfig: otherConfig };\n }\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n return { id, conflict: { currentConfig, otherConfig, baseConfig } };\n }\n\n private depResolverStrategy(params: MergeStrategyParams): MergeStrategyResult | undefined {\n if (params.id !== DependencyResolverAspect.id) return undefined;\n this.logger.trace(`start depResolverStrategy for ${this.compIdStr}`);\n const { currentExt, otherExt, baseExt } = params;\n\n const currentConfig = this.getConfig(currentExt);\n const currentConfigPolicy = this.getPolicy(currentConfig);\n const otherConfig = this.getConfig(otherExt);\n const otherConfigPolicy = this.getPolicy(otherConfig);\n\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n const baseConfigPolicy = baseConfig ? this.getPolicy(baseConfig) : undefined;\n\n this.logger.debug(`currentConfig, ${JSON.stringify(currentConfig, undefined, 2)}`);\n this.logger.debug(`otherConfig, ${JSON.stringify(otherConfig, undefined, 2)}`);\n this.logger.debug(`baseConfig, ${JSON.stringify(baseConfig, undefined, 2)}`);\n\n const getAllDeps = (ext: ExtensionDataList): SerializedDependencyWithPolicy[] => {\n const data = ext.findCoreExtension(DependencyResolverAspect.id)?.data.dependencies;\n if (!data) return [];\n const policy = ext.findCoreExtension(DependencyResolverAspect.id)?.data.policy || [];\n return data.map((d) => {\n const idWithoutVersion = d.__type === 'package' ? d.id : d.id.split('@')[0];\n const existingPolicy = policy.find((p) => p.dependencyId === idWithoutVersion);\n const getPolicyVer = () => {\n if (d.__type === 'package') return undefined; // for packages, the policy is already the version\n if (existingPolicy) return existingPolicy.value.version; // currently it's missing, will be implemented by @Gilad\n return d.version;\n // if (!semver.valid(d.version)) return d.version; // could be a hash\n // // default to `^` or ~ if starts with zero, until we save the policy from the workspace during tag/snap.\n // return d.version.startsWith('0.') ? `~${d.version}` : `^${d.version}`;\n };\n return {\n ...d,\n id: idWithoutVersion,\n policy: getPolicyVer(),\n };\n });\n };\n const getDataPolicy = (ext: ExtensionDataList): VariantPolicyEntry[] => {\n return ext.findCoreExtension(DependencyResolverAspect.id)?.data.policy || [];\n };\n\n const getAutoDeps = (ext: ExtensionDataList): SerializedDependencyWithPolicy[] => {\n const allDeps = getAllDeps(ext);\n return allDeps.filter((d) => d.source === 'auto');\n };\n\n const currentAutoData = getAutoDeps(this.currentAspects);\n const currentAllData = getAllDeps(this.currentAspects);\n const currentDataPolicy = getDataPolicy(this.currentAspects);\n const otherData = getAutoDeps(this.otherAspects);\n const currentAndOtherData = uniqBy(currentAutoData.concat(otherData), (d) => d.id);\n const currentAndOtherComponentsData = currentAndOtherData.filter((c) => c.__type === 'component');\n const baseData = getAutoDeps(this.baseAspects);\n\n const getCompIdStrByPkgNameFromData = (pkgName: string): string | undefined => {\n const found = currentAndOtherComponentsData.find((d) => d.packageName === pkgName);\n return found?.id;\n };\n\n const getFromCurrentDataByPackageName = (pkgName: string) => {\n return currentAllData.find((d) => {\n if (d.__type === 'package') return d.id === pkgName;\n return d.packageName === pkgName;\n });\n };\n\n const getFromCurrentDataPolicyByPackageName = (pkgName: string) => {\n return currentDataPolicy.find((d) => d.dependencyId === pkgName);\n };\n\n const mergedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n const conflictedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n let hasConflict = false;\n const lifecycleToDepType = {\n runtime: 'dependencies',\n dev: 'devDependencies',\n peer: 'peerDependencies',\n };\n const handleConfigMerge = () => {\n const addVariantPolicyEntryToPolicy = (dep: VariantPolicyEntry) => {\n const compIdStr = getCompIdStrByPkgNameFromData(dep.dependencyId);\n if (compIdStr && this.isIdInWorkspaceOrOtherLane(compIdStr, dep.value.version)) {\n // no need to add if the id exists in the workspace (regardless the version)\n return;\n }\n const fromCurrentData = getFromCurrentDataByPackageName(dep.dependencyId);\n if (fromCurrentData && !dep.force) {\n if (fromCurrentData.version === dep.value.version) return;\n if (\n !isHash(fromCurrentData.version) &&\n !isHash(dep.value.version) &&\n semver.satisfies(fromCurrentData.version, dep.value.version)\n ) {\n return;\n }\n }\n const fromCurrentDataPolicy = getFromCurrentDataPolicyByPackageName(dep.dependencyId);\n if (fromCurrentDataPolicy && fromCurrentDataPolicy.value.version === dep.value.version) {\n // -- updated comment --\n // not sure why this block is needed. this gets called also from this if: `if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {`\n // and in this case, it's possible that current/base has 5 deps, and other just added one and it has 6.\n // in which case, we do need to add all these 5 in additional to the new one. otherwise, only the new one appears in the final\n // merged object, and all the 5 deps are lost.\n // --- previous comment ---\n // that's a bug. if it's in the data.policy, it should be in data.dependencies.\n // return;\n }\n const depType = lifecycleToDepType[dep.lifecycleType];\n mergedPolicy[depType].push({\n name: dep.dependencyId,\n version: dep.value.version,\n force: dep.force,\n });\n };\n\n if (this.areConfigsEqual(currentConfig, otherConfig)) {\n return;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, otherConfig)) {\n // was changed on current\n return;\n }\n if (currentConfig === '-' || otherConfig === '-') {\n throw new Error('not implemented. Is it possible to have it as minus?');\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n if (otherConfigPolicy.length) {\n otherConfigPolicy.forEach((dep) => {\n addVariantPolicyEntryToPolicy(dep);\n });\n }\n return;\n }\n\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n if (!currentConfig.policy && !otherConfig.policy) return;\n const currentAndOtherConfig = uniqBy(currentConfigPolicy.concat(otherConfigPolicy), (d) => d.dependencyId);\n currentAndOtherConfig.forEach((dep) => {\n const depType = lifecycleToDepType[dep.lifecycleType];\n const currentDep = currentConfigPolicy.find((d) => d.dependencyId === dep.dependencyId);\n const otherDep = otherConfigPolicy.find((d) => d.dependencyId === dep.dependencyId);\n const baseDep = baseConfigPolicy?.find((d) => d.dependencyId === dep.dependencyId);\n\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n // only on other\n addVariantPolicyEntryToPolicy(otherDep);\n return;\n }\n const currentVer = currentDep.value.version;\n const otherVer = otherDep.value.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseVer = baseDep?.value.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n if (baseVer && baseVer === currentVer) {\n addVariantPolicyEntryToPolicy(otherDep);\n return;\n }\n const compIdStr = getCompIdStrByPkgNameFromData(dep.dependencyId);\n if (compIdStr && this.isIdInWorkspaceOrOtherLane(compIdStr, otherVer)) {\n // no need to add if the id exists in the workspace (regardless the version)\n return;\n }\n\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: currentDep.dependencyId,\n version: `${conflictIndicator}${currentVer}::${otherVer}::`,\n force: currentDep.force,\n });\n });\n };\n\n handleConfigMerge();\n\n const hasConfigForDep = (depType: string, depName: string) => mergedPolicy[depType].find((d) => d.name === depName);\n const getDepIdAsPkgName = (dep: SerializedDependencyWithPolicy) => {\n if (dep.__type !== 'component') {\n return dep.id;\n }\n // @ts-ignore\n return dep.packageName;\n };\n\n const addSerializedDepToPolicy = (dep: SerializedDependencyWithPolicy) => {\n const depType = lifecycleToDepType[dep.lifecycle];\n if (dep.__type === 'component' && this.isIdInWorkspaceOrOtherLane(dep.id, dep.version)) {\n return;\n }\n if (hasConfigForDep(depType, dep.id)) {\n return; // there is already config for it.\n }\n mergedPolicy[depType].push({\n name: getDepIdAsPkgName(dep),\n version: dep.policy || dep.version,\n force: false,\n });\n };\n\n this.logger.debug(\n `currentData, ${currentAllData.length}\\n${currentAllData\n .map((d) => `${d.__type} ${d.id} ${d.version}`)\n .join('\\n')}`\n );\n this.logger.debug(\n `otherData, ${otherData.length}\\n${otherData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n')}`\n );\n this.logger.debug(\n `baseData, ${baseData.length}\\n${baseData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n')}`\n );\n\n // eslint-disable-next-line complexity\n currentAndOtherData.forEach((depData) => {\n this.logger.trace(`depData.id, ${depData.id}`);\n if (this.isEnv(depData.id)) {\n // ignore the envs\n return;\n }\n const currentDep = currentAllData.find((d) => d.id === depData.id);\n const otherDep = otherData.find((d) => d.id === depData.id);\n const baseDep = baseData.find((d) => d.id === depData.id);\n\n this.logger.trace(`currentDep`, currentDep);\n this.logger.trace(`otherDep`, otherDep);\n this.logger.trace(`baseDep`, baseDep);\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n if (baseDep) {\n // exists in other and base, so it was removed from current\n return;\n }\n // only on other\n addSerializedDepToPolicy(otherDep);\n return;\n }\n\n if (currentDep.policy && otherDep.policy) {\n if (semver.satisfies(currentDep.version, otherDep.policy)) {\n return;\n }\n if (semver.satisfies(otherDep.version, currentDep.policy)) {\n return;\n }\n }\n\n const currentVer = currentDep.policy || currentDep.version;\n const otherVer = otherDep.policy || otherDep.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseVer = baseDep?.policy || baseDep?.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n const currentId = currentDep.id;\n if (currentDep.__type === 'component' && this.isIdInWorkspaceOrOtherLane(currentId, otherDep.version)) {\n // dependencies that exist in the workspace, should be ignored. they'll be resolved later to the version in the ws.\n return;\n }\n const depType = lifecycleToDepType[currentDep.lifecycle];\n if (hasConfigForDep(depType, currentDep.id)) {\n return; // there is already config for it.\n }\n if (baseVer && baseVer === currentVer) {\n addSerializedDepToPolicy(otherDep);\n return;\n }\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: getDepIdAsPkgName(currentDep),\n version: `${conflictIndicator}${currentVer}::${otherVer}::`,\n force: false,\n });\n });\n\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {\n if (!mergedPolicy[depType].length) delete mergedPolicy[depType];\n if (!conflictedPolicy[depType].length) delete conflictedPolicy[depType];\n });\n\n const config = Object.keys(mergedPolicy).length ? { policy: mergedPolicy } : undefined;\n const conflict = hasConflict ? conflictedPolicy : undefined;\n\n this.logger.debug('final mergedConfig', config);\n this.logger.debug('final conflict', conflict);\n\n return { id: params.id, mergedConfig: config, conflict };\n }\n\n private isIdInWorkspaceOrOtherLane(id: string, versionOnOtherLane?: string): boolean {\n return Boolean(this.getIdFromWorkspace(id)) || this.otherLaneIdsStr.includes(`${id}@${versionOnOtherLane}`);\n }\n\n private getIdFromWorkspace(id: string): ComponentID | undefined {\n return this.workspaceIds.find((c) => c.toStringWithoutVersion() === id);\n }\n\n private isEnv(id: string) {\n return id === this.currentEnv.id || id === this.otherEnv.id;\n }\n\n private getConfig(ext: ExtensionDataEntry): GenericConfigOrRemoved {\n if (ext.rawConfig === '-') return ext.rawConfig;\n return omit(ext.rawConfig, ['__specific']);\n }\n\n private getPolicy(config): VariantPolicyEntry[] {\n if (!config.policy) return [];\n return VariantPolicy.fromConfigObject(config.policy).entries;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,oBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,mBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA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AAC6B,MAAM,EAAE,OAAO,EAAE;IAC7B,OAAOuE,mCAAa,CAACC,gBAAgB,CAACrG,MAAM,CAAC6B,MAAM,CAAC,CAACyE,OAAO;EAC9D;AACF;AAAC5J,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
|
package/dist/merge-cmd.js
CHANGED
|
@@ -144,7 +144,7 @@ function mergeReport({
|
|
|
144
144
|
once ready, snap/tag the components to complete the merge.`;
|
|
145
145
|
return _chalk().default.underline(title) + conflictSummaryReport(components) + _chalk().default.yellow(suggestion);
|
|
146
146
|
};
|
|
147
|
-
const configMergeWithConflicts =
|
|
147
|
+
const configMergeWithConflicts = configMergeResults?.filter(c => c.hasConflicts()) || [];
|
|
148
148
|
const getConfigMergeConflictSummary = () => {
|
|
149
149
|
if (!configMergeWithConflicts.length) return '';
|
|
150
150
|
const comps = configMergeWithConflicts.map(c => c.compIdStr).join('\n');
|
|
@@ -202,17 +202,17 @@ ${mergeSnapError.message}
|
|
|
202
202
|
return `\n${_chalk().default.underline(title)}\n${body}\n\n`;
|
|
203
203
|
};
|
|
204
204
|
const getSummary = () => {
|
|
205
|
-
const merged =
|
|
206
|
-
const unchangedLegitimately =
|
|
207
|
-
const failedToMerge =
|
|
208
|
-
const autoSnapped = (
|
|
205
|
+
const merged = components?.length || 0;
|
|
206
|
+
const unchangedLegitimately = failedComponents?.filter(f => f.unchangedLegitimately).length || 0;
|
|
207
|
+
const failedToMerge = failedComponents?.filter(f => !f.unchangedLegitimately).length || 0;
|
|
208
|
+
const autoSnapped = (mergeSnapResults?.snappedComponents.length || 0) + (mergeSnapResults?.autoSnappedResults.length || 0);
|
|
209
209
|
const newLines = '\n\n';
|
|
210
210
|
const title = _chalk().default.bold.underline('Merge Summary');
|
|
211
211
|
const mergedStr = `\nTotal Merged: ${_chalk().default.bold(merged.toString())}`;
|
|
212
212
|
const unchangedLegitimatelyStr = `\nTotal Unchanged: ${_chalk().default.bold(unchangedLegitimately.toString())}`;
|
|
213
213
|
const failedToMergeStr = `\nTotal Failed: ${_chalk().default.bold(failedToMerge.toString())}`;
|
|
214
214
|
const autoSnappedStr = `\nTotal Snapped: ${_chalk().default.bold(autoSnapped.toString())}`;
|
|
215
|
-
const removedStr = `\nTotal Removed: ${_chalk().default.bold(
|
|
215
|
+
const removedStr = `\nTotal Removed: ${_chalk().default.bold(removedComponents?.length.toString() || '0')}`;
|
|
216
216
|
return newLines + title + mergedStr + unchangedLegitimatelyStr + failedToMergeStr + autoSnappedStr + removedStr;
|
|
217
217
|
};
|
|
218
218
|
return getSuccessOutput() + getFailureOutput() + getRemovedOutput(removedComponents) + getSnapsOutput() + getWorkspaceDepsOutput() + getConfigMergeConflictSummary() + getConflictSummary() + getSummary();
|
|
@@ -269,13 +269,13 @@ function compilationErrorOutput(compilationError) {
|
|
|
269
269
|
return `\n\n${title}\n${subTitle}\n${body}`;
|
|
270
270
|
}
|
|
271
271
|
function getRemovedOutput(removedComponents) {
|
|
272
|
-
if (!
|
|
272
|
+
if (!removedComponents?.length) return '';
|
|
273
273
|
const title = `the following ${removedComponents.length} component(s) have been removed`;
|
|
274
274
|
const body = removedComponents.join('\n');
|
|
275
275
|
return `\n\n${_chalk().default.underline(title)}\n${body}\n\n`;
|
|
276
276
|
}
|
|
277
277
|
function getAddedOutput(addedComponents) {
|
|
278
|
-
if (!
|
|
278
|
+
if (!addedComponents?.length) return '';
|
|
279
279
|
const title = `the following ${addedComponents.length} component(s) have been added`;
|
|
280
280
|
const body = addedComponents.join('\n');
|
|
281
281
|
return `\n\n${_chalk().default.underline(title)}\n${body}\n\n`;
|
package/dist/merge-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_constants","_mergeVersion","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","MergeCmd","constructor","merging","globalConfig","WILDCARD_HELP","report","ids","ours","theirs","manual","autoMergeResolve","abort","resolve","build","noSnap","verbose","message","skipDependencyInstallation","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","BitError","components","failedComponents","version","resolvedComponents","abortedComponents","mergeSnapResults","mergeSnapError","merge","title","componentsStr","map","c","id","toStringWithoutVersion","join","chalk","underline","green","mergeReport","exports","removedComponents","leftUnresolvedConflicts","configMergeResults","workspaceDepsUpdates","getSuccessOutput","length","bold","fileChangesReport","applyVersionReport","getConflictSummary","suggestion","conflictSummaryReport","yellow","configMergeWithConflicts","filter","hasConflicts","getConfigMergeConflictSummary","comps","compIdStr","MergeConfigFilename","getSnapsOutput","snappedComponents","autoSnappedResults","outputComponents","component","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutVersion","autoTagComp","a","AUTO_SNAPPED_MSG","getWorkspaceDepsOutput","body","keys","pkgName","from","to","getFailureOutput","compact","failedComponent","unchangedLegitimately","color","unchangedMessage","getSummary","merged","f","failedToMerge","autoSnapped","newLines","mergedStr","unchangedLegitimatelyStr","failedToMergeStr","autoSnappedStr","removedStr","getRemovedOutput","addName","showVersion","tab","fileChanges","name","files","filesStatus","file","FileStatus","unchanged","note","white","cyan","FILE_CHANGES_CHECKOUT_MSG","installationErrorOutput","installationError","subTitle","red","compilationErrorOutput","compilationError","getAddedOutput","addedComponents"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentID } from '@teambit/component-id';\nimport { compact } from 'lodash';\nimport {\n WILDCARD_HELP,\n AUTO_SNAPPED_MSG,\n MergeConfigFilename,\n FILE_CHANGES_CHECKOUT_MSG,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy/dist/constants';\nimport {\n FileStatus,\n ApplyVersionResult,\n MergeStrategy,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { BitError } from '@teambit/bit-error';\nimport { ApplyVersionResults, MergingMain } from './merging.main.runtime';\nimport { ConfigMergeResult } from './config-merge-result';\n\nexport class MergeCmd implements Command {\n name = 'merge [ids...]';\n description = 'merge changes of the remote head into local - auto-snaps all merged components';\n helpUrl = 'reference/components/merging-changes';\n group = 'development';\n extendedDescription = `merge changes of the remote head into local when they are diverged. when on a lane, merge the remote head of the lane into the local\nand creates snaps for merged components that have diverged, on the lane.\nif no ids are specified, all pending-merge components will be merged. (run \"bit status\" to list them).\noptionally use '--abort' to revert the last merge. to revert a lane merge, use \"bit lane merge-abort\" command.\n${WILDCARD_HELP('merge')}`;\n alias = '';\n options = [\n ['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep the local modification'],\n [\n '',\n 'theirs',\n 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override the local modification with the specified version',\n ],\n ['', 'manual', 'DEPRECATED. use --auto-merge-resolve'],\n [\n '',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of a conflict, resolve according to the strategy: [ours, theirs, manual]',\n ],\n ['', 'abort', 'in case of an unresolved merge, revert to pre-merge state'],\n ['', 'resolve', 'mark an unresolved merge as resolved and create a new snap with the changes'],\n ['', 'no-snap', 'do not auto snap even if the merge completed without conflicts'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['', 'verbose', 'show details of components that were not merged successfully'],\n ['x', 'skip-dependency-installation', 'do not install new dependencies resulting from the merge'],\n ['m', 'message <message>', 'override the default message for the auto snap'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private merging: MergingMain, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [ids = []]: [string[]],\n {\n ours = false,\n theirs = false,\n manual = false,\n autoMergeResolve,\n abort = false,\n resolve = false,\n build = false,\n noSnap = false,\n verbose = false,\n message,\n skipDependencyInstallation = false,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n autoMergeResolve?: MergeStrategy;\n abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n verbose?: boolean;\n message: string;\n skipDependencyInstallation?: boolean;\n }\n ) {\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n if (ours || theirs || manual) {\n throw new BitError(\n 'the \"--ours\", \"--theirs\" and \"--manual\" flags are deprecated. use \"--auto-merge-resolve\" instead'\n );\n }\n if (\n autoMergeResolve &&\n autoMergeResolve !== 'ours' &&\n autoMergeResolve !== 'theirs' &&\n autoMergeResolve !== 'manual'\n ) {\n throw new BitError('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');\n }\n if (abort && resolve) throw new BitError('unable to use \"abort\" and \"resolve\" flags together');\n if (noSnap && message) throw new BitError('unable to use \"noSnap\" and \"message\" flags together');\n const {\n components,\n failedComponents,\n version,\n resolvedComponents,\n abortedComponents,\n mergeSnapResults,\n mergeSnapError,\n }: ApplyVersionResults = await this.merging.merge(\n ids,\n autoMergeResolve as any,\n abort,\n resolve,\n noSnap,\n message,\n build,\n skipDependencyInstallation\n );\n if (resolvedComponents) {\n const title = 'successfully resolved component(s)\\n';\n const componentsStr = resolvedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n if (abortedComponents) {\n const title = 'successfully aborted the merge of the following component(s)\\n';\n const componentsStr = abortedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n\n return mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n verbose,\n });\n }\n}\n\nexport function mergeReport({\n components,\n failedComponents,\n removedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n leftUnresolvedConflicts,\n verbose,\n configMergeResults,\n workspaceDepsUpdates,\n}: ApplyVersionResults & { configMergeResults?: ConfigMergeResult[] }): string {\n const getSuccessOutput = () => {\n if (!components || !components.length) return '';\n const title = `successfully merged ${components.length} components${\n version ? `from version ${chalk.bold(version)}` : ''\n }\\n`;\n const fileChangesReport = applyVersionReport(components);\n\n return chalk.bold(title) + fileChangesReport;\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\\nmerge process not completed due to the conflicts above. fix conflicts manually and then run \"bit install\".\nonce ready, snap/tag the components to complete the merge.`;\n return chalk.underline(title) + conflictSummaryReport(components) + chalk.yellow(suggestion);\n };\n\n const configMergeWithConflicts = configMergeResults?.filter((c) => c.hasConflicts()) || [];\n const getConfigMergeConflictSummary = () => {\n if (!configMergeWithConflicts.length) return '';\n const comps = configMergeWithConflicts.map((c) => c.compIdStr).join('\\n');\n const title = `\\n\\ncomponents with config-merge conflicts\\n`;\n const suggestion = `\\nconflicts were found while trying to merge the config. fix them manually by editing the ${MergeConfigFilename} file in the workspace root.\nonce ready, snap/tag the components to complete the merge.`;\n return chalk.underline(title) + comps + chalk.yellow(suggestion);\n };\n\n const getSnapsOutput = () => {\n if (mergeSnapError) {\n return `\n${chalk.bold('snapping merged components failed with the following error, please fix the issues and snap manually')}\n${mergeSnapError.message}\n`;\n }\n if (!mergeSnapResults || !mergeSnapResults.snappedComponents) return '';\n const { snappedComponents, autoSnappedResults } = mergeSnapResults;\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoSnappedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_SNAPPED_MSG}: ${autoTagComp.join(', ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n return `\\n${chalk.underline(\n 'merge-snapped components'\n )}\\n(${'components snapped as a result of the merge'})\\n${outputComponents(snappedComponents)}\\n`;\n };\n\n const getWorkspaceDepsOutput = () => {\n if (!workspaceDepsUpdates) return '';\n\n const title = '\\nworkspace.jsonc has been updated with the following dependencies';\n const body = Object.keys(workspaceDepsUpdates)\n .map((pkgName) => {\n const [from, to] = workspaceDepsUpdates[pkgName];\n return ` ${pkgName}: ${from} => ${to}`;\n })\n .join('\\n');\n\n return `\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n };\n\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = '\\nmerge skipped for the following component(s)';\n const body = compact(\n failedComponents.map((failedComponent) => {\n if (!verbose && failedComponent.unchangedLegitimately) return null;\n const color = failedComponent.unchangedLegitimately ? 'white' : 'red';\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk[color](failedComponent.unchangedMessage)}`;\n })\n ).join('\\n');\n if (!body) {\n return `${chalk.bold(`\\nmerge skipped legitimately for ${failedComponents.length} component(s)`)}\n(use --verbose to list them next time)`;\n }\n return `\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n };\n\n const getSummary = () => {\n const merged = components?.length || 0;\n const unchangedLegitimately = failedComponents?.filter((f) => f.unchangedLegitimately).length || 0;\n const failedToMerge = failedComponents?.filter((f) => !f.unchangedLegitimately).length || 0;\n const autoSnapped =\n (mergeSnapResults?.snappedComponents.length || 0) + (mergeSnapResults?.autoSnappedResults.length || 0);\n\n const newLines = '\\n\\n';\n const title = chalk.bold.underline('Merge Summary');\n const mergedStr = `\\nTotal Merged: ${chalk.bold(merged.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(unchangedLegitimately.toString())}`;\n const failedToMergeStr = `\\nTotal Failed: ${chalk.bold(failedToMerge.toString())}`;\n const autoSnappedStr = `\\nTotal Snapped: ${chalk.bold(autoSnapped.toString())}`;\n const removedStr = `\\nTotal Removed: ${chalk.bold(removedComponents?.length.toString() || '0')}`;\n\n return newLines + title + mergedStr + unchangedLegitimatelyStr + failedToMergeStr + autoSnappedStr + removedStr;\n };\n\n return (\n getSuccessOutput() +\n getFailureOutput() +\n getRemovedOutput(removedComponents) +\n getSnapsOutput() +\n getWorkspaceDepsOutput() +\n getConfigMergeConflictSummary() +\n getConflictSummary() +\n getSummary()\n );\n}\n\n/**\n * shows only the file-changes section.\n * if all files are \"unchanged\", it returns an empty string\n */\nexport function applyVersionReport(components: ApplyVersionResult[], addName = true, showVersion = false): string {\n const tab = addName ? '\\t' : '';\n const fileChanges = compact(\n components.map((component: ApplyVersionResult) => {\n const name = showVersion ? component.id.toString() : component.id.toStringWithoutVersion();\n const files = compact(\n Object.keys(component.filesStatus).map((file) => {\n if (component.filesStatus[file] === FileStatus.unchanged) return null;\n const note =\n component.filesStatus[file] === FileStatus.manual\n ? chalk.white('automatic merge failed. please fix conflicts manually and then run \"bit install\"')\n : '';\n return `${tab}${component.filesStatus[file]} ${chalk.bold(file)} ${note}`;\n })\n ).join('\\n');\n if (!files) return null;\n return `${addName ? name : ''}\\n${chalk.cyan(files)}`;\n })\n ).join('\\n\\n');\n if (!fileChanges) {\n return '';\n }\n const title = `\\n${FILE_CHANGES_CHECKOUT_MSG}\\n`;\n return chalk.underline(title) + fileChanges;\n}\n\nexport function conflictSummaryReport(components: ApplyVersionResult[]): string {\n const tab = '\\t';\n return compact(\n components.map((component: ApplyVersionResult) => {\n const name = component.id.toStringWithoutVersion();\n const files = compact(\n Object.keys(component.filesStatus).map((file) => {\n if (component.filesStatus[file] === FileStatus.manual) {\n return `${tab}${component.filesStatus[file]} ${chalk.bold(file)}`;\n }\n return null;\n })\n );\n if (!files.length) return null;\n\n return `${name}\\n${chalk.cyan(files.join('\\n'))}`;\n })\n ).join('\\n');\n}\n\nexport function installationErrorOutput(installationError?: Error) {\n if (!installationError) return '';\n const title = chalk.underline('Installation Error');\n const subTitle = 'The following error was thrown by the package manager, please fix the issue and run \"bit install\"';\n const body = chalk.red(installationError.message);\n return `\\n\\n${title}\\n${subTitle}\\n${body}`;\n}\n\nexport function compilationErrorOutput(compilationError?: Error) {\n if (!compilationError) return '';\n const title = chalk.underline('Compilation Error');\n const subTitle = 'The following error was thrown by the compiler, please fix the issue and run \"bit compile\"';\n const body = chalk.red(compilationError.message);\n return `\\n\\n${title}\\n${subTitle}\\n${body}`;\n}\n\nexport function getRemovedOutput(removedComponents?: ComponentID[]) {\n if (!removedComponents?.length) return '';\n const title = `the following ${removedComponents.length} component(s) have been removed`;\n const body = removedComponents.join('\\n');\n return `\\n\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n}\n\nexport function getAddedOutput(addedComponents?: ComponentID[]) {\n if (!addedComponents?.length) return '';\n const title = `the following ${addedComponents.length} component(s) have been added`;\n const body = addedComponents.join('\\n');\n return `\\n\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAA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AC7C;AAEO,SAASsB,gBAAgBA,CAACzD,iBAAiC,EAAE;EAClE,IAAI,EAACA,iBAAiB,aAAjBA,iBAAiB,eAAjBA,iBAAiB,CAAEK,MAAM,GAAE,OAAO,EAAE;EACzC,MAAMjB,KAAK,GAAI,iBAAgBY,iBAAiB,CAACK,MAAO,iCAAgC;EACxF,MAAM8B,IAAI,GAAGnC,iBAAiB,CAACN,IAAI,CAAC,IAAI,CAAC;EACzC,OAAQ,OAAMC,gBAAK,CAACC,SAAS,CAACR,KAAK,CAAE,KAAI+C,IAAK,MAAK;AACrD;AAEO,SAAS2C,cAAcA,CAACC,eAA+B,EAAE;EAC9D,IAAI,EAACA,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAE1E,MAAM,GAAE,OAAO,EAAE;EACvC,MAAMjB,KAAK,GAAI,iBAAgB2F,eAAe,CAAC1E,MAAO,+BAA8B;EACpF,MAAM8B,IAAI,GAAG4C,eAAe,CAACrF,IAAI,CAAC,IAAI,CAAC;EACvC,OAAQ,OAAMC,gBAAK,CAACC,SAAS,CAACR,KAAK,CAAE,KAAI+C,IAAK,MAAK;AACrD"}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","_constants","_mergeVersion","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","MergeCmd","constructor","merging","globalConfig","WILDCARD_HELP","report","ids","ours","theirs","manual","autoMergeResolve","abort","resolve","build","noSnap","verbose","message","skipDependencyInstallation","getBool","CFG_FORCE_LOCAL_BUILD","Boolean","BitError","components","failedComponents","version","resolvedComponents","abortedComponents","mergeSnapResults","mergeSnapError","merge","title","componentsStr","map","c","id","toStringWithoutVersion","join","chalk","underline","green","mergeReport","exports","removedComponents","leftUnresolvedConflicts","configMergeResults","workspaceDepsUpdates","getSuccessOutput","length","bold","fileChangesReport","applyVersionReport","getConflictSummary","suggestion","conflictSummaryReport","yellow","configMergeWithConflicts","filter","hasConflicts","getConfigMergeConflictSummary","comps","compIdStr","MergeConfigFilename","getSnapsOutput","snappedComponents","autoSnappedResults","outputComponents","component","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutVersion","autoTagComp","a","AUTO_SNAPPED_MSG","getWorkspaceDepsOutput","body","keys","pkgName","from","to","getFailureOutput","compact","failedComponent","unchangedLegitimately","color","unchangedMessage","getSummary","merged","f","failedToMerge","autoSnapped","newLines","mergedStr","unchangedLegitimatelyStr","failedToMergeStr","autoSnappedStr","removedStr","getRemovedOutput","addName","showVersion","tab","fileChanges","name","files","filesStatus","file","FileStatus","unchanged","note","white","cyan","FILE_CHANGES_CHECKOUT_MSG","installationErrorOutput","installationError","subTitle","red","compilationErrorOutput","compilationError","getAddedOutput","addedComponents"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentID } from '@teambit/component-id';\nimport { compact } from 'lodash';\nimport {\n WILDCARD_HELP,\n AUTO_SNAPPED_MSG,\n MergeConfigFilename,\n FILE_CHANGES_CHECKOUT_MSG,\n CFG_FORCE_LOCAL_BUILD,\n} from '@teambit/legacy/dist/constants';\nimport {\n FileStatus,\n ApplyVersionResult,\n MergeStrategy,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { BitError } from '@teambit/bit-error';\nimport { ApplyVersionResults, MergingMain } from './merging.main.runtime';\nimport { ConfigMergeResult } from './config-merge-result';\n\nexport class MergeCmd implements Command {\n name = 'merge [ids...]';\n description = 'merge changes of the remote head into local - auto-snaps all merged components';\n helpUrl = 'reference/components/merging-changes';\n group = 'development';\n extendedDescription = `merge changes of the remote head into local when they are diverged. when on a lane, merge the remote head of the lane into the local\nand creates snaps for merged components that have diverged, on the lane.\nif no ids are specified, all pending-merge components will be merged. (run \"bit status\" to list them).\noptionally use '--abort' to revert the last merge. to revert a lane merge, use \"bit lane merge-abort\" command.\n${WILDCARD_HELP('merge')}`;\n alias = '';\n options = [\n ['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep the local modification'],\n [\n '',\n 'theirs',\n 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override the local modification with the specified version',\n ],\n ['', 'manual', 'DEPRECATED. use --auto-merge-resolve'],\n [\n '',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of a conflict, resolve according to the strategy: [ours, theirs, manual]',\n ],\n ['', 'abort', 'in case of an unresolved merge, revert to pre-merge state'],\n ['', 'resolve', 'mark an unresolved merge as resolved and create a new snap with the changes'],\n ['', 'no-snap', 'do not auto snap even if the merge completed without conflicts'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['', 'verbose', 'show details of components that were not merged successfully'],\n ['x', 'skip-dependency-installation', 'do not install new dependencies resulting from the merge'],\n ['m', 'message <message>', 'override the default message for the auto snap'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private merging: MergingMain, private globalConfig: GlobalConfigMain) {}\n\n async report(\n [ids = []]: [string[]],\n {\n ours = false,\n theirs = false,\n manual = false,\n autoMergeResolve,\n abort = false,\n resolve = false,\n build = false,\n noSnap = false,\n verbose = false,\n message,\n skipDependencyInstallation = false,\n }: {\n ours?: boolean;\n theirs?: boolean;\n manual?: boolean;\n autoMergeResolve?: MergeStrategy;\n abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n verbose?: boolean;\n message: string;\n skipDependencyInstallation?: boolean;\n }\n ) {\n build = (await this.globalConfig.getBool(CFG_FORCE_LOCAL_BUILD)) || Boolean(build);\n if (ours || theirs || manual) {\n throw new BitError(\n 'the \"--ours\", \"--theirs\" and \"--manual\" flags are deprecated. use \"--auto-merge-resolve\" instead'\n );\n }\n if (\n autoMergeResolve &&\n autoMergeResolve !== 'ours' &&\n autoMergeResolve !== 'theirs' &&\n autoMergeResolve !== 'manual'\n ) {\n throw new BitError('--auto-merge-resolve must be one of the following: [ours, theirs, manual]');\n }\n if (abort && resolve) throw new BitError('unable to use \"abort\" and \"resolve\" flags together');\n if (noSnap && message) throw new BitError('unable to use \"noSnap\" and \"message\" flags together');\n const {\n components,\n failedComponents,\n version,\n resolvedComponents,\n abortedComponents,\n mergeSnapResults,\n mergeSnapError,\n }: ApplyVersionResults = await this.merging.merge(\n ids,\n autoMergeResolve as any,\n abort,\n resolve,\n noSnap,\n message,\n build,\n skipDependencyInstallation\n );\n if (resolvedComponents) {\n const title = 'successfully resolved component(s)\\n';\n const componentsStr = resolvedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n if (abortedComponents) {\n const title = 'successfully aborted the merge of the following component(s)\\n';\n const componentsStr = abortedComponents.map((c) => c.id.toStringWithoutVersion()).join('\\n');\n return chalk.underline(title) + chalk.green(componentsStr);\n }\n\n return mergeReport({\n components,\n failedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n verbose,\n });\n }\n}\n\nexport function mergeReport({\n components,\n failedComponents,\n removedComponents,\n version,\n mergeSnapResults,\n mergeSnapError,\n leftUnresolvedConflicts,\n verbose,\n configMergeResults,\n workspaceDepsUpdates,\n}: ApplyVersionResults & { configMergeResults?: ConfigMergeResult[] }): string {\n const getSuccessOutput = () => {\n if (!components || !components.length) return '';\n const title = `successfully merged ${components.length} components${\n version ? `from version ${chalk.bold(version)}` : ''\n }\\n`;\n const fileChangesReport = applyVersionReport(components);\n\n return chalk.bold(title) + fileChangesReport;\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\\nmerge process not completed due to the conflicts above. fix conflicts manually and then run \"bit install\".\nonce ready, snap/tag the components to complete the merge.`;\n return chalk.underline(title) + conflictSummaryReport(components) + chalk.yellow(suggestion);\n };\n\n const configMergeWithConflicts = configMergeResults?.filter((c) => c.hasConflicts()) || [];\n const getConfigMergeConflictSummary = () => {\n if (!configMergeWithConflicts.length) return '';\n const comps = configMergeWithConflicts.map((c) => c.compIdStr).join('\\n');\n const title = `\\n\\ncomponents with config-merge conflicts\\n`;\n const suggestion = `\\nconflicts were found while trying to merge the config. fix them manually by editing the ${MergeConfigFilename} file in the workspace root.\nonce ready, snap/tag the components to complete the merge.`;\n return chalk.underline(title) + comps + chalk.yellow(suggestion);\n };\n\n const getSnapsOutput = () => {\n if (mergeSnapError) {\n return `\n${chalk.bold('snapping merged components failed with the following error, please fix the issues and snap manually')}\n${mergeSnapError.message}\n`;\n }\n if (!mergeSnapResults || !mergeSnapResults.snappedComponents) return '';\n const { snappedComponents, autoSnappedResults } = mergeSnapResults;\n const outputComponents = (comps) => {\n return comps\n .map((component) => {\n let componentOutput = ` > ${component.id.toString()}`;\n const autoTag = autoSnappedResults.filter((result) => result.triggeredBy.searchWithoutVersion(component.id));\n if (autoTag.length) {\n const autoTagComp = autoTag.map((a) => a.component.id.toString());\n componentOutput += `\\n ${AUTO_SNAPPED_MSG}: ${autoTagComp.join(', ')}`;\n }\n return componentOutput;\n })\n .join('\\n');\n };\n\n return `\\n${chalk.underline(\n 'merge-snapped components'\n )}\\n(${'components snapped as a result of the merge'})\\n${outputComponents(snappedComponents)}\\n`;\n };\n\n const getWorkspaceDepsOutput = () => {\n if (!workspaceDepsUpdates) return '';\n\n const title = '\\nworkspace.jsonc has been updated with the following dependencies';\n const body = Object.keys(workspaceDepsUpdates)\n .map((pkgName) => {\n const [from, to] = workspaceDepsUpdates[pkgName];\n return ` ${pkgName}: ${from} => ${to}`;\n })\n .join('\\n');\n\n return `\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n };\n\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = '\\nmerge skipped for the following component(s)';\n const body = compact(\n failedComponents.map((failedComponent) => {\n if (!verbose && failedComponent.unchangedLegitimately) return null;\n const color = failedComponent.unchangedLegitimately ? 'white' : 'red';\n return `${chalk.bold(failedComponent.id.toString())} - ${chalk[color](failedComponent.unchangedMessage)}`;\n })\n ).join('\\n');\n if (!body) {\n return `${chalk.bold(`\\nmerge skipped legitimately for ${failedComponents.length} component(s)`)}\n(use --verbose to list them next time)`;\n }\n return `\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n };\n\n const getSummary = () => {\n const merged = components?.length || 0;\n const unchangedLegitimately = failedComponents?.filter((f) => f.unchangedLegitimately).length || 0;\n const failedToMerge = failedComponents?.filter((f) => !f.unchangedLegitimately).length || 0;\n const autoSnapped =\n (mergeSnapResults?.snappedComponents.length || 0) + (mergeSnapResults?.autoSnappedResults.length || 0);\n\n const newLines = '\\n\\n';\n const title = chalk.bold.underline('Merge Summary');\n const mergedStr = `\\nTotal Merged: ${chalk.bold(merged.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(unchangedLegitimately.toString())}`;\n const failedToMergeStr = `\\nTotal Failed: ${chalk.bold(failedToMerge.toString())}`;\n const autoSnappedStr = `\\nTotal Snapped: ${chalk.bold(autoSnapped.toString())}`;\n const removedStr = `\\nTotal Removed: ${chalk.bold(removedComponents?.length.toString() || '0')}`;\n\n return newLines + title + mergedStr + unchangedLegitimatelyStr + failedToMergeStr + autoSnappedStr + removedStr;\n };\n\n return (\n getSuccessOutput() +\n getFailureOutput() +\n getRemovedOutput(removedComponents) +\n getSnapsOutput() +\n getWorkspaceDepsOutput() +\n getConfigMergeConflictSummary() +\n getConflictSummary() +\n getSummary()\n );\n}\n\n/**\n * shows only the file-changes section.\n * if all files are \"unchanged\", it returns an empty string\n */\nexport function applyVersionReport(components: ApplyVersionResult[], addName = true, showVersion = false): string {\n const tab = addName ? '\\t' : '';\n const fileChanges = compact(\n components.map((component: ApplyVersionResult) => {\n const name = showVersion ? component.id.toString() : component.id.toStringWithoutVersion();\n const files = compact(\n Object.keys(component.filesStatus).map((file) => {\n if (component.filesStatus[file] === FileStatus.unchanged) return null;\n const note =\n component.filesStatus[file] === FileStatus.manual\n ? chalk.white('automatic merge failed. please fix conflicts manually and then run \"bit install\"')\n : '';\n return `${tab}${component.filesStatus[file]} ${chalk.bold(file)} ${note}`;\n })\n ).join('\\n');\n if (!files) return null;\n return `${addName ? name : ''}\\n${chalk.cyan(files)}`;\n })\n ).join('\\n\\n');\n if (!fileChanges) {\n return '';\n }\n const title = `\\n${FILE_CHANGES_CHECKOUT_MSG}\\n`;\n return chalk.underline(title) + fileChanges;\n}\n\nexport function conflictSummaryReport(components: ApplyVersionResult[]): string {\n const tab = '\\t';\n return compact(\n components.map((component: ApplyVersionResult) => {\n const name = component.id.toStringWithoutVersion();\n const files = compact(\n Object.keys(component.filesStatus).map((file) => {\n if (component.filesStatus[file] === FileStatus.manual) {\n return `${tab}${component.filesStatus[file]} ${chalk.bold(file)}`;\n }\n return null;\n })\n );\n if (!files.length) return null;\n\n return `${name}\\n${chalk.cyan(files.join('\\n'))}`;\n })\n ).join('\\n');\n}\n\nexport function installationErrorOutput(installationError?: Error) {\n if (!installationError) return '';\n const title = chalk.underline('Installation Error');\n const subTitle = 'The following error was thrown by the package manager, please fix the issue and run \"bit install\"';\n const body = chalk.red(installationError.message);\n return `\\n\\n${title}\\n${subTitle}\\n${body}`;\n}\n\nexport function compilationErrorOutput(compilationError?: Error) {\n if (!compilationError) return '';\n const title = chalk.underline('Compilation Error');\n const subTitle = 'The following error was thrown by the compiler, please fix the issue and run \"bit compile\"';\n const body = chalk.red(compilationError.message);\n return `\\n\\n${title}\\n${subTitle}\\n${body}`;\n}\n\nexport function getRemovedOutput(removedComponents?: ComponentID[]) {\n if (!removedComponents?.length) return '';\n const title = `the following ${removedComponents.length} component(s) have been removed`;\n const body = removedComponents.join('\\n');\n return `\\n\\n${chalk.underline(title)}\\n${body}\\n\\n`;\n}\n\nexport function getAddedOutput(addedComponents?: ComponentID[]) {\n if (!addedComponents?.length) return '';\n const title = `the following ${addedComponents.length} component(s) have been added`;\n const body = addedComponents.join('\\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ACR,KAAK,CAAE,KAAI+C,IAAK,MAAK;AACrD"}
|
|
@@ -5,7 +5,7 @@ import { Lane } from '@teambit/legacy/dist/scope/models';
|
|
|
5
5
|
import { ImporterMain } from '@teambit/importer';
|
|
6
6
|
import { Logger } from '@teambit/logger';
|
|
7
7
|
import { ComponentMergeStatus } from './merging.main.runtime';
|
|
8
|
-
export
|
|
8
|
+
export type MergeStatusProviderOptions = {
|
|
9
9
|
resolveUnrelated?: MergeStrategy;
|
|
10
10
|
ignoreConfigChanges?: boolean;
|
|
11
11
|
shouldSquash?: boolean;
|
|
@@ -17,9 +17,9 @@ export declare class MergeStatusProvider {
|
|
|
17
17
|
private currentLane?;
|
|
18
18
|
private otherLane?;
|
|
19
19
|
private options?;
|
|
20
|
-
constructor(workspace: Workspace, logger: Logger, importer: ImporterMain, currentLane?: Lane
|
|
21
|
-
otherLane?: Lane
|
|
22
|
-
options?: MergeStatusProviderOptions
|
|
20
|
+
constructor(workspace: Workspace, logger: Logger, importer: ImporterMain, currentLane?: Lane, // currently checked out lane. if on main, then it's undefined.
|
|
21
|
+
otherLane?: Lane, // the lane we want to merged to our lane. (undefined if it's "main").
|
|
22
|
+
options?: MergeStatusProviderOptions);
|
|
23
23
|
getStatus(bitIds: ComponentID[]): Promise<ComponentMergeStatus[]>;
|
|
24
24
|
private getComponentMergeStatus;
|
|
25
25
|
private returnUnmerged;
|