@teambit/merging 0.0.252 → 0.0.254

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.
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ConfigMerger","constructor","compIdStr","workspaceIds","currentAspects","baseAspects","otherAspects","currentLabel","otherLabel","merge","populateEnvs","results","map","currentExt","id","stringId","handledExtIds","includes","push","baseExt","findExtension","otherExt","mergePerStrategy","basicConflictGenerator","currentConfig","getConfig","otherConfig","otherAspectsNotHandledResults","mergedConfig","envResult","envStrategy","ConfigMergeResult","compact","getEnvId","ext","envsAspect","findCoreExtension","EnvsAspect","Error","env","config","data","currentEnv","otherEnv","baseEnv","undefined","currentEnvAspect","version","extensionId","rawConfig","otherEnvAspect","baseEnvAspect","mergeStrategyParams","baseConfig","isIdInWorkspace","basicConfigMerge","areConfigsEqual","configA","configB","JSON","stringify","depResolverResult","depResolverStrategy","mergeStrategyConfigParams","conflict","repeat","formatConfig","conf","confStr","confStrSplit","split","shift","pop","join","params","DependencyResolverAspect","mergedPolicy","dependencies","devDependencies","peerDependencies","conflictedPolicy","isMerged","hasConflict","conflictIndicator","nonPolicyConfigToMerged","nonPolicyConfigConflict","handleConfigMerge","allKeys","uniq","Object","keys","otherKeys","filter","key","forEach","policy","depType","depName","name","force","current","other","currentPolicy","otherPolicy","allPolicyKeys","concat","length","pkgName","currentVal","otherVal","baseVal","isEnv","lifecycleToDepType","runtime","dev","peer","hasConfigForDep","find","d","getDepIdAsPkgName","dep","__type","packageName","addSerializedDepToPolicy","lifecycle","getAutoDeps","source","idWithoutVersion","existingPolicy","p","dependencyId","getPolicyVer","value","semver","valid","startsWith","currentData","otherData","currentAndOtherData","uniqBy","baseData","depData","currentDep","otherDep","currentId","currentVer","otherVer","baseDep","baseVer","isRange","satisfies","conflictStr","mergedConfigSplit","conflictLines","line","unshift","Boolean","c","toStringWithoutVersion","omit"],"sources":["config-merger.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport semver from 'semver';\nimport { DependencyResolverAspect, isRange, SerializedDependency } from '@teambit/dependency-resolver';\nimport { EnvsAspect } from '@teambit/envs';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { compact, omit, uniq, uniqBy } from 'lodash';\nimport { ConfigMergeResult } from './config-merge-result';\n\ntype GenericConfigOrRemoved = Record<string, any> | '-';\n\ntype EnvData = { id: string; version?: string; config?: GenericConfigOrRemoved };\n\ntype SerializedDependencyWithPolicy = SerializedDependency & { policy?: string };\n\nexport type MergeStrategyResult = {\n id: string;\n mergedConfig?: GenericConfigOrRemoved;\n conflict?: string;\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[] = [];\n constructor(\n private compIdStr: string,\n private workspaceIds: ComponentID[],\n private currentAspects: ExtensionDataList,\n private baseAspects: ExtensionDataList,\n private otherAspects: ExtensionDataList,\n private currentLabel: string,\n private otherLabel: string\n ) {}\n\n merge(): ConfigMergeResult {\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 this.basicConflictGenerator({ id, 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 const id = otherExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n const baseExt = this.baseAspects.findExtension(id, true);\n if (baseExt) {\n // was removed on current\n return this.basicConflictGenerator({ id, 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 return new ConfigMergeResult(this.compIdStr, compact([...results, ...otherAspectsNotHandledResults, envResult]));\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 = currentEnvAspect.rawConfig;\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 = otherEnvAspect.rawConfig;\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 = baseEnvAspect.rawConfig;\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.isIdInWorkspace(this.currentEnv.id)) {\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 if (depResolverResult) {\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 const mergeStrategyConfigParams = { id, currentConfig, otherConfig, baseConfig };\n return this.basicConflictGenerator(mergeStrategyConfigParams);\n }\n\n private basicConflictGenerator({\n id,\n currentConfig,\n otherConfig,\n }: MergeStrategyParamsWithRemoved): MergeStrategyResult {\n // uncomment to debug\n // console.log('basicConflictGenerator', this.compIdStr, id, 'currentConfig', currentConfig, 'otherConfig', otherConfig);\n let conflict: string;\n if (currentConfig === '-') {\n conflict = `${'<'.repeat(7)} ${this.currentLabel}\n=======\n\"${id}\": ${JSON.stringify(otherConfig, undefined, 2)}\n${'>'.repeat(7)} ${this.otherLabel}`;\n } else if (otherConfig === '-') {\n conflict = `${'<'.repeat(7)} ${this.currentLabel}\n\"${id}\": ${JSON.stringify(otherConfig, undefined, 2)}\n=======\n${'>'.repeat(7)} ${this.otherLabel}`;\n } else {\n const formatConfig = (conf: GenericConfigOrRemoved) => {\n const confStr = JSON.stringify(conf, undefined, 2);\n const confStrSplit = confStr.split('\\n');\n confStrSplit.shift(); // remove first {\n confStrSplit.pop(); // remove last }\n return confStrSplit.join('\\n');\n };\n conflict = `\"${id}\": {\n${'<'.repeat(7)} ${this.currentLabel}\n${formatConfig(currentConfig)}\n=======\n${formatConfig(otherConfig)}\n${'>'.repeat(7)} ${this.otherLabel}\n}`;\n }\n\n return { id, conflict };\n }\n\n private depResolverStrategy(params: MergeStrategyParams): MergeStrategyResult | undefined {\n if (params.id !== DependencyResolverAspect.id) return undefined;\n const { currentExt, otherExt, baseExt } = params;\n\n const currentConfig = this.getConfig(currentExt);\n const otherConfig = this.getConfig(otherExt);\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n // const mergeStrategyConfigParams = { id, currentConfig, otherConfig, baseConfig };\n\n const mergedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n const conflictedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n let isMerged = false;\n let hasConflict = false;\n const conflictIndicator = 'CONFLICT::';\n const nonPolicyConfigToMerged = {};\n const nonPolicyConfigConflict = {};\n const handleConfigMerge = () => {\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 const allKeys = uniq([...Object.keys(currentConfig), ...Object.keys(otherConfig)]);\n const otherKeys = allKeys.filter((key) => key !== 'policy');\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n otherKeys.forEach((key) => {\n if (otherConfig[key]) {\n nonPolicyConfigToMerged[key] = otherConfig[key];\n }\n });\n if (otherConfig.policy) {\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {\n if (!otherConfig.policy[depType]) return;\n Object.keys(otherConfig.policy[depType]).forEach((depName) => {\n mergedPolicy[depType].push({\n name: depName,\n version: otherConfig.policy[depType][depName],\n force: true,\n });\n });\n });\n }\n isMerged = true;\n return;\n }\n\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n // we have to differentiate between a conflict in the policy, which might be merged with conflict with dependencies data.\n // and a conflict with other fields of config.\n otherKeys.forEach((key) => {\n if (JSON.stringify(currentConfig[key]) === JSON.stringify(otherConfig[key])) {\n return;\n }\n if (baseConfig && JSON.stringify(baseConfig[key]) === JSON.stringify(otherConfig[key])) {\n // was changed on current\n return;\n }\n if (baseConfig && JSON.stringify(baseConfig[key]) === JSON.stringify(currentConfig[key])) {\n // was changed on other\n nonPolicyConfigToMerged[key] = otherConfig[key];\n return;\n }\n // conflict\n nonPolicyConfigConflict[key] = { current: currentConfig[key], other: otherConfig[key] };\n });\n\n if (!currentConfig.policy && !otherConfig.policy) return;\n\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {\n const currentPolicy = currentConfig.policy?.[depType];\n const otherPolicy = otherConfig.policy?.[depType];\n const allPolicyKeys = uniq(Object.keys(currentPolicy || {}).concat(Object.keys(otherPolicy || {})));\n if (!allPolicyKeys.length) return;\n\n allPolicyKeys.forEach((pkgName) => {\n const currentVal = currentPolicy?.[pkgName];\n const otherVal = otherPolicy?.[pkgName];\n const baseVal = baseConfig !== '-' && baseConfig?.policy?.[depType]?.[pkgName];\n if (this.isEnv(pkgName)) {\n // ignore the envs\n return;\n }\n if (currentVal === otherVal) {\n // mergedPolicy[depType][pkgName] = currentVal;\n return;\n }\n if (baseVal === otherVal) {\n // mergedPolicy[depType][pkgName] = currentVal;\n return;\n }\n if (baseVal === currentVal) {\n mergedPolicy[depType].push({\n name: pkgName,\n version: otherVal,\n force: true,\n });\n isMerged = true;\n return;\n }\n // either no baseVal, or baseVal is also different from both: other and local. that's a conflict.\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: pkgName,\n version: `${conflictIndicator}${currentVal}::${otherVal}::`,\n force: true,\n });\n });\n });\n };\n\n handleConfigMerge();\n\n const lifecycleToDepType = {\n runtime: 'dependencies',\n dev: 'devDependencies',\n peer: 'peerDependencies',\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\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 isMerged = true;\n };\n\n const getAutoDeps = (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\n .filter((d) => d.source === 'auto')\n .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 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\n const currentData = getAutoDeps(this.currentAspects);\n const otherData = getAutoDeps(this.otherAspects);\n const currentAndOtherData = uniqBy(currentData.concat(otherData), (d) => d.id);\n const baseData = getAutoDeps(this.baseAspects);\n\n // uncomment to debug\n // console.log('\\n\\n**************', this.compIdStr, '**************');\n // console.log('currentData', currentData.length, '\\n', currentData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('otherData', otherData.length, '\\n', otherData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('otherData', baseData.length, '\\n', baseData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('** END **\\n\\n');\n\n currentAndOtherData.forEach((depData) => {\n if (this.isEnv(depData.id)) {\n // ignore the envs\n return;\n }\n const currentDep = currentData.find((d) => d.id === depData.id);\n const otherDep = otherData.find((d) => d.id === depData.id);\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n // only on other\n addSerializedDepToPolicy(otherDep);\n return;\n }\n const currentId = currentDep.id;\n const currentVer = currentDep.policy || currentDep.version;\n const otherVer = otherDep.policy || otherDep.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseDep = baseData.find((d) => d.id === currentId);\n const baseVer = baseDep?.policy || baseDep?.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n if (currentDep.__type === 'component' && this.isIdInWorkspace(currentId)) {\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 if (baseVer && baseVer === currentVer) {\n addSerializedDepToPolicy(otherDep);\n return;\n }\n // either no baseVal, or baseVal is also different from both: other and local. that's probably a conflict.\n const depType = lifecycleToDepType[currentDep.lifecycle];\n if (hasConfigForDep(depType, currentDep.id)) {\n return; // there is already config for it.\n }\n // try to resolve according to semver\n if (\n currentDep.policy &&\n otherDep.policy &&\n isRange(currentDep.policy, currentDep.id) &&\n isRange(otherDep.policy, otherDep.id)\n ) {\n if (semver.satisfies(currentDep.version, otherDep.policy)) {\n return;\n }\n if (semver.satisfies(otherDep.version, currentDep.policy)) {\n addSerializedDepToPolicy(otherDep);\n return;\n }\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 let conflictStr: string | undefined;\n if (hasConflict) {\n const mergedConfigSplit = JSON.stringify({ policy: conflictedPolicy }, undefined, 2).split('\\n');\n const conflictLines = mergedConfigSplit.map((line) => {\n if (!line.includes(conflictIndicator)) return line;\n const [, currentVal, otherVal] = line.split('::');\n return `${'<'.repeat(7)} ${this.currentLabel}\n \"version\": \"${currentVal}\",\n=======\n \"version\": \"${otherVal}\",\n${'>'.repeat(7)} ${this.otherLabel}`;\n });\n // replace the first line with line with the id\n conflictLines.shift();\n conflictLines.unshift(`\"${params.id}\": {`);\n conflictStr = conflictLines.join('\\n');\n }\n const config = isMerged ? { ...nonPolicyConfigToMerged, policy: mergedPolicy } : undefined;\n\n return { id: params.id, mergedConfig: config, conflict: conflictStr };\n }\n\n private isIdInWorkspace(id: string): boolean {\n return Boolean(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) {\n if (ext.rawConfig === '-') return ext.rawConfig;\n return omit(ext.rawConfig, ['__specific']);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0D;AAAA;AA0B1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAA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EAAE,GAAG,CAAC5C,MAAM,CAAC,CAAC,CAAE,IAAG,IAAI,CAACzD,UAAW,EAAC;MAC9B,CAAC,CAAC;MACF;MACAiJ,aAAa,CAAClF,KAAK,EAAE;MACrBkF,aAAa,CAACE,OAAO,CAAE,IAAGjF,MAAM,CAAC5D,EAAG,MAAK,CAAC;MAC1CyI,WAAW,GAAGE,aAAa,CAAChF,IAAI,CAAC,IAAI,CAAC;IACxC;IACA,MAAMjC,MAAM,GAAGyC,QAAQ,mCAAQG,uBAAuB;MAAEW,MAAM,EAAEnB;IAAY,KAAK/B,SAAS;IAE1F,OAAO;MAAE/B,EAAE,EAAE4D,MAAM,CAAC5D,EAAE;MAAEc,YAAY,EAAEY,MAAM;MAAEwB,QAAQ,EAAEuF;IAAY,CAAC;EACvE;EAEQjG,eAAe,CAACxC,EAAU,EAAW;IAC3C,OAAO8I,OAAO,CAAC,IAAI,CAACzJ,YAAY,CAACkH,IAAI,CAAEwC,CAAC,IAAKA,CAAC,CAACC,sBAAsB,EAAE,KAAKhJ,EAAE,CAAC,CAAC;EAClF;EAEQiG,KAAK,CAACjG,EAAU,EAAE;IACxB,OAAOA,EAAE,KAAK,IAAI,CAAC4B,UAAU,CAAC5B,EAAE,IAAIA,EAAE,KAAK,IAAI,CAAC6B,QAAQ,CAAC7B,EAAE;EAC7D;EAEQW,SAAS,CAACS,GAAuB,EAAE;IACzC,IAAIA,GAAG,CAACe,SAAS,KAAK,GAAG,EAAE,OAAOf,GAAG,CAACe,SAAS;IAC/C,OAAO,IAAA8G,cAAI,EAAC7H,GAAG,CAACe,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC;EAC5C;AACF;AAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { MergingAspect } from './merging.aspect';
2
2
  export { mergeReport } from './merge-cmd';
3
3
  export type { MergingMain, ComponentMergeStatus } from './merging.main.runtime';
4
+ export { ConfigMergeResult } from './config-merge-result';
4
5
  export default MergingAspect;
5
6
  export { MergingAspect };
package/dist/index.js CHANGED
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "ConfigMergeResult", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _configMergeResult().ConfigMergeResult;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "MergingAspect", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -30,6 +36,13 @@ function _mergeCmd() {
30
36
  };
31
37
  return data;
32
38
  }
39
+ function _configMergeResult() {
40
+ const data = require("./config-merge-result");
41
+ _configMergeResult = function () {
42
+ return data;
43
+ };
44
+ return data;
45
+ }
33
46
  var _default = _merging().MergingAspect;
34
47
  exports.default = _default;
35
48
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["MergingAspect"],"sources":["index.ts"],"sourcesContent":["import { MergingAspect } from './merging.aspect';\n\nexport { mergeReport } from './merge-cmd';\nexport type { MergingMain, ComponentMergeStatus } from './merging.main.runtime';\nexport default MergingAspect;\nexport { MergingAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0C,eAE3BA,wBAAa;AAAA"}
1
+ {"version":3,"names":["MergingAspect"],"sources":["index.ts"],"sourcesContent":["import { MergingAspect } from './merging.aspect';\n\nexport { mergeReport } from './merge-cmd';\nexport type { MergingMain, ComponentMergeStatus } from './merging.main.runtime';\nexport { ConfigMergeResult } from './config-merge-result';\nexport default MergingAspect;\nexport { MergingAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0D,eAC3CA,wBAAa;AAAA"}
@@ -1,6 +1,7 @@
1
1
  import { Command, CommandOptions } from '@teambit/cli';
2
2
  import { ApplyVersionResults } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
3
3
  import { MergingMain } from './merging.main.runtime';
4
+ import { ConfigMergeResult } from './config-merge-result';
4
5
  export declare class MergeCmd implements Command {
5
6
  private merging;
6
7
  name: string;
@@ -25,4 +26,6 @@ export declare class MergeCmd implements Command {
25
26
  skipDependencyInstallation?: boolean;
26
27
  }): Promise<string>;
27
28
  }
28
- export declare function mergeReport({ components, failedComponents, version, mergeSnapResults, mergeSnapError, leftUnresolvedConflicts, verbose, }: ApplyVersionResults): string;
29
+ export declare function mergeReport({ components, failedComponents, version, mergeSnapResults, mergeSnapError, leftUnresolvedConflicts, verbose, configMergeResults, }: ApplyVersionResults & {
30
+ configMergeResults?: ConfigMergeResult[];
31
+ }): string;
package/dist/merge-cmd.js CHANGED
@@ -125,7 +125,8 @@ function mergeReport({
125
125
  mergeSnapResults,
126
126
  mergeSnapError,
127
127
  leftUnresolvedConflicts,
128
- verbose
128
+ verbose,
129
+ configMergeResults
129
130
  }) {
130
131
  const getSuccessOutput = () => {
131
132
  if (!components || !components.length) return '';
@@ -136,11 +137,20 @@ function mergeReport({
136
137
  };
137
138
  const getConflictSummary = () => {
138
139
  if (!components || !components.length || !leftUnresolvedConflicts) return '';
139
- const title = `\nfiles with conflicts summary\n`;
140
+ const title = `\n\nfiles with conflicts summary\n`;
140
141
  const suggestion = `\n\nthe merge process wasn't completed due to the conflicts above. fix them manually and then run "bit install".
141
142
  once ready, snap/tag the components to complete the merge.`;
142
143
  return _chalk().default.underline(title) + (0, _mergeVersion().conflictSummaryReport)(components) + _chalk().default.yellow(suggestion);
143
144
  };
145
+ const configMergeWithConflicts = (configMergeResults === null || configMergeResults === void 0 ? void 0 : configMergeResults.filter(c => c.hasConflicts())) || [];
146
+ const getConfigMergeConflictSummary = () => {
147
+ if (!configMergeWithConflicts.length) return '';
148
+ const comps = configMergeWithConflicts.map(c => c.compIdStr).join('\n');
149
+ const title = `\n\ncomponents with config-merge conflicts\n`;
150
+ const suggestion = `\nconflicts were found while trying to merge the config. fix them manually by editing the ${_constants().MergeConfigFilename} file in the component's dir.
151
+ once ready, snap/tag the components to complete the merge.`;
152
+ return _chalk().default.underline(title) + comps + _chalk().default.yellow(suggestion);
153
+ };
144
154
  const getSnapsOutput = () => {
145
155
  if (mergeSnapError) {
146
156
  return `
@@ -193,7 +203,7 @@ ${mergeSnapError.message}
193
203
  const autoSnappedStr = `\nTotal Snapped: ${_chalk().default.bold(autoSnapped.toString())}`;
194
204
  return newLines + title + mergedStr + unchangedLegitimatelyStr + failedToMergeStr + autoSnappedStr;
195
205
  };
196
- return getSuccessOutput() + getFailureOutput() + getSnapsOutput() + getConflictSummary() + getSummary();
206
+ return getSuccessOutput() + getFailureOutput() + getSnapsOutput() + getConfigMergeConflictSummary() + getConflictSummary() + getSummary();
197
207
  }
198
208
 
199
209
  //# sourceMappingURL=merge-cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["MergeCmd","constructor","merging","WILDCARD_HELP","report","values","ours","theirs","manual","abort","resolve","build","noSnap","verbose","message","skipDependencyInstallation","isFeatureEnabled","BUILD_ON_CI","Boolean","mergeStrategy","getMergeStrategy","BitError","components","failedComponents","version","resolvedComponents","abortedComponents","mergeSnapResults","mergeSnapError","merge","title","componentsStr","map","c","id","toStringWithoutVersion","join","chalk","underline","green","mergeReport","leftUnresolvedConflicts","getSuccessOutput","length","bold","applyVersionReport","getConflictSummary","suggestion","conflictSummaryReport","yellow","getSnapsOutput","snappedComponents","autoSnappedResults","outputComponents","comps","component","componentOutput","toString","autoTag","filter","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_SNAPPED_MSG","getFailureOutput","body","compact","failedComponent","unchangedLegitimately","color","failureMessage","getSummary","merged","f","failedToMerge","autoSnapped","newLines","mergedStr","unchangedLegitimatelyStr","failedToMergeStr","autoSnappedStr"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport { WILDCARD_HELP, AUTO_SNAPPED_MSG } from '@teambit/legacy/dist/constants';\nimport {\n ApplyVersionResults,\n conflictSummaryReport,\n getMergeStrategy,\n applyVersionReport,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { BitError } from '@teambit/bit-error';\nimport { MergingMain } from './merging.main.runtime';\n\nexport class MergeCmd implements Command {\n name = 'merge [values...]';\n description = 'merge changes of different component versions';\n helpUrl = 'docs/components/merging-changes';\n group = 'development';\n extendedDescription = `merge changes of different component versions\n \\`bit merge <version> [ids...]\\` => merge changes of the given version into the checked out version\n \\`bit merge [ids...]\\` => EXPERIMENTAL. merge changes of the remote head into local, optionally use '--abort' or '--resolve'\n ${WILDCARD_HELP('merge 0.0.1')}`;\n alias = '';\n options = [\n ['', 'ours', 'in case of a conflict, override the used version with the current modification'],\n ['', 'theirs', 'in case of a conflict, override the current modification with the specified version'],\n ['', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'],\n ['', 'abort', 'EXPERIMENTAL. in case of an unresolved merge, revert to the state before the merge began'],\n ['', 'resolve', 'EXPERIMENTAL. mark an unresolved merge as resolved and create a new snap with the changes'],\n ['', 'no-snap', 'EXPERIMENTAL. do not auto snap in case 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 legitimately'],\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ['m', 'message <message>', 'EXPERIMENTAL. override the default message for the auto snap'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private merging: MergingMain) {}\n\n async report(\n [values = []]: [string[]],\n {\n ours = false,\n theirs = false,\n manual = false,\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 abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n verbose?: boolean;\n message: string;\n skipDependencyInstallation?: boolean;\n }\n ) {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const mergeStrategy = getMergeStrategy(ours, theirs, manual);\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 values,\n mergeStrategy 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 version,\n mergeSnapResults,\n mergeSnapError,\n leftUnresolvedConflicts,\n verbose,\n}: ApplyVersionResults): string {\n const getSuccessOutput = () => {\n if (!components || !components.length) return '';\n // @ts-ignore version is set in case of merge command\n const title = `successfully merged components${version ? `from version ${chalk.bold(version)}` : ''}\\n`;\n // @ts-ignore components is set in case of merge command\n return chalk.underline(title) + chalk.green(applyVersionReport(components));\n };\n\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = `\\nfiles with conflicts summary\\n`;\n const suggestion = `\\n\\nthe merge process wasn't completed due to the conflicts above. fix them 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 getSnapsOutput = () => {\n if (mergeSnapError) {\n return `\n${chalk.bold(\n 'snapping the merged components had failed with the following error, please fix the issues and snap manually'\n)}\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) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\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 that snapped as a result of the merge'})\\n${outputComponents(snappedComponents)}\\n`;\n };\n\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = '\\nthe merge has been skipped on 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.failureMessage)}`;\n })\n ).join('\\n');\n if (!body) {\n return `${chalk.bold(`\\nthe merge has been skipped on ${failedComponents.length} component(s) legitimately`)}\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\n return newLines + title + mergedStr + unchangedLegitimatelyStr + failedToMergeStr + autoSnappedStr;\n };\n\n return getSuccessOutput() + getFailureOutput() + getSnapsOutput() + getConflictSummary() + getSummary();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,QAAQ,CAAoB;EAwBvCC,WAAW,CAASC,OAAoB,EAAE;IAAA,KAAtBA,OAAoB,GAApBA,OAAoB;IAAA,8CAvBjC,mBAAmB;IAAA,qDACZ,+CAA+C;IAAA,iDACnD,iCAAiC;IAAA,+CACnC,aAAa;IAAA,6DACE;AACzB;AACA;AACA,IAAI,IAAAC,0BAAa,EAAC,aAAa,CAAE,EAAC;IAAA,+CACxB,EAAE;IAAA,iDACA,CACR,CAAC,EAAE,EAAE,MAAM,EAAE,gFAAgF,CAAC,EAC9F,CAAC,EAAE,EAAE,QAAQ,EAAE,qFAAqF,CAAC,EACrG,CAAC,EAAE,EAAE,QAAQ,EAAE,6FAA6F,CAAC,EAC7G,CAAC,EAAE,EAAE,OAAO,EAAE,0FAA0F,CAAC,EACzG,CAAC,EAAE,EAAE,SAAS,EAAE,2FAA2F,CAAC,E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,EAAE,GAAGJ,kBAAkB,EAAE,GAAG2B,UAAU,EAAE;AACzG"}
1
+ {"version":3,"names":["MergeCmd","constructor","merging","WILDCARD_HELP","report","values","ours","theirs","manual","abort","resolve","build","noSnap","verbose","message","skipDependencyInstallation","isFeatureEnabled","BUILD_ON_CI","Boolean","mergeStrategy","getMergeStrategy","BitError","components","failedComponents","version","resolvedComponents","abortedComponents","mergeSnapResults","mergeSnapError","merge","title","componentsStr","map","c","id","toStringWithoutVersion","join","chalk","underline","green","mergeReport","leftUnresolvedConflicts","configMergeResults","getSuccessOutput","length","bold","applyVersionReport","getConflictSummary","suggestion","conflictSummaryReport","yellow","configMergeWithConflicts","filter","hasConflicts","getConfigMergeConflictSummary","comps","compIdStr","MergeConfigFilename","getSnapsOutput","snappedComponents","autoSnappedResults","outputComponents","component","componentOutput","toString","autoTag","result","triggeredBy","searchWithoutScopeAndVersion","autoTagComp","a","AUTO_SNAPPED_MSG","getFailureOutput","body","compact","failedComponent","unchangedLegitimately","color","failureMessage","getSummary","merged","f","failedToMerge","autoSnapped","newLines","mergedStr","unchangedLegitimatelyStr","failedToMergeStr","autoSnappedStr"],"sources":["merge-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\nimport { WILDCARD_HELP, AUTO_SNAPPED_MSG, MergeConfigFilename } from '@teambit/legacy/dist/constants';\nimport {\n ApplyVersionResults,\n conflictSummaryReport,\n getMergeStrategy,\n applyVersionReport,\n} from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { isFeatureEnabled, BUILD_ON_CI } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { BitError } from '@teambit/bit-error';\nimport { MergingMain } from './merging.main.runtime';\nimport { ConfigMergeResult } from './config-merge-result';\n\nexport class MergeCmd implements Command {\n name = 'merge [values...]';\n description = 'merge changes of different component versions';\n helpUrl = 'docs/components/merging-changes';\n group = 'development';\n extendedDescription = `merge changes of different component versions\n \\`bit merge <version> [ids...]\\` => merge changes of the given version into the checked out version\n \\`bit merge [ids...]\\` => EXPERIMENTAL. merge changes of the remote head into local, optionally use '--abort' or '--resolve'\n ${WILDCARD_HELP('merge 0.0.1')}`;\n alias = '';\n options = [\n ['', 'ours', 'in case of a conflict, override the used version with the current modification'],\n ['', 'theirs', 'in case of a conflict, override the current modification with the specified version'],\n ['', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'],\n ['', 'abort', 'EXPERIMENTAL. in case of an unresolved merge, revert to the state before the merge began'],\n ['', 'resolve', 'EXPERIMENTAL. mark an unresolved merge as resolved and create a new snap with the changes'],\n ['', 'no-snap', 'EXPERIMENTAL. do not auto snap in case 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 legitimately'],\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ['m', 'message <message>', 'EXPERIMENTAL. override the default message for the auto snap'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private merging: MergingMain) {}\n\n async report(\n [values = []]: [string[]],\n {\n ours = false,\n theirs = false,\n manual = false,\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 abort?: boolean;\n resolve?: boolean;\n build?: boolean;\n noSnap?: boolean;\n verbose?: boolean;\n message: string;\n skipDependencyInstallation?: boolean;\n }\n ) {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const mergeStrategy = getMergeStrategy(ours, theirs, manual);\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 values,\n mergeStrategy 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 version,\n mergeSnapResults,\n mergeSnapError,\n leftUnresolvedConflicts,\n verbose,\n configMergeResults,\n}: ApplyVersionResults & { configMergeResults?: ConfigMergeResult[] }): string {\n const getSuccessOutput = () => {\n if (!components || !components.length) return '';\n // @ts-ignore version is set in case of merge command\n const title = `successfully merged components${version ? `from version ${chalk.bold(version)}` : ''}\\n`;\n // @ts-ignore components is set in case of merge command\n return chalk.underline(title) + chalk.green(applyVersionReport(components));\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\\nthe merge process wasn't completed due to the conflicts above. fix them 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 component's dir.\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(\n 'snapping the merged components had failed with the following error, please fix the issues and snap manually'\n)}\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) =>\n result.triggeredBy.searchWithoutScopeAndVersion(component.id)\n );\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 that snapped as a result of the merge'})\\n${outputComponents(snappedComponents)}\\n`;\n };\n\n const getFailureOutput = () => {\n if (!failedComponents || !failedComponents.length) return '';\n const title = '\\nthe merge has been skipped on 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.failureMessage)}`;\n })\n ).join('\\n');\n if (!body) {\n return `${chalk.bold(`\\nthe merge has been skipped on ${failedComponents.length} component(s) legitimately`)}\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\n return newLines + title + mergedStr + unchangedLegitimatelyStr + failedToMergeStr + autoSnappedStr;\n };\n\n return (\n getSuccessOutput() +\n getFailureOutput() +\n getSnapsOutput() +\n getConfigMergeConflictSummary() +\n getConflictSummary() +\n getSummary()\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIO,MAAMA,QAAQ,CAAoB;EAwBvCC,WAAW,CAASC,OAAoB,EAAE;IAAA,KAAtBA,OAAoB,GAApBA,OAAoB;IAAA,8CAvBjC,mBAAmB;IAAA,qDACZ,+CAA+C;IAAA,iDACnD,iCAAiC;IAAA,+CACnC,aAAa;IAAA,6DACE;AACzB;AACA;AACA,IAAI,IAAAC,0BAAa,EAAC,aAAa,CAAE,EAAC;IAAA,+CACxB,EAAE;IAAA,iDACA,CACR,CAAC,EAAE,EAAE,MAAM,EAAE,gFAAgF,CAAC,EAC9F,CAAC,EAAE,EAAE,QAAQ,EAAE,qFAAqF,CAAC,EACrG,CAAC,EAAE,EAAE,QAAQ,EAAE,6FAA6F,CAAC,EAC7G,CAAC,EAAE,EAAE,OAAO,EAAE,0FAA0F,CAAC,EACzG,CAAC,EAAE,EAAE,SAAS,EAAE,2FAA2F,CAAC,EAC5G,CAAC,EAAE,EAAE,SAAS,EAAE,8EAA8E,CAAC,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AS,GAAI,mBAAkBhD,gBAAK,CAACQ,IAAI,CAACmC,MAAM,CAAChB,QAAQ,EAAE,CAAE,EAAC;IACpE,MAAMsB,wBAAwB,GAAI,sBAAqBjD,gBAAK,CAACQ,IAAI,CAAC+B,qBAAqB,CAACZ,QAAQ,EAAE,CAAE,EAAC;IACrG,MAAMuB,gBAAgB,GAAI,mBAAkBlD,gBAAK,CAACQ,IAAI,CAACqC,aAAa,CAAClB,QAAQ,EAAE,CAAE,EAAC;IAClF,MAAMwB,cAAc,GAAI,oBAAmBnD,gBAAK,CAACQ,IAAI,CAACsC,WAAW,CAACnB,QAAQ,EAAE,CAAE,EAAC;IAE/E,OAAOoB,QAAQ,GAAGtD,KAAK,GAAGuD,SAAS,GAAGC,wBAAwB,GAAGC,gBAAgB,GAAGC,cAAc;EACpG,CAAC;EAED,OACE7C,gBAAgB,EAAE,GAClB6B,gBAAgB,EAAE,GAClBd,cAAc,EAAE,GAChBJ,6BAA6B,EAAE,GAC/BP,kBAAkB,EAAE,GACpBgC,UAAU,EAAE;AAEhB"}
@@ -13,6 +13,7 @@ import { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops
13
13
  import { CheckoutMain } from '@teambit/checkout';
14
14
  import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance';
15
15
  import { InstallMain } from '@teambit/install';
16
+ import { ConfigMergeResult } from './config-merge-result';
16
17
  declare type ResolveUnrelatedData = {
17
18
  strategy: MergeStrategy;
18
19
  head: Ref;
@@ -26,6 +27,7 @@ export declare type ComponentMergeStatus = {
26
27
  mergeResults?: MergeResultsThreeWay | null;
27
28
  divergeData?: SnapsDistance;
28
29
  resolvedUnrelated?: ResolveUnrelatedData;
30
+ configMergeResult?: ConfigMergeResult;
29
31
  };
30
32
  export declare type ComponentMergeStatusBeforeMergeAttempt = {
31
33
  currentComponent?: ConsumerComponent | null;
@@ -23,6 +23,20 @@ function _cli() {
23
23
  };
24
24
  return data;
25
25
  }
26
+ function _path() {
27
+ const data = _interopRequireDefault(require("path"));
28
+ _path = function () {
29
+ return data;
30
+ };
31
+ return data;
32
+ }
33
+ function _fsExtra() {
34
+ const data = _interopRequireDefault(require("fs-extra"));
35
+ _fsExtra = function () {
36
+ return data;
37
+ };
38
+ return data;
39
+ }
26
40
  function _workspace() {
27
41
  const data = _interopRequireWildcard(require("@teambit/workspace"));
28
42
  _workspace = function () {
@@ -177,6 +191,13 @@ function _componentId() {
177
191
  };
178
192
  return data;
179
193
  }
194
+ function _constants() {
195
+ const data = require("@teambit/legacy/dist/constants");
196
+ _constants = function () {
197
+ return data;
198
+ };
199
+ return data;
200
+ }
180
201
  function _install() {
181
202
  const data = require("@teambit/install");
182
203
  _install = function () {
@@ -198,6 +219,13 @@ function _merging() {
198
219
  };
199
220
  return data;
200
221
  }
222
+ function _configMerger() {
223
+ const data = require("./config-merger");
224
+ _configMerger = function () {
225
+ return data;
226
+ };
227
+ return data;
228
+ }
201
229
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
202
230
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
203
231
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -298,7 +326,8 @@ class MergingMain {
298
326
  currentComponent,
299
327
  id,
300
328
  mergeResults,
301
- resolvedUnrelated
329
+ resolvedUnrelated,
330
+ configMergeResult
302
331
  }) => {
303
332
  const modelComponent = await consumer.scope.getModelComponent(id);
304
333
  const updatedLaneId = laneId.isDefault() ? _laneId().LaneId.from(laneId.name, id.scope) : laneId;
@@ -310,7 +339,8 @@ class MergingMain {
310
339
  remoteHead: modelComponent.getRef(id.version),
311
340
  laneId: updatedLaneId,
312
341
  localLane,
313
- resolvedUnrelated
342
+ resolvedUnrelated,
343
+ configMergeResult
314
344
  });
315
345
  });
316
346
  if (localLane) consumer.scope.objects.add(localLane);
@@ -318,8 +348,12 @@ class MergingMain {
318
348
 
319
349
  await consumer.scope.objects.unmergedComponents.write();
320
350
  await consumer.writeBitMap();
351
+ const componentsHasConfigMergeConflicts = allComponentsStatus.some(c => {
352
+ var _c$configMergeResult;
353
+ return (_c$configMergeResult = c.configMergeResult) === null || _c$configMergeResult === void 0 ? void 0 : _c$configMergeResult.hasConflicts();
354
+ });
321
355
  const leftUnresolvedConflicts = componentWithConflict && mergeStrategy === 'manual';
322
- if (!skipDependencyInstallation && !leftUnresolvedConflicts) {
356
+ if (!skipDependencyInstallation && !leftUnresolvedConflicts && !componentsHasConfigMergeConflicts) {
323
357
  try {
324
358
  await this.install.install(undefined, {
325
359
  dedupe: true,
@@ -334,7 +368,7 @@ class MergingMain {
334
368
  const getSnapOrTagResults = async () => {
335
369
  // if one of the component has conflict, don't snap-merge. otherwise, some of the components would be snap-merged
336
370
  // and some not. besides the fact that it could by mistake tag dependent, it's a confusing state. better not snap.
337
- if (noSnap || leftUnresolvedConflicts) {
371
+ if (noSnap || leftUnresolvedConflicts || componentsHasConfigMergeConflicts) {
338
372
  return null;
339
373
  }
340
374
  if (tag) {
@@ -405,6 +439,7 @@ class MergingMain {
405
439
  }
406
440
  };
407
441
  const results = await getComponentsStatusNeedMerge();
442
+ // throw new Error('stop!')
408
443
  results.push(...compStatusNotNeedMerge);
409
444
  return results;
410
445
  }
@@ -600,22 +635,30 @@ class MergingMain {
600
635
  if (!divergeData) throw new Error(`getDivergedMergeStatus, divergeData is missing for ${id.toString()}`);
601
636
  if (!currentComponent) throw new Error(`getDivergedMergeStatus, currentComponent is missing for ${id.toString()}`);
602
637
  const baseSnap = divergeData.commonSnapBeforeDiverge; // must be set when isTrueMerge
638
+ // uncomment for debugging
639
+ // console.log('id', id.toStringWithoutVersion(), 'baseSnap', baseSnap.toString(), 'current', currentId.version, 'other', otherLaneHead.toString());
603
640
  const baseComponent = await modelComponent.loadVersion(baseSnap.toString(), repo);
604
641
  const otherComponent = await modelComponent.loadVersion(otherLaneHead.toString(), repo);
605
642
  const currentLaneName = (localLane === null || localLane === void 0 ? void 0 : localLane.toLaneId().toString()) || 'main';
643
+ const currentLabel = `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`;
644
+ const otherLabel = `${otherLaneHead.toString()} (${otherLaneName === currentLaneName ? 'incoming' : otherLaneName})`;
645
+ const workspaceIds = await this.workspace.listIds();
646
+ const configMerger = new (_configMerger().ConfigMerger)(id.toStringWithoutVersion(), workspaceIds, currentComponent.extensions, baseComponent.extensions, otherComponent.extensions, currentLabel, otherLabel);
647
+ const configMergeResult = configMerger.merge();
606
648
  const mergeResults = await (0, _threeWayMerge().default)({
607
649
  consumer,
608
650
  otherComponent,
609
- otherLabel: `${otherLaneHead.toString()} (${otherLaneName === currentLaneName ? 'incoming' : otherLaneName})`,
651
+ otherLabel,
610
652
  currentComponent,
611
- currentLabel: `${currentId.version} (${currentLaneName === otherLaneName ? 'current' : currentLaneName})`,
653
+ currentLabel,
612
654
  baseComponent
613
655
  });
614
656
  return {
615
657
  currentComponent,
616
658
  id,
617
659
  mergeResults,
618
- divergeData
660
+ divergeData,
661
+ configMergeResult
619
662
  };
620
663
  }
621
664
  async applyVersion({
@@ -626,7 +669,8 @@ class MergingMain {
626
669
  remoteHead,
627
670
  laneId,
628
671
  localLane,
629
- resolvedUnrelated
672
+ resolvedUnrelated,
673
+ configMergeResult
630
674
  }) {
631
675
  const consumer = this.workspace.consumer;
632
676
  let filesStatus = {};
@@ -710,6 +754,22 @@ class MergingMain {
710
754
  });
711
755
 
712
756
  await manyComponentsWriter.writeAll();
757
+ if (configMergeResult) {
758
+ if (!componentWithDependencies.component.writtenPath) {
759
+ throw new Error(`componentWithDependencies.component.writtenPath is missing for ${id.toString()}`);
760
+ }
761
+ const configMergeConflictFile = configMergeResult.generateMergeConflictFile();
762
+ if (configMergeConflictFile) {
763
+ const configMergePath = _path().default.join(consumer.getPath(), componentWithDependencies.component.writtenPath, _constants().MergeConfigFilename);
764
+ await _fsExtra().default.outputFile(configMergePath, configMergeConflictFile);
765
+ }
766
+ const successfullyMergedConfig = configMergeResult.getSuccessfullyMergedConfig();
767
+ if (successfullyMergedConfig) {
768
+ unmergedComponent.mergedConfig = successfullyMergedConfig;
769
+ // no need to `unmergedComponents.addEntry` here. it'll be added in the next lines inside `if (mergeResults)`.
770
+ // because if `configMergeResult` is set, `mergeResults` must be set as well. both happen on diverge.
771
+ }
772
+ }
713
773
 
714
774
  // if mergeResults, the head snap is going to be updated on a later phase when snapping with two parents
715
775
  // otherwise, update the head of the current lane or main