@teambit/checkout 1.0.1292 → 1.0.1294
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkout-cmd.js +2 -1
- package/dist/checkout-cmd.js.map +1 -1
- package/dist/checkout-version.d.ts +2 -0
- package/dist/checkout-version.js.map +1 -1
- package/dist/checkout.main.runtime.d.ts +15 -0
- package/dist/checkout.main.runtime.js +74 -5
- package/dist/checkout.main.runtime.js.map +1 -1
- package/dist/local-config-merge.d.ts +14 -0
- package/dist/local-config-merge.js +50 -0
- package/dist/local-config-merge.js.map +1 -0
- package/dist/local-config-merge.spec.d.ts +1 -0
- package/dist/local-config-merge.spec.js +59 -0
- package/dist/local-config-merge.spec.js.map +1 -0
- package/package.json +13 -12
- /package/dist/{preview-1793997106309.js → preview-1794337308238.js} +0 -0
package/dist/checkout-cmd.js
CHANGED
|
@@ -138,6 +138,7 @@ function checkoutOutput(checkoutResults, checkoutProps, alternativeTitle) {
|
|
|
138
138
|
removedComponents,
|
|
139
139
|
addedComponents,
|
|
140
140
|
leftUnresolvedConflicts,
|
|
141
|
+
configMergeConflicts,
|
|
141
142
|
workspaceConfigUpdateResult,
|
|
142
143
|
newFromLane,
|
|
143
144
|
newFromLaneAdded,
|
|
@@ -239,7 +240,7 @@ function checkoutOutput(checkoutResults, checkoutProps, alternativeTitle) {
|
|
|
239
240
|
const newFromScopeStr = newFromScopeNum ? `\nNew from scope (imported): ${_chalk().default.bold(newFromScopeNum.toString())}` : '';
|
|
240
241
|
return title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr + newFromScopeStr;
|
|
241
242
|
};
|
|
242
|
-
const buildOutput = notCheckedOutSection => (0, _cli().joinSections)([getWsConfigUpdateLogs(), notCheckedOutSection, getSuccessfulOutput(), (0, _componentModules().getRemovedOutput)(removedComponents), (0, _componentModules().getAddedOutput)(addedComponents), getNewOnLaneOutput(), getNewFromScopeOutput(), (0, _componentModules().getWorkspaceConfigUpdateOutput)(workspaceConfigUpdateResult), getConflictSummary(), getSummary(), (0, _componentModules().installationErrorOutput)(installationError), (0, _componentModules().compilationErrorOutput)(compilationError)]);
|
|
243
|
+
const buildOutput = notCheckedOutSection => (0, _cli().joinSections)([getWsConfigUpdateLogs(), notCheckedOutSection, getSuccessfulOutput(), (0, _componentModules().getRemovedOutput)(removedComponents), (0, _componentModules().getAddedOutput)(addedComponents), getNewOnLaneOutput(), getNewFromScopeOutput(), (0, _componentModules().getWorkspaceConfigUpdateOutput)(workspaceConfigUpdateResult), getConflictSummary(), (0, _componentModules().getConfigMergeConflictsOutput)(configMergeConflicts || [], 'snap/tag the components to persist the changes'), getSummary(), (0, _componentModules().installationErrorOutput)(installationError), (0, _componentModules().compilationErrorOutput)(compilationError)]);
|
|
243
244
|
if (!hasSkippedComponents) {
|
|
244
245
|
return buildOutput(getNotCheckedOutOutputMinimal());
|
|
245
246
|
}
|
package/dist/checkout-cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_cli","_componentModules","_legacy","_componentId","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","forceOurs","forceTheirs","autoMergeResolve","manual","all","workspaceOnly","verbose","skipDependencyInstallation","revert","includeNewFromScope","BitError","HEAD","checkoutProps","promptMergeOptions","mergeStrategy","isLane","skipNpmInstall","head","LATEST","latest","reset","main","startsWith","ancestor","parseInt","split","isNaN","ComponentID","isValidVersion","version","checkoutResults","checkoutByCLIValues","checkoutOutput","exports","alternativeTitle","components","failedComponents","removedComponents","addedComponents","leftUnresolvedConflicts","workspaceConfigUpdateResult","newFromLane","newFromLaneAdded","newFromScope","installationError","compilationError","realFailedComponents","filter","f","unchangedLegitimately","length","Error","notCheckedOutComponents","hasSkippedComponents","getNotCheckedOutOutputMinimal","formatDetailsHint","items","map","failedComponent","formatItem","id","toString","unchangedMessage","formatSection","getNotCheckedOutOutputDetailed","getWsConfigUpdateLogs","logs","logsStr","join","formatTitle","getConflictSummary","title","warnSymbol","conflictSummary","conflictSummaryReport","suggestion","formatHint","conflictStr","getSuccessfulOutput","switchedOrReverted","component","componentName","toStringWithoutVersion","formatSuccessSummary","chalk","bold","applyVersionReport","Boolean","getVerOutput","versionOutput","showVersion","getNewOnLaneOutput","desc","c","getNewFromScopeOutput","getSummary","checkedOut","notCheckedOutLegitimately","checkedOutStr","unchangedLegitimatelyStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","newFromScopeNum","newFromScopeStr","buildOutput","notCheckedOutSection","joinSections","getRemovedOutput","getAddedOutput","getWorkspaceConfigUpdateOutput","installationErrorOutput","compilationErrorOutput","details","code"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Command, CommandOptions, Report } from '@teambit/cli';\nimport {\n formatTitle,\n formatSection,\n formatItem,\n formatSuccessSummary,\n formatHint,\n formatDetailsHint,\n warnSymbol,\n joinSections,\n} from '@teambit/cli';\nimport type { ApplyVersionResults, MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport {\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n getRemovedOutput,\n getAddedOutput,\n getWorkspaceConfigUpdateOutput,\n} from '@teambit/component.modules.merge-helper';\nimport { COMPONENT_PATTERN_HELP, HEAD, LATEST } from '@teambit/legacy.constants';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport type { CheckoutMain, CheckoutProps } from './checkout.main.runtime';\n\nexport class CheckoutCmd implements Command {\n name = 'checkout <to> [component-pattern]';\n arguments = [\n {\n name: 'to',\n description:\n \"permitted values: `[head, latest, reset, {specific-version}, {head~x}]`. 'head' - last snap/tag. 'latest' - semver latest tag. 'reset' - removes local changes\",\n },\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n description = 'switch between component versions or remove local changes';\n helpUrl = 'reference/components/merging-changes#checkout-snaps-to-the-working-directory';\n group = 'version-control';\n extendedDescription = `checkout components to specified versions or remove local changes. most commonly used as 'bit checkout head' to get latest versions.\nthe \\`<to>\\` argument accepts these values:\n- head: checkout to last snap/tag (most common usage)\n- specific version: checkout to exact version (e.g. 'bit checkout 1.0.5 component-name')\n- head~x: go back x generations from head (e.g. 'head~2' for two versions back)\n- latest: checkout to latest semver tag\n- reset: remove local modifications and restore original files (also restores deleted component directories)\nwhen on lanes, 'checkout head' only affects lane components. to update main components, run 'bit lane merge main'.`;\n alias = 'U';\n options = [\n [\n 'i',\n 'interactive-merge',\n 'when a component is modified and the merge process found conflicts, display options to resolve them',\n ],\n [\n 'r',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of merge conflict, resolve according to the provided strategy: [ours, theirs, manual]',\n ],\n [\n '',\n 'manual',\n 'same as \"--auto-merge-resolve manual\". in case of merge conflict, write the files with the conflict markers',\n ],\n ['a', 'all', 'all components'],\n [\n 'e',\n 'workspace-only',\n \"only relevant for 'bit checkout head' when on a lane. don't import components from the remote lane that are not already in the workspace\",\n ],\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['x', 'skip-dependency-installation', 'do not auto-install dependencies of the imported components'],\n ['', 'force-ours', 'do not merge, preserve local files as is'],\n ['', 'force-theirs', 'do not merge, just overwrite with incoming files'],\n [\n '',\n 'include-new-from-scope',\n \"relevant for 'bit checkout head'. import components from the defaultScope that don't exist in the workspace\",\n ],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [to, componentPattern]: [string, string],\n {\n interactiveMerge = false,\n forceOurs,\n forceTheirs,\n autoMergeResolve,\n manual,\n all = false,\n workspaceOnly = false,\n verbose = false,\n skipDependencyInstallation = false,\n revert = false,\n includeNewFromScope = false,\n }: {\n interactiveMerge?: boolean;\n forceOurs?: boolean;\n forceTheirs?: boolean;\n autoMergeResolve?: MergeStrategy;\n manual?: boolean;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n revert?: boolean;\n includeNewFromScope?: boolean;\n }\n ) {\n if (forceOurs && forceTheirs) {\n throw new BitError('please use either --force-ours or --force-theirs, not both');\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 (manual) autoMergeResolve = 'manual';\n if (workspaceOnly && to !== HEAD) {\n throw new BitError('--workspace-only is only relevant when running \"bit checkout head\" on a lane');\n }\n if (includeNewFromScope && to !== HEAD) {\n throw new BitError('--include-new-from-scope is only relevant when running \"bit checkout head\"');\n }\n const checkoutProps: CheckoutProps = {\n promptMergeOptions: interactiveMerge,\n mergeStrategy: autoMergeResolve,\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n workspaceOnly,\n revert,\n forceOurs,\n forceTheirs,\n includeNewFromScope,\n };\n to = String(to); // it can be a number in case short-hash is used\n if (to === HEAD) checkoutProps.head = true;\n else if (to === LATEST) checkoutProps.latest = true;\n else if (to === 'reset') checkoutProps.reset = true;\n else if (to === 'main') checkoutProps.main = true;\n else if (to.startsWith(`${HEAD}~`)) {\n const ancestor = parseInt(to.split('~')[1]);\n if (Number.isNaN(ancestor))\n throw new BitError(`the character after \"${HEAD}~\" must be a number, got ${ancestor}`);\n checkoutProps.ancestor = ancestor;\n } else {\n if (!ComponentID.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n\n const checkoutResults = await this.checkout.checkoutByCLIValues(componentPattern || '', checkoutProps);\n return checkoutOutput(checkoutResults, checkoutProps);\n }\n}\n\nexport function checkoutOutput(\n checkoutResults: ApplyVersionResults,\n checkoutProps: CheckoutProps,\n alternativeTitle?: string\n): string | Report {\n const {\n components,\n version,\n failedComponents,\n removedComponents,\n addedComponents,\n leftUnresolvedConflicts,\n workspaceConfigUpdateResult,\n newFromLane,\n newFromLaneAdded,\n newFromScope,\n installationError,\n compilationError,\n }: ApplyVersionResults = checkoutResults;\n\n const { head, reset, latest, main, revert, verbose, all } = checkoutProps;\n\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = (failedComponents || []).filter((f) => !f.unchangedLegitimately);\n if (realFailedComponents.length) {\n throw new Error('checkout should throw in case of errors');\n }\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const notCheckedOutComponents = failedComponents || [];\n\n const hasSkippedComponents = notCheckedOutComponents.length > 0 && all && !verbose;\n\n const getNotCheckedOutOutputMinimal = () => {\n if (!notCheckedOutComponents.length) return '';\n if (all && !verbose) {\n return formatDetailsHint(`full list of ${notCheckedOutComponents.length} skipped component(s)`);\n }\n const items = notCheckedOutComponents.map((failedComponent) =>\n formatItem(`${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`)\n );\n return formatSection('checkout skipped', '', items);\n };\n\n const getNotCheckedOutOutputDetailed = () => {\n if (!notCheckedOutComponents.length) return '';\n const items = notCheckedOutComponents.map((failedComponent) =>\n formatItem(`${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`)\n );\n return formatSection('checkout skipped', '', items);\n };\n const getWsConfigUpdateLogs = () => {\n const logs = workspaceConfigUpdateResult?.logs;\n if (!logs || !logs.length) return '';\n const logsStr = logs.join('\\n');\n return `${formatTitle('verbose logs of workspace config update')}\\n${logsStr}`;\n };\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = formatTitle(`${warnSymbol} files with conflicts summary`);\n const conflictSummary = conflictSummaryReport(components);\n const suggestion = formatHint(\n `fix the conflicts above manually and then run \"bit install\".\\nonce ready, snap/tag the components to persist the changes`\n );\n return `${title}\\n${conflictSummary.conflictStr}\\n\\n${suggestion}`;\n };\n const getSuccessfulOutput = () => {\n if (!components || !components.length) return '';\n const switchedOrReverted = revert ? 'reverted' : 'switched';\n if (components.length === 1) {\n const component = components[0];\n const componentName = reset ? component.id.toString() : component.id.toStringWithoutVersion();\n if (reset) return formatSuccessSummary(`successfully reset ${chalk.bold(componentName)}`);\n const title =\n alternativeTitle ||\n `successfully ${switchedOrReverted} ${chalk.bold(componentName)} to version ${chalk.bold(\n head || latest ? component.id.version : version\n )}`;\n return [formatSuccessSummary(title), applyVersionReport(components, false)].filter(Boolean).join('\\n');\n }\n if (reset) {\n const items = components.map((component) => formatItem(component.id.toString()));\n return formatSection('reset components', '', items);\n }\n const getVerOutput = () => {\n if (head) return 'their head version';\n if (latest) return 'their latest version';\n if (main) return 'their main version';\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title =\n alternativeTitle || `successfully ${switchedOrReverted} ${components.length} components to ${versionOutput}`;\n const showVersion = head || reset;\n return [formatSuccessSummary(title), applyVersionReport(components, true, showVersion)].filter(Boolean).join('\\n');\n };\n const getNewOnLaneOutput = () => {\n if (!newFromLane?.length) return '';\n const title = newFromLaneAdded ? 'new components from lane' : 'new components on lane (not added)';\n const desc = newFromLaneAdded ? '' : 'omit --workspace-only flag to add them';\n const items = newFromLane.map((c) => formatItem(c.toString()));\n return formatSection(title, desc, items);\n };\n const getNewFromScopeOutput = () => {\n if (!newFromScope?.length) return '';\n const items = newFromScope.map((c) => formatItem(c.toString()));\n return formatSection('new components from scope', '', items);\n };\n const getSummary = () => {\n const checkedOut = components?.length || 0;\n const notCheckedOutLegitimately = notCheckedOutComponents.length;\n const title = formatTitle('Checkout Summary');\n const checkedOutStr = `\\nTotal Changed: ${chalk.bold(checkedOut.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(notCheckedOutLegitimately.toString())}`;\n const newOnLaneNum = newFromLane?.length || 0;\n const newOnLaneAddedStr = newFromLaneAdded ? ' (added)' : ' (not added)';\n const newOnLaneStr = newOnLaneNum\n ? `\\nNew on lane${newOnLaneAddedStr}: ${chalk.bold(newOnLaneNum.toString())}`\n : '';\n const newFromScopeNum = newFromScope?.length || 0;\n const newFromScopeStr = newFromScopeNum\n ? `\\nNew from scope (imported): ${chalk.bold(newFromScopeNum.toString())}`\n : '';\n\n return title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr + newFromScopeStr;\n };\n\n const buildOutput = (notCheckedOutSection: string) =>\n joinSections([\n getWsConfigUpdateLogs(),\n notCheckedOutSection,\n getSuccessfulOutput(),\n getRemovedOutput(removedComponents),\n getAddedOutput(addedComponents),\n getNewOnLaneOutput(),\n getNewFromScopeOutput(),\n getWorkspaceConfigUpdateOutput(workspaceConfigUpdateResult),\n getConflictSummary(),\n getSummary(),\n installationErrorOutput(installationError),\n compilationErrorOutput(compilationError),\n ]);\n\n if (!hasSkippedComponents) {\n return buildOutput(getNotCheckedOutOutputMinimal());\n }\n\n const data = buildOutput(getNotCheckedOutOutputMinimal());\n const details = buildOutput(getNotCheckedOutOutputDetailed());\n return { data, code: 0, details };\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;AAEA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAWA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,a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","_componentId","_bitError","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckoutCmd","constructor","checkout","name","description","COMPONENT_PATTERN_HELP","report","to","componentPattern","interactiveMerge","forceOurs","forceTheirs","autoMergeResolve","manual","all","workspaceOnly","verbose","skipDependencyInstallation","revert","includeNewFromScope","BitError","HEAD","checkoutProps","promptMergeOptions","mergeStrategy","isLane","skipNpmInstall","head","LATEST","latest","reset","main","startsWith","ancestor","parseInt","split","isNaN","ComponentID","isValidVersion","version","checkoutResults","checkoutByCLIValues","checkoutOutput","exports","alternativeTitle","components","failedComponents","removedComponents","addedComponents","leftUnresolvedConflicts","configMergeConflicts","workspaceConfigUpdateResult","newFromLane","newFromLaneAdded","newFromScope","installationError","compilationError","realFailedComponents","filter","f","unchangedLegitimately","length","Error","notCheckedOutComponents","hasSkippedComponents","getNotCheckedOutOutputMinimal","formatDetailsHint","items","map","failedComponent","formatItem","id","toString","unchangedMessage","formatSection","getNotCheckedOutOutputDetailed","getWsConfigUpdateLogs","logs","logsStr","join","formatTitle","getConflictSummary","title","warnSymbol","conflictSummary","conflictSummaryReport","suggestion","formatHint","conflictStr","getSuccessfulOutput","switchedOrReverted","component","componentName","toStringWithoutVersion","formatSuccessSummary","chalk","bold","applyVersionReport","Boolean","getVerOutput","versionOutput","showVersion","getNewOnLaneOutput","desc","c","getNewFromScopeOutput","getSummary","checkedOut","notCheckedOutLegitimately","checkedOutStr","unchangedLegitimatelyStr","newOnLaneNum","newOnLaneAddedStr","newOnLaneStr","newFromScopeNum","newFromScopeStr","buildOutput","notCheckedOutSection","joinSections","getRemovedOutput","getAddedOutput","getWorkspaceConfigUpdateOutput","getConfigMergeConflictsOutput","installationErrorOutput","compilationErrorOutput","details","code"],"sources":["checkout-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Command, CommandOptions, Report } from '@teambit/cli';\nimport {\n formatTitle,\n formatSection,\n formatItem,\n formatSuccessSummary,\n formatHint,\n formatDetailsHint,\n warnSymbol,\n joinSections,\n} from '@teambit/cli';\nimport type { ApplyVersionResults, MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport {\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n getRemovedOutput,\n getAddedOutput,\n getWorkspaceConfigUpdateOutput,\n getConfigMergeConflictsOutput,\n} from '@teambit/component.modules.merge-helper';\nimport { COMPONENT_PATTERN_HELP, HEAD, LATEST } from '@teambit/legacy.constants';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport type { CheckoutMain, CheckoutProps } from './checkout.main.runtime';\n\nexport class CheckoutCmd implements Command {\n name = 'checkout <to> [component-pattern]';\n arguments = [\n {\n name: 'to',\n description:\n \"permitted values: `[head, latest, reset, {specific-version}, {head~x}]`. 'head' - last snap/tag. 'latest' - semver latest tag. 'reset' - removes local changes\",\n },\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n description = 'switch between component versions or remove local changes';\n helpUrl = 'reference/components/merging-changes#checkout-snaps-to-the-working-directory';\n group = 'version-control';\n extendedDescription = `checkout components to specified versions or remove local changes. most commonly used as 'bit checkout head' to get latest versions.\nthe \\`<to>\\` argument accepts these values:\n- head: checkout to last snap/tag (most common usage)\n- specific version: checkout to exact version (e.g. 'bit checkout 1.0.5 component-name')\n- head~x: go back x generations from head (e.g. 'head~2' for two versions back)\n- latest: checkout to latest semver tag\n- reset: remove local modifications and restore original files (also restores deleted component directories)\nwhen on lanes, 'checkout head' only affects lane components. to update main components, run 'bit lane merge main'.`;\n alias = 'U';\n options = [\n [\n 'i',\n 'interactive-merge',\n 'when a component is modified and the merge process found conflicts, display options to resolve them',\n ],\n [\n 'r',\n 'auto-merge-resolve <merge-strategy>',\n 'in case of merge conflict, resolve according to the provided strategy: [ours, theirs, manual]',\n ],\n [\n '',\n 'manual',\n 'same as \"--auto-merge-resolve manual\". in case of merge conflict, write the files with the conflict markers',\n ],\n ['a', 'all', 'all components'],\n [\n 'e',\n 'workspace-only',\n \"only relevant for 'bit checkout head' when on a lane. don't import components from the remote lane that are not already in the workspace\",\n ],\n ['v', 'verbose', 'showing verbose output for inspection'],\n ['x', 'skip-dependency-installation', 'do not auto-install dependencies of the imported components'],\n ['', 'force-ours', 'do not merge, preserve local files as is'],\n ['', 'force-theirs', 'do not merge, just overwrite with incoming files'],\n [\n '',\n 'include-new-from-scope',\n \"relevant for 'bit checkout head'. import components from the defaultScope that don't exist in the workspace\",\n ],\n ] as CommandOptions;\n loader = true;\n\n constructor(private checkout: CheckoutMain) {}\n\n async report(\n [to, componentPattern]: [string, string],\n {\n interactiveMerge = false,\n forceOurs,\n forceTheirs,\n autoMergeResolve,\n manual,\n all = false,\n workspaceOnly = false,\n verbose = false,\n skipDependencyInstallation = false,\n revert = false,\n includeNewFromScope = false,\n }: {\n interactiveMerge?: boolean;\n forceOurs?: boolean;\n forceTheirs?: boolean;\n autoMergeResolve?: MergeStrategy;\n manual?: boolean;\n all?: boolean;\n workspaceOnly?: boolean;\n verbose?: boolean;\n skipDependencyInstallation?: boolean;\n revert?: boolean;\n includeNewFromScope?: boolean;\n }\n ) {\n if (forceOurs && forceTheirs) {\n throw new BitError('please use either --force-ours or --force-theirs, not both');\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 (manual) autoMergeResolve = 'manual';\n if (workspaceOnly && to !== HEAD) {\n throw new BitError('--workspace-only is only relevant when running \"bit checkout head\" on a lane');\n }\n if (includeNewFromScope && to !== HEAD) {\n throw new BitError('--include-new-from-scope is only relevant when running \"bit checkout head\"');\n }\n const checkoutProps: CheckoutProps = {\n promptMergeOptions: interactiveMerge,\n mergeStrategy: autoMergeResolve,\n all,\n verbose,\n isLane: false,\n skipNpmInstall: skipDependencyInstallation,\n workspaceOnly,\n revert,\n forceOurs,\n forceTheirs,\n includeNewFromScope,\n };\n to = String(to); // it can be a number in case short-hash is used\n if (to === HEAD) checkoutProps.head = true;\n else if (to === LATEST) checkoutProps.latest = true;\n else if (to === 'reset') checkoutProps.reset = true;\n else if (to === 'main') checkoutProps.main = true;\n else if (to.startsWith(`${HEAD}~`)) {\n const ancestor = parseInt(to.split('~')[1]);\n if (Number.isNaN(ancestor))\n throw new BitError(`the character after \"${HEAD}~\" must be a number, got ${ancestor}`);\n checkoutProps.ancestor = ancestor;\n } else {\n if (!ComponentID.isValidVersion(to)) throw new BitError(`the specified version \"${to}\" is not a valid version`);\n checkoutProps.version = to;\n }\n\n const checkoutResults = await this.checkout.checkoutByCLIValues(componentPattern || '', checkoutProps);\n return checkoutOutput(checkoutResults, checkoutProps);\n }\n}\n\nexport function checkoutOutput(\n checkoutResults: ApplyVersionResults,\n checkoutProps: CheckoutProps,\n alternativeTitle?: string\n): string | Report {\n const {\n components,\n version,\n failedComponents,\n removedComponents,\n addedComponents,\n leftUnresolvedConflicts,\n configMergeConflicts,\n workspaceConfigUpdateResult,\n newFromLane,\n newFromLaneAdded,\n newFromScope,\n installationError,\n compilationError,\n }: ApplyVersionResults = checkoutResults;\n\n const { head, reset, latest, main, revert, verbose, all } = checkoutProps;\n\n // components that failed for no legitimate reason. e.g. merge-conflict.\n const realFailedComponents = (failedComponents || []).filter((f) => !f.unchangedLegitimately);\n if (realFailedComponents.length) {\n throw new Error('checkout should throw in case of errors');\n }\n // components that weren't checked out for legitimate reasons, e.g. up-to-date.\n const notCheckedOutComponents = failedComponents || [];\n\n const hasSkippedComponents = notCheckedOutComponents.length > 0 && all && !verbose;\n\n const getNotCheckedOutOutputMinimal = () => {\n if (!notCheckedOutComponents.length) return '';\n if (all && !verbose) {\n return formatDetailsHint(`full list of ${notCheckedOutComponents.length} skipped component(s)`);\n }\n const items = notCheckedOutComponents.map((failedComponent) =>\n formatItem(`${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`)\n );\n return formatSection('checkout skipped', '', items);\n };\n\n const getNotCheckedOutOutputDetailed = () => {\n if (!notCheckedOutComponents.length) return '';\n const items = notCheckedOutComponents.map((failedComponent) =>\n formatItem(`${failedComponent.id.toString()} - ${failedComponent.unchangedMessage}`)\n );\n return formatSection('checkout skipped', '', items);\n };\n const getWsConfigUpdateLogs = () => {\n const logs = workspaceConfigUpdateResult?.logs;\n if (!logs || !logs.length) return '';\n const logsStr = logs.join('\\n');\n return `${formatTitle('verbose logs of workspace config update')}\\n${logsStr}`;\n };\n const getConflictSummary = () => {\n if (!components || !components.length || !leftUnresolvedConflicts) return '';\n const title = formatTitle(`${warnSymbol} files with conflicts summary`);\n const conflictSummary = conflictSummaryReport(components);\n const suggestion = formatHint(\n `fix the conflicts above manually and then run \"bit install\".\\nonce ready, snap/tag the components to persist the changes`\n );\n return `${title}\\n${conflictSummary.conflictStr}\\n\\n${suggestion}`;\n };\n const getSuccessfulOutput = () => {\n if (!components || !components.length) return '';\n const switchedOrReverted = revert ? 'reverted' : 'switched';\n if (components.length === 1) {\n const component = components[0];\n const componentName = reset ? component.id.toString() : component.id.toStringWithoutVersion();\n if (reset) return formatSuccessSummary(`successfully reset ${chalk.bold(componentName)}`);\n const title =\n alternativeTitle ||\n `successfully ${switchedOrReverted} ${chalk.bold(componentName)} to version ${chalk.bold(\n head || latest ? component.id.version : version\n )}`;\n return [formatSuccessSummary(title), applyVersionReport(components, false)].filter(Boolean).join('\\n');\n }\n if (reset) {\n const items = components.map((component) => formatItem(component.id.toString()));\n return formatSection('reset components', '', items);\n }\n const getVerOutput = () => {\n if (head) return 'their head version';\n if (latest) return 'their latest version';\n if (main) return 'their main version';\n return `version ${chalk.bold(version)}`;\n };\n const versionOutput = getVerOutput();\n const title =\n alternativeTitle || `successfully ${switchedOrReverted} ${components.length} components to ${versionOutput}`;\n const showVersion = head || reset;\n return [formatSuccessSummary(title), applyVersionReport(components, true, showVersion)].filter(Boolean).join('\\n');\n };\n const getNewOnLaneOutput = () => {\n if (!newFromLane?.length) return '';\n const title = newFromLaneAdded ? 'new components from lane' : 'new components on lane (not added)';\n const desc = newFromLaneAdded ? '' : 'omit --workspace-only flag to add them';\n const items = newFromLane.map((c) => formatItem(c.toString()));\n return formatSection(title, desc, items);\n };\n const getNewFromScopeOutput = () => {\n if (!newFromScope?.length) return '';\n const items = newFromScope.map((c) => formatItem(c.toString()));\n return formatSection('new components from scope', '', items);\n };\n const getSummary = () => {\n const checkedOut = components?.length || 0;\n const notCheckedOutLegitimately = notCheckedOutComponents.length;\n const title = formatTitle('Checkout Summary');\n const checkedOutStr = `\\nTotal Changed: ${chalk.bold(checkedOut.toString())}`;\n const unchangedLegitimatelyStr = `\\nTotal Unchanged: ${chalk.bold(notCheckedOutLegitimately.toString())}`;\n const newOnLaneNum = newFromLane?.length || 0;\n const newOnLaneAddedStr = newFromLaneAdded ? ' (added)' : ' (not added)';\n const newOnLaneStr = newOnLaneNum\n ? `\\nNew on lane${newOnLaneAddedStr}: ${chalk.bold(newOnLaneNum.toString())}`\n : '';\n const newFromScopeNum = newFromScope?.length || 0;\n const newFromScopeStr = newFromScopeNum\n ? `\\nNew from scope (imported): ${chalk.bold(newFromScopeNum.toString())}`\n : '';\n\n return title + checkedOutStr + unchangedLegitimatelyStr + newOnLaneStr + newFromScopeStr;\n };\n\n const buildOutput = (notCheckedOutSection: string) =>\n joinSections([\n getWsConfigUpdateLogs(),\n notCheckedOutSection,\n getSuccessfulOutput(),\n getRemovedOutput(removedComponents),\n getAddedOutput(addedComponents),\n getNewOnLaneOutput(),\n getNewFromScopeOutput(),\n getWorkspaceConfigUpdateOutput(workspaceConfigUpdateResult),\n getConflictSummary(),\n getConfigMergeConflictsOutput(configMergeConflicts || [], 'snap/tag the components to persist the changes'),\n getSummary(),\n installationErrorOutput(installationError),\n compilationErrorOutput(compilationError),\n ]);\n\n if (!hasSkippedComponents) {\n return buildOutput(getNotCheckedOutOutputMinimal());\n }\n\n const data = buildOutput(getNotCheckedOutOutputMinimal());\n const details = buildOutput(getNotCheckedOutOutputDetailed());\n return { data, code: 0, details };\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;AAEA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAWA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YA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AC,EACnC,IAAAyE,kCAAc,EAACxE,eAAe,CAAC,EAC/BsD,kBAAkB,CAAC,CAAC,EACpBG,qBAAqB,CAAC,CAAC,EACvB,IAAAgB,kDAA8B,EAACtE,2BAA2B,CAAC,EAC3D8B,kBAAkB,CAAC,CAAC,EACpB,IAAAyC,iDAA6B,EAACxE,oBAAoB,IAAI,EAAE,EAAE,gDAAgD,CAAC,EAC3GwD,UAAU,CAAC,CAAC,EACZ,IAAAiB,2CAAuB,EAACpE,iBAAiB,CAAC,EAC1C,IAAAqE,0CAAsB,EAACpE,gBAAgB,CAAC,CACzC,CAAC;EAEJ,IAAI,CAACQ,oBAAoB,EAAE;IACzB,OAAOoD,WAAW,CAACnD,6BAA6B,CAAC,CAAC,CAAC;EACrD;EAEA,MAAM9F,IAAI,GAAGiJ,WAAW,CAACnD,6BAA6B,CAAC,CAAC,CAAC;EACzD,MAAM4D,OAAO,GAAGT,WAAW,CAACzC,8BAA8B,CAAC,CAAC,CAAC;EAC7D,OAAO;IAAExG,IAAI;IAAE2J,IAAI,EAAE,CAAC;IAAED;EAAQ,CAAC;AACnC","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Consumer } from '@teambit/legacy.consumer';
|
|
2
|
+
import type { ConfigMergeResult } from '@teambit/config-merger';
|
|
2
3
|
import type { ComponentID } from '@teambit/component-id';
|
|
3
4
|
import type { Version } from '@teambit/objects';
|
|
4
5
|
import type { SourceFile } from '@teambit/component.sources';
|
|
@@ -15,6 +16,7 @@ export type ComponentStatusBase = {
|
|
|
15
16
|
};
|
|
16
17
|
export type ComponentStatus = ComponentStatusBase & {
|
|
17
18
|
mergeResults?: MergeResultsThreeWay | null | undefined;
|
|
19
|
+
configMergeResult?: ConfigMergeResult;
|
|
18
20
|
};
|
|
19
21
|
export type ApplyVersionWithComps = {
|
|
20
22
|
applyVersionResult: ApplyVersionResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_component","data","require","_legacy","_legacy2","_bitError","_chalk","_interopRequireDefault","_componentModules","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","applyVersion","consumer","id","componentFromFS","mergeResults","checkoutProps","isLane","Error","toString","mergeStrategy","forceOurs","filesStatus","hasConflicts","MergeOptions","ours","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","bitMap","updateComponentId","applyVersionResult","component","loadComponentFromModelImportIfNeeded","componentMap","BitError","updateFileStatus","undefined","removeFilesIfNeeded","modifiedStatus","modifiedFiles","applyModifiedVersion","fileFromFs","find","f","areFilesEqual","Buffer","compare","contents","updated","isExistOnFs","getComponentIdIfExist","ignoreVersion","filePathsFromFS","dataToPersist","DataToPersist","filename","isWorkspaceMapFile","rootDir","WORKSPACE_ROOT_DIR","removed","removePath","RemovePath","path","persistAllToFS","throwForFailures","allComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","map","failedComponent","chalk","bold","red","join"],"sources":["checkout-version.ts"],"sourcesContent":["import type { Consumer } from '@teambit/legacy.consumer';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { Version } from '@teambit/objects';\nimport type { SourceFile } from '@teambit/component.sources';\nimport { RemovePath, DataToPersist } from '@teambit/component.sources';\nimport { pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport { isWorkspaceMapFile, WORKSPACE_ROOT_DIR } from '@teambit/legacy.bit-map';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport type { ApplyVersionResult, FilesStatus, MergeResultsThreeWay } from '@teambit/component.modules.merge-helper';\nimport { applyModifiedVersion, FileStatus, MergeOptions } from '@teambit/component.modules.merge-helper';\nimport type { CheckoutProps } from './checkout.main.runtime';\n\nexport type ComponentStatusBase = {\n currentComponent?: ConsumerComponent;\n componentFromModel?: Version;\n id: ComponentID;\n shouldBeRemoved?: boolean; // in case the component is soft-removed, it should be removed from the workspace\n unchangedMessage?: string; // this gets populated either upon skip or failure.\n unchangedLegitimately?: boolean; // true for skipped legitimately (e.g. already up to date). false for failure.\n};\n\nexport type ComponentStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null | undefined;\n};\n\nexport type ApplyVersionWithComps = {\n applyVersionResult: ApplyVersionResult;\n component?: ConsumerComponent;\n // in case the component needs to be written to the filesystem, this is the component to write.\n legacyCompToWrite?: ConsumerComponent;\n};\n\n/**\n * This function optionally returns \"component\" object. If it returns, it means it needs to be written to the filesystem.\n * Otherwise, it means the component is already up to date and no need to write it.\n *\n * If no need to change anything (ours), then don't return the component object.\n * Otherwise, either return the component object as is (if no conflicts or \"theirs\"), or change the files in this\n * component object. Later, this component object is written to the filesystem.\n *\n * 1) when the files are modified with conflicts and the strategy is \"ours\", or forceOurs was used, leave the FS as is.\n *\n * 2) when the files are modified with conflicts and the strategy is \"theirs\", or forceTheirs was used, write the\n * component according to \"component\" object\n *\n * 3) when files are modified with no conflict or files are modified with conflicts and the\n * strategy is manual, load the component according to id.version and update component.files.\n * applyModifiedVersion() docs explains what files are updated/added.\n *\n * Side note:\n * Deleted file => if files are in used version but not in the modified one, no need to delete it. (similar to git).\n * Added file => if files are not in used version but in the modified one, they'll be under mergeResults.addFiles\n */\nexport async function applyVersion(\n consumer: Consumer,\n id: ComponentID,\n componentFromFS: ConsumerComponent | null | undefined, // it can be null only when isLanes is true\n mergeResults: MergeResultsThreeWay | null | undefined,\n checkoutProps: CheckoutProps\n): Promise<ApplyVersionWithComps> {\n if (!checkoutProps.isLane && !componentFromFS)\n throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n const { mergeStrategy, forceOurs } = checkoutProps;\n let filesStatus = {};\n // \"keep ours\" is meaningful only when the component is on the filesystem. during a lane\n // switch/import (isLane), a component may exist on the lane but not in the workspace at all -\n // there are no local files to preserve, so fall through and write it from the model.\n if (componentFromFS && ((mergeResults?.hasConflicts && mergeStrategy === MergeOptions.ours) || forceOurs)) {\n componentFromFS.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n consumer.bitMap.updateComponentId(id);\n return { applyVersionResult: { id, filesStatus } };\n }\n const component = await consumer.loadComponentFromModelImportIfNeeded(id);\n const componentMap = componentFromFS && componentFromFS.componentMap;\n if (componentFromFS && !componentMap) throw new BitError('applyVersion: componentMap was not found');\n\n const files = component.files;\n updateFileStatus(files, filesStatus, componentFromFS || undefined);\n\n await removeFilesIfNeeded(filesStatus, consumer, componentFromFS || undefined);\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n filesStatus = { ...filesStatus, ...modifiedStatus };\n component.files = modifiedFiles;\n }\n\n // in case of forceTheirs, the mergeResults is undefined, the \"component\" object is according to \"theirs\", so it'll work\n // expected. (later, it writes the component object).\n\n return {\n applyVersionResult: { id, filesStatus },\n component,\n };\n}\n\nexport function updateFileStatus(files: SourceFile[], filesStatus: FilesStatus, componentFromFS?: ConsumerComponent) {\n files.forEach((file) => {\n const fileFromFs = componentFromFS?.files.find((f) => f.relative === file.relative);\n const areFilesEqual = fileFromFs && Buffer.compare(fileFromFs.contents, file.contents) === 0;\n // @ts-ignore\n filesStatus[pathNormalizeToLinux(file.relative)] = areFilesEqual ? FileStatus.unchanged : FileStatus.updated;\n });\n}\n\n/**\n * when files exist on the filesystem but not on the checked out versions, they need to be deleted.\n * without this function, these files would be left on the filesystem. (we don't delete the comp-dir before writing).\n * this needs to be done *before* the component is written to the filesystem, otherwise, it won't work when a file\n * has a case change. e.g. from uppercase to lowercase. (see merge-lane.e2e 'renaming files from uppercase to lowercase').\n */\nexport async function removeFilesIfNeeded(\n filesStatus: FilesStatus,\n consumer: Consumer,\n componentFromFS?: ConsumerComponent\n) {\n if (!componentFromFS) return;\n // @todo: if the component is not in the FS, it should be passed as undefined here.\n // in the case this is coming from merge-lane, it's sometimes populated from the scope.\n const isExistOnFs = consumer.bitMap.getComponentIdIfExist(componentFromFS.id, { ignoreVersion: true });\n if (!isExistOnFs) return;\n const filePathsFromFS = componentFromFS.files || [];\n const dataToPersist = new DataToPersist();\n filePathsFromFS.forEach((file) => {\n const filename = pathNormalizeToLinux(file.relative);\n // the live .bitmap is never deleted from a versioned copy, see isWorkspaceMapFile. only the root\n // component tracks it, an ordinary component's is a file like any other.\n if (isWorkspaceMapFile(filename) && componentFromFS.componentMap?.rootDir === WORKSPACE_ROOT_DIR) return;\n if (!filesStatus[filename]) {\n // @ts-ignore todo: typescript has a good point here. it should be the string \"removed\", not chalk.green(removed).\n filesStatus[filename] = FileStatus.removed;\n }\n if (filesStatus[filename] === FileStatus.removed) {\n dataToPersist.removePath(new RemovePath(file.path));\n }\n });\n await dataToPersist.persistAllToFS();\n}\n\nexport function throwForFailures(allComponentsStatus: ComponentStatusBase[]) {\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to proceed due to the following failures:\\n${failureMsgs}`);\n }\n}\n"],"mappings":";;;;;;;;;AAIA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA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}
|
|
1
|
+
{"version":3,"names":["_component","data","require","_legacy","_legacy2","_bitError","_chalk","_interopRequireDefault","_componentModules","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","applyVersion","consumer","id","componentFromFS","mergeResults","checkoutProps","isLane","Error","toString","mergeStrategy","forceOurs","filesStatus","hasConflicts","MergeOptions","ours","files","file","pathNormalizeToLinux","relative","FileStatus","unchanged","bitMap","updateComponentId","applyVersionResult","component","loadComponentFromModelImportIfNeeded","componentMap","BitError","updateFileStatus","undefined","removeFilesIfNeeded","modifiedStatus","modifiedFiles","applyModifiedVersion","fileFromFs","find","f","areFilesEqual","Buffer","compare","contents","updated","isExistOnFs","getComponentIdIfExist","ignoreVersion","filePathsFromFS","dataToPersist","DataToPersist","filename","isWorkspaceMapFile","rootDir","WORKSPACE_ROOT_DIR","removed","removePath","RemovePath","path","persistAllToFS","throwForFailures","allComponentsStatus","failedComponents","c","unchangedMessage","unchangedLegitimately","failureMsgs","map","failedComponent","chalk","bold","red","join"],"sources":["checkout-version.ts"],"sourcesContent":["import type { Consumer } from '@teambit/legacy.consumer';\nimport type { ConfigMergeResult } from '@teambit/config-merger';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { Version } from '@teambit/objects';\nimport type { SourceFile } from '@teambit/component.sources';\nimport { RemovePath, DataToPersist } from '@teambit/component.sources';\nimport { pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport { isWorkspaceMapFile, WORKSPACE_ROOT_DIR } from '@teambit/legacy.bit-map';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { BitError } from '@teambit/bit-error';\nimport chalk from 'chalk';\nimport type { ApplyVersionResult, FilesStatus, MergeResultsThreeWay } from '@teambit/component.modules.merge-helper';\nimport { applyModifiedVersion, FileStatus, MergeOptions } from '@teambit/component.modules.merge-helper';\nimport type { CheckoutProps } from './checkout.main.runtime';\n\nexport type ComponentStatusBase = {\n currentComponent?: ConsumerComponent;\n componentFromModel?: Version;\n id: ComponentID;\n shouldBeRemoved?: boolean; // in case the component is soft-removed, it should be removed from the workspace\n unchangedMessage?: string; // this gets populated either upon skip or failure.\n unchangedLegitimately?: boolean; // true for skipped legitimately (e.g. already up to date). false for failure.\n};\n\nexport type ComponentStatus = ComponentStatusBase & {\n mergeResults?: MergeResultsThreeWay | null | undefined;\n configMergeResult?: ConfigMergeResult; // set only when the local config (.bitmap) conflicts with the checked out version\n};\n\nexport type ApplyVersionWithComps = {\n applyVersionResult: ApplyVersionResult;\n component?: ConsumerComponent;\n // in case the component needs to be written to the filesystem, this is the component to write.\n legacyCompToWrite?: ConsumerComponent;\n};\n\n/**\n * This function optionally returns \"component\" object. If it returns, it means it needs to be written to the filesystem.\n * Otherwise, it means the component is already up to date and no need to write it.\n *\n * If no need to change anything (ours), then don't return the component object.\n * Otherwise, either return the component object as is (if no conflicts or \"theirs\"), or change the files in this\n * component object. Later, this component object is written to the filesystem.\n *\n * 1) when the files are modified with conflicts and the strategy is \"ours\", or forceOurs was used, leave the FS as is.\n *\n * 2) when the files are modified with conflicts and the strategy is \"theirs\", or forceTheirs was used, write the\n * component according to \"component\" object\n *\n * 3) when files are modified with no conflict or files are modified with conflicts and the\n * strategy is manual, load the component according to id.version and update component.files.\n * applyModifiedVersion() docs explains what files are updated/added.\n *\n * Side note:\n * Deleted file => if files are in used version but not in the modified one, no need to delete it. (similar to git).\n * Added file => if files are not in used version but in the modified one, they'll be under mergeResults.addFiles\n */\nexport async function applyVersion(\n consumer: Consumer,\n id: ComponentID,\n componentFromFS: ConsumerComponent | null | undefined, // it can be null only when isLanes is true\n mergeResults: MergeResultsThreeWay | null | undefined,\n checkoutProps: CheckoutProps\n): Promise<ApplyVersionWithComps> {\n if (!checkoutProps.isLane && !componentFromFS)\n throw new Error(`applyVersion expect to get componentFromFS for ${id.toString()}`);\n const { mergeStrategy, forceOurs } = checkoutProps;\n let filesStatus = {};\n // \"keep ours\" is meaningful only when the component is on the filesystem. during a lane\n // switch/import (isLane), a component may exist on the lane but not in the workspace at all -\n // there are no local files to preserve, so fall through and write it from the model.\n if (componentFromFS && ((mergeResults?.hasConflicts && mergeStrategy === MergeOptions.ours) || forceOurs)) {\n componentFromFS.files.forEach((file) => {\n filesStatus[pathNormalizeToLinux(file.relative)] = FileStatus.unchanged;\n });\n consumer.bitMap.updateComponentId(id);\n return { applyVersionResult: { id, filesStatus } };\n }\n const component = await consumer.loadComponentFromModelImportIfNeeded(id);\n const componentMap = componentFromFS && componentFromFS.componentMap;\n if (componentFromFS && !componentMap) throw new BitError('applyVersion: componentMap was not found');\n\n const files = component.files;\n updateFileStatus(files, filesStatus, componentFromFS || undefined);\n\n await removeFilesIfNeeded(filesStatus, consumer, componentFromFS || undefined);\n\n if (mergeResults) {\n // update files according to the merge results\n const { filesStatus: modifiedStatus, modifiedFiles } = applyModifiedVersion(files, mergeResults, mergeStrategy);\n filesStatus = { ...filesStatus, ...modifiedStatus };\n component.files = modifiedFiles;\n }\n\n // in case of forceTheirs, the mergeResults is undefined, the \"component\" object is according to \"theirs\", so it'll work\n // expected. (later, it writes the component object).\n\n return {\n applyVersionResult: { id, filesStatus },\n component,\n };\n}\n\nexport function updateFileStatus(files: SourceFile[], filesStatus: FilesStatus, componentFromFS?: ConsumerComponent) {\n files.forEach((file) => {\n const fileFromFs = componentFromFS?.files.find((f) => f.relative === file.relative);\n const areFilesEqual = fileFromFs && Buffer.compare(fileFromFs.contents, file.contents) === 0;\n // @ts-ignore\n filesStatus[pathNormalizeToLinux(file.relative)] = areFilesEqual ? FileStatus.unchanged : FileStatus.updated;\n });\n}\n\n/**\n * when files exist on the filesystem but not on the checked out versions, they need to be deleted.\n * without this function, these files would be left on the filesystem. (we don't delete the comp-dir before writing).\n * this needs to be done *before* the component is written to the filesystem, otherwise, it won't work when a file\n * has a case change. e.g. from uppercase to lowercase. (see merge-lane.e2e 'renaming files from uppercase to lowercase').\n */\nexport async function removeFilesIfNeeded(\n filesStatus: FilesStatus,\n consumer: Consumer,\n componentFromFS?: ConsumerComponent\n) {\n if (!componentFromFS) return;\n // @todo: if the component is not in the FS, it should be passed as undefined here.\n // in the case this is coming from merge-lane, it's sometimes populated from the scope.\n const isExistOnFs = consumer.bitMap.getComponentIdIfExist(componentFromFS.id, { ignoreVersion: true });\n if (!isExistOnFs) return;\n const filePathsFromFS = componentFromFS.files || [];\n const dataToPersist = new DataToPersist();\n filePathsFromFS.forEach((file) => {\n const filename = pathNormalizeToLinux(file.relative);\n // the live .bitmap is never deleted from a versioned copy, see isWorkspaceMapFile. only the root\n // component tracks it, an ordinary component's is a file like any other.\n if (isWorkspaceMapFile(filename) && componentFromFS.componentMap?.rootDir === WORKSPACE_ROOT_DIR) return;\n if (!filesStatus[filename]) {\n // @ts-ignore todo: typescript has a good point here. it should be the string \"removed\", not chalk.green(removed).\n filesStatus[filename] = FileStatus.removed;\n }\n if (filesStatus[filename] === FileStatus.removed) {\n dataToPersist.removePath(new RemovePath(file.path));\n }\n });\n await dataToPersist.persistAllToFS();\n}\n\nexport function throwForFailures(allComponentsStatus: ComponentStatusBase[]) {\n const failedComponents = allComponentsStatus.filter((c) => c.unchangedMessage && !c.unchangedLegitimately);\n if (failedComponents.length) {\n const failureMsgs = failedComponents\n .map(\n (failedComponent) =>\n `${chalk.bold(failedComponent.id.toString())} - ${chalk.red(failedComponent.unchangedMessage as string)}`\n )\n .join('\\n');\n throw new BitError(`unable to proceed due to the following failures:\\n${failureMsgs}`);\n }\n}\n"],"mappings":";;;;;;;;;AAKA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,G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C3G,CAAC,CACAQ,IAAI,CAAC,IAAI,CAAC;IACb,MAAM,KAAI1C,oBAAQ,EAAC,qDAAqDoC,WAAW,EAAE,CAAC;EACxF;AACF","ignoreList":[]}
|
|
@@ -55,6 +55,21 @@ export declare class CheckoutMain {
|
|
|
55
55
|
private lister;
|
|
56
56
|
constructor(workspace: Workspace, logger: Logger, componentWriter: ComponentWriterMain, importer: ImporterMain, remove: RemoveMain, lister: ListerMain);
|
|
57
57
|
checkout(checkoutProps: CheckoutProps): Promise<ApplyVersionResults>;
|
|
58
|
+
/**
|
|
59
|
+
* checkout keeps the local config of a component (the .bitmap "config", e.g. from "bit env set") on top of the
|
|
60
|
+
* checked out version. when the checked out version changed the same aspect differently, it's a conflict, same as
|
|
61
|
+
* a conflict in a file. only the aspects that are set locally are checked. the other aspects get their config from
|
|
62
|
+
* the checked out version anyway.
|
|
63
|
+
* the merge runs with "manual" to find the conflicts. the strategy of the user is applied by applyLocalConfigConflicts.
|
|
64
|
+
*/
|
|
65
|
+
private getLocalConfigMergeResult;
|
|
66
|
+
/**
|
|
67
|
+
* "ours" keeps the local config. "theirs" removes the conflicted aspects from the local config, so the checked out
|
|
68
|
+
* version wins. "manual" removes them as well and writes the conflicts into the config-merge file for the user to
|
|
69
|
+
* resolve, same as "bit merge" does.
|
|
70
|
+
* returns the component ids that were left with config conflicts.
|
|
71
|
+
*/
|
|
72
|
+
private applyLocalConfigConflicts;
|
|
58
73
|
/**
|
|
59
74
|
* if .bitmap entry exists but the rootDir is missing from the filesystem, find the component in the scope and restore it.
|
|
60
75
|
* returns the restored component ids.
|
|
@@ -158,6 +158,20 @@ function _legacy4() {
|
|
|
158
158
|
};
|
|
159
159
|
return data;
|
|
160
160
|
}
|
|
161
|
+
function _configMerger() {
|
|
162
|
+
const data = require("@teambit/config-merger");
|
|
163
|
+
_configMerger = function () {
|
|
164
|
+
return data;
|
|
165
|
+
};
|
|
166
|
+
return data;
|
|
167
|
+
}
|
|
168
|
+
function _localConfigMerge() {
|
|
169
|
+
const data = require("./local-config-merge");
|
|
170
|
+
_localConfigMerge = function () {
|
|
171
|
+
return data;
|
|
172
|
+
};
|
|
173
|
+
return data;
|
|
174
|
+
}
|
|
161
175
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
162
176
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
163
177
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -217,9 +231,11 @@ class CheckoutMain {
|
|
|
217
231
|
const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();
|
|
218
232
|
const allComponentsStatus = [...compStatusMergeNeeded, ...compsNotNeedMerge];
|
|
219
233
|
const componentWithConflict = allComponentsStatus.find(component => component.mergeResults && component.mergeResults.hasConflicts);
|
|
220
|
-
|
|
234
|
+
const componentWithConfigConflict = allComponentsStatus.find(component => component.configMergeResult?.hasConflicts());
|
|
235
|
+
const conflictedComponent = componentWithConflict || componentWithConfigConflict;
|
|
236
|
+
if (conflictedComponent) {
|
|
221
237
|
if (!promptMergeOptions && !checkoutProps.mergeStrategy) {
|
|
222
|
-
throw new (_bitError().BitError)(`automatic merge has failed for component ${
|
|
238
|
+
throw new (_bitError().BitError)(`automatic merge has failed for component ${conflictedComponent.id.toStringWithoutVersion()}.\nplease use "--auto-merge-resolve" with 'manual', 'ours' or 'theirs' to resolve the conflict/s`);
|
|
223
239
|
}
|
|
224
240
|
if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await (0, _componentModules().getMergeStrategyInteractive)();
|
|
225
241
|
}
|
|
@@ -272,12 +288,13 @@ class CheckoutMain {
|
|
|
272
288
|
componentsLegacy.push(...compsNewFromScope);
|
|
273
289
|
}
|
|
274
290
|
}
|
|
291
|
+
const configMergeConflicts = await this.applyLocalConfigConflicts(allComponentsStatus, checkoutProps.mergeStrategy);
|
|
275
292
|
const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';
|
|
276
293
|
let componentWriterResults;
|
|
277
294
|
if (componentsLegacy.length) {
|
|
278
295
|
const manyComponentsWriterOpts = {
|
|
279
296
|
components: componentsLegacy,
|
|
280
|
-
skipDependencyInstallation: checkoutProps.skipNpmInstall || leftUnresolvedConflicts,
|
|
297
|
+
skipDependencyInstallation: checkoutProps.skipNpmInstall || leftUnresolvedConflicts || Boolean(configMergeConflicts?.length),
|
|
281
298
|
verbose: checkoutProps.verbose,
|
|
282
299
|
resetConfig: checkoutProps.reset,
|
|
283
300
|
skipUpdatingBitMap: checkoutProps.skipUpdatingBitmap || checkoutProps.revert,
|
|
@@ -303,6 +320,7 @@ class CheckoutMain {
|
|
|
303
320
|
version,
|
|
304
321
|
failedComponents,
|
|
305
322
|
leftUnresolvedConflicts,
|
|
323
|
+
configMergeConflicts,
|
|
306
324
|
newFromLane: newFromLane?.map(n => n.toString()),
|
|
307
325
|
newFromLaneAdded,
|
|
308
326
|
newFromScope: newFromScope?.map(n => n.toString()),
|
|
@@ -312,6 +330,53 @@ class CheckoutMain {
|
|
|
312
330
|
};
|
|
313
331
|
}
|
|
314
332
|
|
|
333
|
+
/**
|
|
334
|
+
* checkout keeps the local config of a component (the .bitmap "config", e.g. from "bit env set") on top of the
|
|
335
|
+
* checked out version. when the checked out version changed the same aspect differently, it's a conflict, same as
|
|
336
|
+
* a conflict in a file. only the aspects that are set locally are checked. the other aspects get their config from
|
|
337
|
+
* the checked out version anyway.
|
|
338
|
+
* the merge runs with "manual" to find the conflicts. the strategy of the user is applied by applyLocalConfigConflicts.
|
|
339
|
+
*/
|
|
340
|
+
getLocalConfigMergeResult(id, currentComponent, baseComponent, otherComponent, currentLabel) {
|
|
341
|
+
const localConfig = this.workspace.bitMap.getBitmapEntryIfExist(id, {
|
|
342
|
+
ignoreVersion: true
|
|
343
|
+
})?.config;
|
|
344
|
+
if (!localConfig) return undefined;
|
|
345
|
+
const result = new (_configMerger().ComponentConfigMerger)(id.toStringWithoutVersion(), this.workspace.listIds(), undefined, currentComponent.extensions, baseComponent.extensions, otherComponent.extensions, currentLabel, id.version, this.logger, 'manual').merge().filterByAspects(aspectId => (0, _localConfigMerge().isAspectInLocalConfig)(aspectId, localConfig));
|
|
346
|
+
return result.hasConflicts() ? result : undefined;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* "ours" keeps the local config. "theirs" removes the conflicted aspects from the local config, so the checked out
|
|
351
|
+
* version wins. "manual" removes them as well and writes the conflicts into the config-merge file for the user to
|
|
352
|
+
* resolve, same as "bit merge" does.
|
|
353
|
+
* returns the component ids that were left with config conflicts.
|
|
354
|
+
*/
|
|
355
|
+
async applyLocalConfigConflicts(componentsStatus, mergeStrategy) {
|
|
356
|
+
const withConflicts = componentsStatus.filter(c => c.configMergeResult?.hasConflicts());
|
|
357
|
+
if (!withConflicts.length || mergeStrategy === 'ours') return undefined;
|
|
358
|
+
const conflictFile = this.workspace.getConflictMergeFile();
|
|
359
|
+
for (const {
|
|
360
|
+
id,
|
|
361
|
+
configMergeResult
|
|
362
|
+
} of withConflicts) {
|
|
363
|
+
if (!configMergeResult) continue;
|
|
364
|
+
const localConfig = this.workspace.bitMap.getBitmapEntry(id, {
|
|
365
|
+
ignoreVersion: true
|
|
366
|
+
}).config || {};
|
|
367
|
+
for (const key of (0, _localConfigMerge().getLocalConfigKeysToRemove)(localConfig, configMergeResult.getConflictedAspectIds())) {
|
|
368
|
+
await this.workspace.removeSpecificComponentConfig(id, key);
|
|
369
|
+
}
|
|
370
|
+
this.workspace.clearComponentCache(id);
|
|
371
|
+
if (mergeStrategy === 'manual') {
|
|
372
|
+
const conflict = configMergeResult.generateMergeConflictFile();
|
|
373
|
+
if (conflict) conflictFile.addConflict(configMergeResult.compIdStr, conflict);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
await conflictFile.write(); // no-op when there are no conflicts
|
|
377
|
+
return mergeStrategy === 'manual' ? withConflicts.map(c => c.id.toStringWithoutVersion()) : undefined;
|
|
378
|
+
}
|
|
379
|
+
|
|
315
380
|
/**
|
|
316
381
|
* if .bitmap entry exists but the rootDir is missing from the filesystem, find the component in the scope and restore it.
|
|
317
382
|
* returns the restored component ids.
|
|
@@ -699,19 +764,23 @@ class CheckoutMain {
|
|
|
699
764
|
baseVersion = parent.toString();
|
|
700
765
|
baseComponent = await componentModel.loadVersion(baseVersion, repo);
|
|
701
766
|
}
|
|
767
|
+
const currentLabel = `${currentlyUsedVersion} modified`;
|
|
702
768
|
const mergeResults = await (0, _componentModules().threeWayMerge)({
|
|
703
769
|
scope: consumer.scope,
|
|
704
770
|
otherComponent,
|
|
705
771
|
otherLabel: loadStash ? 'stash' : newVersion,
|
|
706
772
|
currentComponent: componentFromFS,
|
|
707
|
-
currentLabel
|
|
773
|
+
currentLabel,
|
|
708
774
|
baseComponent
|
|
709
775
|
});
|
|
776
|
+
// a stash doesn't update the .bitmap, so there is no local config to merge
|
|
777
|
+
const configMergeResult = loadStash || checkoutProps.skipUpdatingBitmap ? undefined : this.getLocalConfigMergeResult(id, componentFromFS, baseComponent, otherComponent, currentLabel);
|
|
710
778
|
return {
|
|
711
779
|
currentComponent: componentFromFS,
|
|
712
780
|
componentFromModel,
|
|
713
781
|
id,
|
|
714
|
-
mergeResults
|
|
782
|
+
mergeResults,
|
|
783
|
+
configMergeResult
|
|
715
784
|
};
|
|
716
785
|
}
|
|
717
786
|
static async provider([cli, workspace, loggerMain, compWriter, importer, remove, lister]) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_harmonyModules","data","require","_cli","_logger","_workspace","_bitError","_lodash","_remove","_componentModules","_importer","_lister","_legacy","_componentWriter","_pMapSeries","_interopRequireDefault","_componentId","_objects","_legacy2","_legacy3","_checkoutCmd","_checkout","_checkoutVersion","_revertCmd","_legacy4","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckoutMain","constructor","workspace","logger","componentWriter","importer","remove","lister","checkout","checkoutProps","ensureCheckoutConfiguration","inInstallContext","version","ids","promptMergeOptions","syncNewComponents","addedComponents","restoreMissingComponents","newComponents","addNewComponents","bitIds","ComponentIdList","fromArray","allComponentStatusBeforeMerge","mapSeries","id","getComponentStatusBeforeMergeAttempt","compsNeedMerge","c","propsForMerge","compsNotNeedMerge","toImport","map","compStatus","idsToImport","changeVersion","currentlyUsedVersion","flat","scope","legacyScope","scopeImporter","importWithoutDeps","cache","lane","consumer","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","Promise","all","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","component","mergeResults","hasConflicts","mergeStrategy","BitError","toStringWithoutVersion","getMergeStrategyInteractive","throwForFailures","failedComponents","componentStatus","unchangedMessage","shouldBeRemoved","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","currentComponent","applyVersion","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","restrictToScopes","includes","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","newFromScope","includeNewFromScope","getNewComponentsFromScope","importMany","reason","compsNewFromScope","leftUnresolvedConflicts","componentWriterResults","manyComponentsWriterOpts","components","skipDependencyInstallation","skipNpmInstall","verbose","resetConfig","reset","skipUpdatingBitMap","skipUpdatingBitmap","revert","shouldUpdateWorkspaceConfig","reasonForBitmapChange","writeMany","appliedVersionComponents","applyVersionResult","componentIdsToRemove","undefined","removeLocallyByIds","force","reasonForRemoval","removedComponents","n","toString","workspaceConfigUpdateResult","installationError","compilationError","missing","bitMapEntry","bitMap","getBitmapEntry","ignoreVersion","noFilesError","ComponentNotFoundInPath","comps","getMany","state","_consumer","stashedBitmapEntries","newBitmapEntries","entry","defaultScope","newComps","bitmapEntry","existingId","getBitmapEntryIfExist","modelComponent","ModelComponent","fromBitId","repo","objects","consumerComp","toConsumerComponent","newCompId","ComponentID","fromObject","name","fullName","writeToPath","rootDir","addComponent","componentId","files","f","basename","relativePath","relative","test","mainFile","config","triggerOnComponentAdd","compile","write","checkoutByCLIValues","componentPattern","setStatusLine","OutsideWorkspaceError","importCurrentObjects","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","isExported","changeScope","scopeComponentsImporter","toVersionLatest","includeUnexported","error","unavailableOnMain","getUnavailableOnMainComponents","makeComponentsAvailableOnMain","includeLocallyDeleted","latest","idsOnWorkspace","listIdsIncludeRemoved","listIds","currentLane","getCurrentLaneObject","currentLaneIds","toComponentIds","hasWithoutVersion","LATEST","console","HEAD","getIds","idsByPattern","includeDeleted","laneBitIds","newComponentIds","bitId","isEqualWithoutVersion","nonRemovedNewIds","isRemoved","isComponentRemoved","remoteComponents","remoteList","namespacesUsingWildcards","workspaceIds","remote","removed","warn","headVersion","ancestor","main","latestVersion","versionPerId","forceOurs","forceTheirs","loadStash","existingBitMapId","getComponentIdIfExist","getComponent","MissingBitMapComponent","workspaceComp","get","legacyComp","allowAddingComponentsFromScope","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","getNewVersion","headIncludeRemote","previousParent","getRefOfAncestor","getTagOfRefIfExists","latestVersionIfExist","newVersion","hasVersion","divergeDataForMergePending","getDivergeDataForMergePending","isMergePending","isDiverged","isModified","currentVersionObject","loadVersion","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","componentFromFS","baseVersion","baseComponent","otherComponent","parents","parent","threeWayMerge","otherLabel","currentLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","RevertCmd","exports","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","RemoveAspect","ListerAspect","MainRuntime","addRuntime","_default"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { MainRuntime } from '@teambit/harmony.modules.runtimes';\nimport { CLIAspect } from '@teambit/cli';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect } from '@teambit/remove';\nimport type { ApplyVersionResults, FailedComponents, MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { threeWayMerge, getMergeStrategyInteractive } from '@teambit/component.modules.merge-helper';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport type { ListerMain } from '@teambit/lister';\nimport { ListerAspect } from '@teambit/lister';\nimport { HEAD, LATEST } from '@teambit/legacy.constants';\nimport type { ComponentWriterMain } from '@teambit/component-writer';\nimport { ComponentWriterAspect } from '@teambit/component-writer';\nimport mapSeries from 'p-map-series';\nimport { ComponentIdList, ComponentID } from '@teambit/component-id';\nimport type { Version, Lane } from '@teambit/objects';\nimport { ModelComponent } from '@teambit/objects';\nimport { Tmp } from '@teambit/legacy.scope';\nimport { ComponentNotFoundInPath } from '@teambit/legacy.consumer-component';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\nimport type { ComponentStatus, ComponentStatusBase } from './checkout-version';\nimport { applyVersion, throwForFailures } from './checkout-version';\nimport { RevertCmd } from './revert-cmd';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\nimport { MissingBitMapComponent } from '@teambit/legacy.bit-map';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\n\nexport type CheckoutProps = {\n version?: string; // if reset/head/latest is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n ancestor?: number; // how many generations to go backward\n latest?: boolean;\n main?: boolean; // relevant for \"revert\" only\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy; // strategy to use in case of conflicts\n forceOurs?: boolean; // regardless of conflicts, use ours\n forceTheirs?: boolean; // regardless of conflicts, use theirs\n verbose?: boolean;\n skipNpmInstall?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n revert?: boolean; // change the files according to the given version, but don't change the bitmap version and don't try to merge\n all?: boolean; // checkout all ids\n isLane?: boolean; // when true, allows components to not exist in the workspace filesystem - they will be loaded from scope.\n lane?: Lane; // currently needed for \"bit switch\" to tell the \"fetch\" where to fetch from\n workspaceOnly?: boolean;\n versionPerId?: ComponentID[]; // if given, the ComponentID.version is the version to checkout to.\n skipUpdatingBitmap?: boolean; // needed for stash\n loadStash?: boolean;\n stashedBitmapEntries?: Array<Partial<ComponentMap>>;\n restoreMissingComponents?: boolean; // in case .bitmap has a component and it's missing from the workspace, restore it (from model)\n allowAddingComponentsFromScope?: boolean; // in case the id doesn't exist in .bitmap, add it from the scope (relevant for switch)\n includeLocallyDeleted?: boolean; // include components that were deleted locally. currently enabled for \"bit checkout reset\" only.\n includeNewFromScope?: boolean; // import components from the defaultScope that don't exist in the workspace\n restrictToScopes?: string[]; // add lane components missing from the workspace only when they belong to these scopes (\"bit ci sync\" mirrors only a lane's own-scope slice)\n};\n\nexport type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {\n propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\n\nexport class CheckoutMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private remove: RemoveMain,\n private lister: ListerMain\n ) {}\n\n async checkout(checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n await this.ensureCheckoutConfiguration(checkoutProps);\n this.workspace.inInstallContext = true;\n const { version, ids, promptMergeOptions } = checkoutProps;\n await this.syncNewComponents(checkoutProps);\n const addedComponents = await this.restoreMissingComponents(checkoutProps);\n const newComponents = await this.addNewComponents(checkoutProps);\n const bitIds = ComponentIdList.fromArray(ids || []);\n // don't use Promise.all, it loads the components and this operation must be in sequence.\n const allComponentStatusBeforeMerge = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id, checkoutProps)\n );\n const compsNeedMerge = allComponentStatusBeforeMerge.filter((c) => c.propsForMerge);\n const compsNotNeedMerge = allComponentStatusBeforeMerge.filter((c) => !c.propsForMerge) as ComponentStatus[];\n\n // in case the requested versions to checkout don't exist locally, import them.\n const toImport = allComponentStatusBeforeMerge\n .map((compStatus) => {\n const idsToImport = [compStatus.id];\n if (compStatus.propsForMerge) {\n idsToImport.push(compStatus.id.changeVersion(compStatus.propsForMerge.currentlyUsedVersion));\n }\n return idsToImport;\n })\n .flat();\n\n await this.workspace.scope.legacyScope.scopeImporter.importWithoutDeps(ComponentIdList.fromArray(toImport), {\n cache: true,\n lane: checkoutProps.lane,\n });\n const consumer = this.workspace.consumer;\n const getComponentsStatusOfMergeNeeded = async (): Promise<ComponentStatus[]> => {\n const tmp = new Tmp(consumer.scope);\n try {\n const afterMergeAttempt = await Promise.all(compsNeedMerge.map((c) => this.getMergeStatus(c, checkoutProps)));\n await tmp.clear();\n return afterMergeAttempt;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n\n const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();\n\n const allComponentsStatus: ComponentStatus[] = [...compStatusMergeNeeded, ...compsNotNeedMerge];\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n if (componentWithConflict) {\n if (!promptMergeOptions && !checkoutProps.mergeStrategy) {\n throw new BitError(\n `automatic merge has failed for component ${componentWithConflict.id.toStringWithoutVersion()}.\\nplease use \"--auto-merge-resolve\" with 'manual', 'ours' or 'theirs' to resolve the conflict/s`\n );\n }\n if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n\n throwForFailures(allComponentsStatus);\n\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unchangedMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\n .map((componentStatus) => ({\n id: componentStatus.id,\n unchangedMessage: componentStatus.unchangedMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unchangedMessage);\n // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,\n // which can be an issue when some components are also dependencies of others\n const checkoutPropsLegacy = { ...checkoutProps, ids: checkoutProps.ids?.map((id) => id) };\n const componentsResults = await mapSeries(succeededComponents, ({ id, currentComponent, mergeResults }) => {\n return applyVersion(consumer, id, currentComponent, mergeResults, checkoutPropsLegacy);\n });\n\n const componentsLegacy = compact(componentsResults.map((c) => c.component));\n\n let newFromLane: ComponentID[] | undefined;\n let newFromLaneAdded = false;\n if (checkoutProps.head) {\n newFromLane = await this.getNewComponentsFromLane(checkoutProps.ids || []);\n const { restrictToScopes } = checkoutProps;\n if (restrictToScopes?.length) {\n newFromLane = newFromLane.filter((id) => restrictToScopes.includes(id.scope));\n }\n if (!checkoutProps.workspaceOnly) {\n const compsNewFromLane = await Promise.all(\n newFromLane.map((id) => consumer.loadComponentFromModelImportIfNeeded(id))\n );\n componentsLegacy.push(...compsNewFromLane);\n newFromLaneAdded = true;\n }\n }\n\n let newFromScope: ComponentID[] | undefined;\n if (checkoutProps.head && checkoutProps.includeNewFromScope) {\n newFromScope = await this.getNewComponentsFromScope();\n if (newFromScope.length) {\n const scopeImporter = this.workspace.scope.legacyScope.scopeImporter;\n await scopeImporter.importMany({\n ids: ComponentIdList.fromArray(newFromScope),\n reason: 'to import new components from the defaultScope',\n });\n const compsNewFromScope = await Promise.all(\n newFromScope.map((id) => consumer.loadComponentFromModelImportIfNeeded(id))\n );\n componentsLegacy.push(...compsNewFromScope);\n }\n }\n\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n let componentWriterResults;\n if (componentsLegacy.length) {\n const manyComponentsWriterOpts = {\n components: componentsLegacy,\n skipDependencyInstallation: checkoutProps.skipNpmInstall || leftUnresolvedConflicts,\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n skipUpdatingBitMap: checkoutProps.skipUpdatingBitmap || checkoutProps.revert,\n shouldUpdateWorkspaceConfig: true,\n reasonForBitmapChange: 'checkout',\n mergeStrategy: checkoutProps.mergeStrategy,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n if (componentIdsToRemove.length) {\n await this.remove.removeLocallyByIds(componentIdsToRemove, { force: true, reasonForRemoval: 'checkout' });\n }\n\n return {\n components: appliedVersionComponents,\n removedComponents: componentIdsToRemove,\n addedComponents,\n newComponents,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n newFromLane: newFromLane?.map((n) => n.toString()),\n newFromLaneAdded,\n newFromScope: newFromScope?.map((n) => n.toString()),\n workspaceConfigUpdateResult: componentWriterResults?.workspaceConfigUpdateResult,\n installationError: componentWriterResults?.installationError,\n compilationError: componentWriterResults?.compilationError,\n };\n }\n\n /**\n * if .bitmap entry exists but the rootDir is missing from the filesystem, find the component in the scope and restore it.\n * returns the restored component ids.\n */\n async restoreMissingComponents(checkoutProps: CheckoutProps): Promise<ComponentID[] | undefined> {\n if (checkoutProps.reset) {\n checkoutProps.restoreMissingComponents = true;\n }\n if (!checkoutProps.restoreMissingComponents) return undefined;\n const ids = checkoutProps.ids || [];\n const missing: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const bitMapEntry = this.workspace.bitMap.getBitmapEntry(id, { ignoreVersion: true });\n if (bitMapEntry.noFilesError && bitMapEntry.noFilesError instanceof ComponentNotFoundInPath) {\n delete bitMapEntry.noFilesError;\n missing.push(id);\n }\n })\n );\n if (!missing.length) return undefined;\n const comps = await this.workspace.scope.getMany(missing);\n await this.componentWriter.writeMany({\n components: comps.map((c) => c.state._consumer),\n skipDependencyInstallation: true,\n skipUpdatingBitMap: true,\n });\n\n return missing;\n }\n\n async addNewComponents(checkoutProps: CheckoutProps): Promise<undefined | ComponentID[]> {\n const stashedBitmapEntries = checkoutProps.stashedBitmapEntries;\n if (!stashedBitmapEntries) return;\n const newBitmapEntries = stashedBitmapEntries.filter((entry) => entry.defaultScope);\n if (!newBitmapEntries.length) return;\n const newComps = await mapSeries(newBitmapEntries, async (bitmapEntry) => {\n const id = bitmapEntry.id!;\n const existingId = this.workspace.bitMap.getBitmapEntryIfExist(id, { ignoreVersion: true });\n if (existingId) return;\n const modelComponent = ModelComponent.fromBitId(id);\n const repo = this.workspace.scope.legacyScope.objects;\n const consumerComp = await modelComponent.toConsumerComponent(id.version, id.scope, repo);\n const newCompId = ComponentID.fromObject({ name: id.fullName }, bitmapEntry.defaultScope!);\n await this.componentWriter.writeMany({\n components: [consumerComp],\n skipDependencyInstallation: true,\n writeToPath: bitmapEntry.rootDir,\n skipUpdatingBitMap: true,\n });\n\n this.workspace.consumer.bitMap.addComponent({\n componentId: newCompId,\n files: consumerComp.files.map((f) => ({\n name: f.basename,\n relativePath: f.relative,\n test: f.test,\n })),\n mainFile: bitmapEntry.mainFile!,\n config: bitmapEntry.config,\n defaultScope: bitmapEntry.defaultScope,\n });\n await this.workspace.triggerOnComponentAdd(newCompId, { compile: true });\n return newCompId;\n });\n await this.workspace.bitMap.write();\n return compact(newComps);\n }\n\n async checkoutByCLIValues(componentPattern: string, checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n const { revert, head } = checkoutProps;\n this.logger.setStatusLine(revert ? 'reverting components...' : 'switching component version...');\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n await this.importer.importCurrentObjects(); // important. among others, it fetches the remote lane object and its new components.\n if (head) await this.makeLaneComponentsAvailableOnMain();\n await this.parseValues(componentPattern, checkoutProps);\n const checkoutResults = await this.checkout(checkoutProps);\n await consumer.onDestroy(`checkout (${componentPattern})`);\n return checkoutResults;\n }\n\n private async syncNewComponents({ ids, head }: CheckoutProps) {\n if (!head) return;\n const notExported = ids?.filter((id) => !this.workspace.isExported(id)).map((id) => id.changeScope(id.scope));\n const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;\n try {\n await scopeComponentsImporter.importWithoutDeps(ComponentIdList.fromArray(notExported || []).toVersionLatest(), {\n cache: false,\n reason: 'for making sure the new components are really new and are not out-of-sync',\n includeUnexported: true,\n });\n } catch (err) {\n // don't stop the process. it's possible that the scope doesn't exist yet because these are new components\n this.logger.error(`unable to sync new components, if these components are really new, ignore the error`, err);\n }\n }\n\n private async makeLaneComponentsAvailableOnMain() {\n const unavailableOnMain = await this.workspace.getUnavailableOnMainComponents();\n if (!unavailableOnMain.length) return;\n this.workspace.bitMap.makeComponentsAvailableOnMain(unavailableOnMain);\n }\n\n private async ensureCheckoutConfiguration(checkoutProps: CheckoutProps) {\n if (checkoutProps.reset || checkoutProps.head) {\n checkoutProps.includeLocallyDeleted = true;\n }\n if (checkoutProps.ids?.length) {\n return;\n }\n if (checkoutProps.head || checkoutProps.latest) {\n checkoutProps.all = true;\n }\n if (!checkoutProps.all) {\n return; // no ids and no all.\n }\n const idsOnWorkspace = checkoutProps.includeLocallyDeleted\n ? this.workspace.listIdsIncludeRemoved()\n : this.workspace.listIds();\n\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toComponentIds();\n\n // When on a lane and doing head checkout, only checkout lane components\n const ids =\n currentLaneIds && checkoutProps.head\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id))\n : idsOnWorkspace;\n\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async parseValues(componentPattern: string, checkoutProps: CheckoutProps) {\n // CLI-specific validations and deprecation warnings\n if (checkoutProps.head && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${HEAD}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (checkoutProps.latest && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${LATEST}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (componentPattern && checkoutProps.all) {\n throw new BitError('please specify either [component-pattern] or --all, not both');\n }\n if (!componentPattern && !checkoutProps.all) {\n throw new BitError('please specify [component-pattern] or use --all flag');\n }\n if (checkoutProps.workspaceOnly && !checkoutProps.head) {\n throw new BitError(`--workspace-only flag can only be used with \"head\" (bit checkout head --workspace-only)`);\n }\n if (checkoutProps.reset || checkoutProps.head) {\n checkoutProps.includeLocallyDeleted = true;\n }\n\n const getIds = async () => {\n if (componentPattern) {\n return this.workspace.idsByPattern(componentPattern, true, {\n includeDeleted: checkoutProps.includeLocallyDeleted,\n });\n }\n return checkoutProps.includeLocallyDeleted ? this.workspace.listIdsIncludeRemoved() : this.workspace.listIds();\n };\n\n const idsOnWorkspace = await getIds();\n\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toComponentIds();\n // when no ids were given and the user is on a lane, return lane-ids only.\n // it's relevant for cases like \"bit checkout head\" when on a lane to not checkout main components. (see https://github.com/teambit/bit/pull/6853)\n const ids =\n currentLaneIds && !componentPattern && checkoutProps.head\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id))\n : idsOnWorkspace;\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async getNewComponentsFromLane(ids: ComponentID[]): Promise<ComponentID[]> {\n // current lane object is up to date due to the previous `importCurrentObjects()` call\n const lane = await this.workspace.consumer.getCurrentLaneObject();\n if (!lane) {\n return [];\n }\n const laneBitIds = lane.toComponentIds();\n const newComponentIds = laneBitIds.filter((bitId) => !ids.find((id) => id.isEqualWithoutVersion(bitId)));\n const nonRemovedNewIds: ComponentID[] = [];\n await Promise.all(\n newComponentIds.map(async (id) => {\n const isRemoved = await this.workspace.scope.isComponentRemoved(id);\n if (!isRemoved) nonRemovedNewIds.push(id);\n })\n );\n return nonRemovedNewIds;\n }\n\n private async getNewComponentsFromScope(): Promise<ComponentID[]> {\n const defaultScope = this.workspace.defaultScope;\n if (!defaultScope) return [];\n try {\n const remoteComponents = await this.lister.remoteList(defaultScope, { namespacesUsingWildcards: '**' });\n const workspaceIds = this.workspace.listIdsIncludeRemoved();\n const newComponents = remoteComponents.filter(\n (remote) => !remote.removed && !workspaceIds.hasWithoutVersion(remote.id)\n );\n return newComponents.map((c) => c.id);\n } catch (err) {\n this.logger.warn(`unable to list components from defaultScope \"${defaultScope}\"`, err);\n return [];\n }\n }\n\n // eslint-disable-next-line complexity\n private async getComponentStatusBeforeMergeAttempt(\n id: ComponentID,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const {\n version,\n head: headVersion,\n ancestor,\n reset,\n revert,\n main,\n latest: latestVersion,\n versionPerId,\n forceOurs,\n forceTheirs,\n loadStash,\n } = checkoutProps;\n const repo = consumer.scope.objects;\n\n let existingBitMapId = consumer.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n const getComponent = async () => {\n try {\n // an id that is not in the .bitmap must fail here. (workspace.get below would have\n // returned the component from the scope instead of throwing)\n if (!existingBitMapId) throw new MissingBitMapComponent(id.toString());\n const workspaceComp = await this.workspace.get(id);\n const legacyComp: ConsumerComponent = workspaceComp.state._consumer;\n if (!legacyComp.isRemoved()) return legacyComp;\n if (checkoutProps.includeLocallyDeleted) return legacyComp;\n } catch (err) {\n if (checkoutProps.allowAddingComponentsFromScope && !existingBitMapId) return undefined;\n throw err;\n }\n return undefined;\n };\n const component = await getComponent();\n if (component) {\n // the component might fix an out-of-sync issue and as a result, the id has changed\n id = component.id;\n existingBitMapId = consumer.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n }\n\n const componentModel = await consumer.scope.getModelComponentIfExist(id);\n const componentStatus: ComponentStatusBeforeMergeAttempt = { id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.unchangedMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n if (!componentModel) {\n return returnFailure(`component ${id.toString()} is new, no version to checkout`, true);\n }\n if (main && !componentModel.head) {\n return returnFailure(`component ${id.toString()} is not available on main`);\n }\n const unmerged = repo.unmergedComponents.getEntry(id);\n if (!reset && unmerged) {\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n\n const getNewVersion = async (): Promise<string> => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (reset) return component!.id.version as string;\n if (headVersion) return componentModel.headIncludeRemote(repo);\n if (ancestor) {\n const previousParent = await componentModel.getRefOfAncestor(repo, ancestor);\n return componentModel.getTagOfRefIfExists(previousParent)?.toString() || previousParent.toString();\n }\n // we verified previously that head exists in case of \"main\"\n if (main) return componentModel.head?.toString() as string;\n if (latestVersion) {\n const latest = componentModel.latestVersionIfExist();\n return latest || componentModel.headIncludeRemote(repo);\n }\n if (versionPerId) {\n return versionPerId.find((bitId) => bitId.isEqualWithoutVersion(id))?.version as string;\n }\n\n // if all above are false, the version is defined\n return version as string;\n };\n const newVersion = await getNewVersion();\n if (version && !headVersion) {\n const hasVersion = await componentModel.hasVersion(version, repo);\n if (!hasVersion) return returnFailure(`component ${id.toStringWithoutVersion()} doesn't have version ${version}`);\n }\n const currentlyUsedVersion = existingBitMapId?.version;\n if (existingBitMapId && !currentlyUsedVersion) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is new`);\n }\n\n if ((version && currentlyUsedVersion === version) || (versionPerId && currentlyUsedVersion === newVersion)) {\n // it won't be relevant for 'reset' as it doesn't have a version/versionPerId\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is already at version ${version || newVersion}`,\n true\n );\n }\n if ((headVersion || latestVersion) && currentlyUsedVersion === newVersion) {\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`,\n true\n );\n }\n if (!reset) {\n const divergeDataForMergePending = await componentModel.getDivergeDataForMergePending(repo);\n const isMergePending = divergeDataForMergePending.isDiverged();\n if (isMergePending) {\n return returnFailure(`component is merge-pending and cannot be checked out, run \"bit status\" for more info`);\n }\n }\n let isModified = false;\n if (currentlyUsedVersion) {\n const currentVersionObject: Version = await componentModel.loadVersion(currentlyUsedVersion, repo);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n isModified = await consumer.isComponentModified(currentVersionObject, component!);\n const isRemoved = component && component.isRemoved();\n if (!isModified && !isRemoved && reset) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is not modified`, true);\n }\n }\n\n const versionRef = componentModel.getRef(newVersion);\n if (!versionRef) throw new Error(`unable to get ref ${newVersion} from ${componentModel.id()}`);\n const componentVersion = (await consumer.scope.getObject(versionRef.hash)) as Version | undefined;\n if (componentVersion?.isRemoved()) {\n if (existingBitMapId) componentStatus.shouldBeRemoved = true;\n return returnFailure(`component has been removed`, true);\n }\n\n const newId = id.changeVersion(newVersion);\n\n if (reset || (!isModified && !loadStash) || revert || !currentlyUsedVersion || forceTheirs || forceOurs) {\n // if the component is not modified, no need to try merge the files, they will be written later on according to the\n // checked out version. same thing when no version is specified, it'll be reset to the model-version later.\n // in case of \"loadStash\", we want to merge the stashed modifications regardless whether it's modified currently.\n\n // if !currentlyUsedVersion it only exists in the model, so just write it. (happening during bit-switch/bit-lane-import)\n return { currentComponent: component, componentFromModel: componentVersion, id: newId };\n }\n\n const propsForMerge = {\n currentlyUsedVersion,\n componentModel,\n };\n\n return { currentComponent: component, componentFromModel: componentVersion, id: newId, propsForMerge };\n }\n\n private async getMergeStatus(\n { currentComponent: componentFromFS, componentFromModel, id, propsForMerge }: ComponentStatusBeforeMergeAttempt,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatus> {\n if (!propsForMerge) throw new Error(`propsForMerge is missing for ${id.toString()}`);\n if (!componentFromFS) throw new Error(`componentFromFS is missing for ${id.toString()}`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const { currentlyUsedVersion, componentModel } = propsForMerge;\n\n // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.\n // the base is 0.0.1, as it's the common version for 0.0.1 and 0.0.2. however, if we let git merge-file use the 0.0.1\n // as the base, then, it'll get the changes done since 0.0.1 to 0.0.1, which is nothing, and put them on top of\n // 0.0.2+modification. in other words, it won't make any change.\n // this scenario of checking out while there are modified files, is forbidden in Git. here, we want to simulate a similar\n // experience of \"git stash\", then \"git checkout\", then \"git stash pop\". practically, we want the changes done on 0.0.2\n // to be added to 0.0.1\n // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.\n let baseVersion = currentlyUsedVersion;\n const newVersion = id.version as string;\n let baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n const { loadStash } = checkoutProps;\n if (loadStash && otherComponent.parents.length) {\n // for stash, we want the stashed modifications to be added on top of the current version.\n // for this to happen, the \"base\" must be the parent of the stashed version.\n const parent = otherComponent.parents[0];\n baseVersion = parent.toString();\n baseComponent = await componentModel.loadVersion(baseVersion, repo);\n }\n\n const mergeResults = await threeWayMerge({\n scope: consumer.scope,\n otherComponent,\n otherLabel: loadStash ? 'stash' : newVersion,\n currentComponent: componentFromFS,\n currentLabel: `${currentlyUsedVersion} modified`,\n baseComponent,\n });\n\n return { currentComponent: componentFromFS, componentFromModel, id, mergeResults };\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n LoggerAspect,\n ComponentWriterAspect,\n ImporterAspect,\n RemoveAspect,\n ListerAspect,\n ];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain, compWriter, importer, remove, lister]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n RemoveMain,\n ListerMain,\n ]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger, compWriter, importer, remove, lister);\n cli.register(new CheckoutCmd(checkoutMain), new RevertCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime(CheckoutMain);\n\nexport default CheckoutMain;\n"],"mappings":";;;;;;AACA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,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,YAAY,kBAkkBD,CACpB2R,gBAAS,EACTC,4BAAe,EACfC,sBAAY,EACZC,wCAAqB,EACrBC,0BAAc,EACdC,sBAAY,EACZC,sBAAY,CACb;AAAAjT,eAAA,CA1kBUgB,YAAY,aA4kBNkS,6BAAW;AAkB9Bb,0BAAc,CAACc,UAAU,CAACnS,YAAY,CAAC;AAAC,IAAAoS,QAAA,GAAAV,OAAA,CAAA3T,OAAA,GAEzBiC,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_harmonyModules","data","require","_cli","_logger","_workspace","_bitError","_lodash","_remove","_componentModules","_importer","_lister","_legacy","_componentWriter","_pMapSeries","_interopRequireDefault","_componentId","_objects","_legacy2","_legacy3","_checkoutCmd","_checkout","_checkoutVersion","_revertCmd","_legacy4","_configMerger","_localConfigMerge","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckoutMain","constructor","workspace","logger","componentWriter","importer","remove","lister","checkout","checkoutProps","ensureCheckoutConfiguration","inInstallContext","version","ids","promptMergeOptions","syncNewComponents","addedComponents","restoreMissingComponents","newComponents","addNewComponents","bitIds","ComponentIdList","fromArray","allComponentStatusBeforeMerge","mapSeries","id","getComponentStatusBeforeMergeAttempt","compsNeedMerge","c","propsForMerge","compsNotNeedMerge","toImport","map","compStatus","idsToImport","changeVersion","currentlyUsedVersion","flat","scope","legacyScope","scopeImporter","importWithoutDeps","cache","lane","consumer","getComponentsStatusOfMergeNeeded","tmp","Tmp","afterMergeAttempt","Promise","all","getMergeStatus","clear","err","compStatusMergeNeeded","allComponentsStatus","componentWithConflict","find","component","mergeResults","hasConflicts","componentWithConfigConflict","configMergeResult","conflictedComponent","mergeStrategy","BitError","toStringWithoutVersion","getMergeStrategyInteractive","throwForFailures","failedComponents","componentStatus","unchangedMessage","shouldBeRemoved","unchangedLegitimately","succeededComponents","checkoutPropsLegacy","componentsResults","currentComponent","applyVersion","componentsLegacy","compact","newFromLane","newFromLaneAdded","head","getNewComponentsFromLane","restrictToScopes","includes","workspaceOnly","compsNewFromLane","loadComponentFromModelImportIfNeeded","newFromScope","includeNewFromScope","getNewComponentsFromScope","importMany","reason","compsNewFromScope","configMergeConflicts","applyLocalConfigConflicts","leftUnresolvedConflicts","componentWriterResults","manyComponentsWriterOpts","components","skipDependencyInstallation","skipNpmInstall","Boolean","verbose","resetConfig","reset","skipUpdatingBitMap","skipUpdatingBitmap","revert","shouldUpdateWorkspaceConfig","reasonForBitmapChange","writeMany","appliedVersionComponents","applyVersionResult","componentIdsToRemove","undefined","removeLocallyByIds","force","reasonForRemoval","removedComponents","n","toString","workspaceConfigUpdateResult","installationError","compilationError","getLocalConfigMergeResult","baseComponent","otherComponent","currentLabel","localConfig","bitMap","getBitmapEntryIfExist","ignoreVersion","config","result","ComponentConfigMerger","listIds","extensions","merge","filterByAspects","aspectId","isAspectInLocalConfig","componentsStatus","withConflicts","conflictFile","getConflictMergeFile","getBitmapEntry","key","getLocalConfigKeysToRemove","getConflictedAspectIds","removeSpecificComponentConfig","clearComponentCache","conflict","generateMergeConflictFile","addConflict","compIdStr","write","missing","bitMapEntry","noFilesError","ComponentNotFoundInPath","comps","getMany","state","_consumer","stashedBitmapEntries","newBitmapEntries","entry","defaultScope","newComps","bitmapEntry","existingId","modelComponent","ModelComponent","fromBitId","repo","objects","consumerComp","toConsumerComponent","newCompId","ComponentID","fromObject","name","fullName","writeToPath","rootDir","addComponent","componentId","files","f","basename","relativePath","relative","test","mainFile","triggerOnComponentAdd","compile","checkoutByCLIValues","componentPattern","setStatusLine","OutsideWorkspaceError","importCurrentObjects","makeLaneComponentsAvailableOnMain","parseValues","checkoutResults","onDestroy","notExported","isExported","changeScope","scopeComponentsImporter","toVersionLatest","includeUnexported","error","unavailableOnMain","getUnavailableOnMainComponents","makeComponentsAvailableOnMain","includeLocallyDeleted","latest","idsOnWorkspace","listIdsIncludeRemoved","currentLane","getCurrentLaneObject","currentLaneIds","toComponentIds","hasWithoutVersion","LATEST","console","HEAD","getIds","idsByPattern","includeDeleted","laneBitIds","newComponentIds","bitId","isEqualWithoutVersion","nonRemovedNewIds","isRemoved","isComponentRemoved","remoteComponents","remoteList","namespacesUsingWildcards","workspaceIds","remote","removed","warn","headVersion","ancestor","main","latestVersion","versionPerId","forceOurs","forceTheirs","loadStash","existingBitMapId","getComponentIdIfExist","getComponent","MissingBitMapComponent","workspaceComp","get","legacyComp","allowAddingComponentsFromScope","componentModel","getModelComponentIfExist","returnFailure","msg","unmerged","unmergedComponents","getEntry","getNewVersion","headIncludeRemote","previousParent","getRefOfAncestor","getTagOfRefIfExists","latestVersionIfExist","newVersion","hasVersion","divergeDataForMergePending","getDivergeDataForMergePending","isMergePending","isDiverged","isModified","currentVersionObject","loadVersion","isComponentModified","versionRef","getRef","Error","componentVersion","getObject","hash","newId","componentFromModel","componentFromFS","baseVersion","parents","parent","threeWayMerge","otherLabel","provider","cli","loggerMain","compWriter","createLogger","CheckoutAspect","checkoutMain","register","CheckoutCmd","RevertCmd","exports","CLIAspect","WorkspaceAspect","LoggerAspect","ComponentWriterAspect","ImporterAspect","RemoveAspect","ListerAspect","MainRuntime","addRuntime","_default"],"sources":["checkout.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { MainRuntime } from '@teambit/harmony.modules.runtimes';\nimport { CLIAspect } from '@teambit/cli';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport { compact } from 'lodash';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect } from '@teambit/remove';\nimport type { ApplyVersionResults, FailedComponents, MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { threeWayMerge, getMergeStrategyInteractive } from '@teambit/component.modules.merge-helper';\nimport type { ImporterMain } from '@teambit/importer';\nimport { ImporterAspect } from '@teambit/importer';\nimport type { ListerMain } from '@teambit/lister';\nimport { ListerAspect } from '@teambit/lister';\nimport { HEAD, LATEST } from '@teambit/legacy.constants';\nimport type { ComponentWriterMain } from '@teambit/component-writer';\nimport { ComponentWriterAspect } from '@teambit/component-writer';\nimport mapSeries from 'p-map-series';\nimport { ComponentIdList, ComponentID } from '@teambit/component-id';\nimport type { Version, Lane } from '@teambit/objects';\nimport { ModelComponent } from '@teambit/objects';\nimport { Tmp } from '@teambit/legacy.scope';\nimport { ComponentNotFoundInPath } from '@teambit/legacy.consumer-component';\nimport { CheckoutCmd } from './checkout-cmd';\nimport { CheckoutAspect } from './checkout.aspect';\nimport type { ComponentStatus, ComponentStatusBase } from './checkout-version';\nimport { applyVersion, throwForFailures } from './checkout-version';\nimport { RevertCmd } from './revert-cmd';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\nimport { MissingBitMapComponent } from '@teambit/legacy.bit-map';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport { ComponentConfigMerger } from '@teambit/config-merger';\nimport type { ConfigMergeResult } from '@teambit/config-merger';\nimport { getLocalConfigKeysToRemove, isAspectInLocalConfig } from './local-config-merge';\n\nexport type CheckoutProps = {\n version?: string; // if reset/head/latest is true, the version is undefined\n ids?: ComponentID[];\n head?: boolean;\n ancestor?: number; // how many generations to go backward\n latest?: boolean;\n main?: boolean; // relevant for \"revert\" only\n promptMergeOptions?: boolean;\n mergeStrategy?: MergeStrategy; // strategy to use in case of conflicts\n forceOurs?: boolean; // regardless of conflicts, use ours\n forceTheirs?: boolean; // regardless of conflicts, use theirs\n verbose?: boolean;\n skipNpmInstall?: boolean;\n reset?: boolean; // remove local changes. if set, the version is undefined.\n revert?: boolean; // change the files according to the given version, but don't change the bitmap version and don't try to merge\n all?: boolean; // checkout all ids\n isLane?: boolean; // when true, allows components to not exist in the workspace filesystem - they will be loaded from scope.\n lane?: Lane; // currently needed for \"bit switch\" to tell the \"fetch\" where to fetch from\n workspaceOnly?: boolean;\n versionPerId?: ComponentID[]; // if given, the ComponentID.version is the version to checkout to.\n skipUpdatingBitmap?: boolean; // needed for stash\n loadStash?: boolean;\n stashedBitmapEntries?: Array<Partial<ComponentMap>>;\n restoreMissingComponents?: boolean; // in case .bitmap has a component and it's missing from the workspace, restore it (from model)\n allowAddingComponentsFromScope?: boolean; // in case the id doesn't exist in .bitmap, add it from the scope (relevant for switch)\n includeLocallyDeleted?: boolean; // include components that were deleted locally. currently enabled for \"bit checkout reset\" only.\n includeNewFromScope?: boolean; // import components from the defaultScope that don't exist in the workspace\n restrictToScopes?: string[]; // add lane components missing from the workspace only when they belong to these scopes (\"bit ci sync\" mirrors only a lane's own-scope slice)\n};\n\nexport type ComponentStatusBeforeMergeAttempt = ComponentStatusBase & {\n propsForMerge?: {\n currentlyUsedVersion: string;\n componentModel: ModelComponent;\n };\n};\n\nexport class CheckoutMain {\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private componentWriter: ComponentWriterMain,\n private importer: ImporterMain,\n private remove: RemoveMain,\n private lister: ListerMain\n ) {}\n\n async checkout(checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n await this.ensureCheckoutConfiguration(checkoutProps);\n this.workspace.inInstallContext = true;\n const { version, ids, promptMergeOptions } = checkoutProps;\n await this.syncNewComponents(checkoutProps);\n const addedComponents = await this.restoreMissingComponents(checkoutProps);\n const newComponents = await this.addNewComponents(checkoutProps);\n const bitIds = ComponentIdList.fromArray(ids || []);\n // don't use Promise.all, it loads the components and this operation must be in sequence.\n const allComponentStatusBeforeMerge = await mapSeries(bitIds, (id) =>\n this.getComponentStatusBeforeMergeAttempt(id, checkoutProps)\n );\n const compsNeedMerge = allComponentStatusBeforeMerge.filter((c) => c.propsForMerge);\n const compsNotNeedMerge = allComponentStatusBeforeMerge.filter((c) => !c.propsForMerge) as ComponentStatus[];\n\n // in case the requested versions to checkout don't exist locally, import them.\n const toImport = allComponentStatusBeforeMerge\n .map((compStatus) => {\n const idsToImport = [compStatus.id];\n if (compStatus.propsForMerge) {\n idsToImport.push(compStatus.id.changeVersion(compStatus.propsForMerge.currentlyUsedVersion));\n }\n return idsToImport;\n })\n .flat();\n\n await this.workspace.scope.legacyScope.scopeImporter.importWithoutDeps(ComponentIdList.fromArray(toImport), {\n cache: true,\n lane: checkoutProps.lane,\n });\n const consumer = this.workspace.consumer;\n const getComponentsStatusOfMergeNeeded = async (): Promise<ComponentStatus[]> => {\n const tmp = new Tmp(consumer.scope);\n try {\n const afterMergeAttempt = await Promise.all(compsNeedMerge.map((c) => this.getMergeStatus(c, checkoutProps)));\n await tmp.clear();\n return afterMergeAttempt;\n } catch (err: any) {\n await tmp.clear();\n throw err;\n }\n };\n\n const compStatusMergeNeeded = await getComponentsStatusOfMergeNeeded();\n\n const allComponentsStatus: ComponentStatus[] = [...compStatusMergeNeeded, ...compsNotNeedMerge];\n const componentWithConflict = allComponentsStatus.find(\n (component) => component.mergeResults && component.mergeResults.hasConflicts\n );\n const componentWithConfigConflict = allComponentsStatus.find((component) =>\n component.configMergeResult?.hasConflicts()\n );\n const conflictedComponent = componentWithConflict || componentWithConfigConflict;\n if (conflictedComponent) {\n if (!promptMergeOptions && !checkoutProps.mergeStrategy) {\n throw new BitError(\n `automatic merge has failed for component ${conflictedComponent.id.toStringWithoutVersion()}.\\nplease use \"--auto-merge-resolve\" with 'manual', 'ours' or 'theirs' to resolve the conflict/s`\n );\n }\n if (!checkoutProps.mergeStrategy) checkoutProps.mergeStrategy = await getMergeStrategyInteractive();\n }\n\n throwForFailures(allComponentsStatus);\n\n const failedComponents: FailedComponents[] = allComponentsStatus\n .filter((componentStatus) => componentStatus.unchangedMessage)\n .filter((componentStatus) => !componentStatus.shouldBeRemoved)\n .map((componentStatus) => ({\n id: componentStatus.id,\n unchangedMessage: componentStatus.unchangedMessage as string,\n unchangedLegitimately: componentStatus.unchangedLegitimately,\n }));\n\n const succeededComponents = allComponentsStatus.filter((componentStatus) => !componentStatus.unchangedMessage);\n // do not use Promise.all for applyVersion. otherwise, it'll write all components in parallel,\n // which can be an issue when some components are also dependencies of others\n const checkoutPropsLegacy = { ...checkoutProps, ids: checkoutProps.ids?.map((id) => id) };\n const componentsResults = await mapSeries(succeededComponents, ({ id, currentComponent, mergeResults }) => {\n return applyVersion(consumer, id, currentComponent, mergeResults, checkoutPropsLegacy);\n });\n\n const componentsLegacy = compact(componentsResults.map((c) => c.component));\n\n let newFromLane: ComponentID[] | undefined;\n let newFromLaneAdded = false;\n if (checkoutProps.head) {\n newFromLane = await this.getNewComponentsFromLane(checkoutProps.ids || []);\n const { restrictToScopes } = checkoutProps;\n if (restrictToScopes?.length) {\n newFromLane = newFromLane.filter((id) => restrictToScopes.includes(id.scope));\n }\n if (!checkoutProps.workspaceOnly) {\n const compsNewFromLane = await Promise.all(\n newFromLane.map((id) => consumer.loadComponentFromModelImportIfNeeded(id))\n );\n componentsLegacy.push(...compsNewFromLane);\n newFromLaneAdded = true;\n }\n }\n\n let newFromScope: ComponentID[] | undefined;\n if (checkoutProps.head && checkoutProps.includeNewFromScope) {\n newFromScope = await this.getNewComponentsFromScope();\n if (newFromScope.length) {\n const scopeImporter = this.workspace.scope.legacyScope.scopeImporter;\n await scopeImporter.importMany({\n ids: ComponentIdList.fromArray(newFromScope),\n reason: 'to import new components from the defaultScope',\n });\n const compsNewFromScope = await Promise.all(\n newFromScope.map((id) => consumer.loadComponentFromModelImportIfNeeded(id))\n );\n componentsLegacy.push(...compsNewFromScope);\n }\n }\n\n const configMergeConflicts = await this.applyLocalConfigConflicts(allComponentsStatus, checkoutProps.mergeStrategy);\n const leftUnresolvedConflicts = componentWithConflict && checkoutProps.mergeStrategy === 'manual';\n let componentWriterResults;\n if (componentsLegacy.length) {\n const manyComponentsWriterOpts = {\n components: componentsLegacy,\n skipDependencyInstallation:\n checkoutProps.skipNpmInstall || leftUnresolvedConflicts || Boolean(configMergeConflicts?.length),\n verbose: checkoutProps.verbose,\n resetConfig: checkoutProps.reset,\n skipUpdatingBitMap: checkoutProps.skipUpdatingBitmap || checkoutProps.revert,\n shouldUpdateWorkspaceConfig: true,\n reasonForBitmapChange: 'checkout',\n mergeStrategy: checkoutProps.mergeStrategy,\n };\n componentWriterResults = await this.componentWriter.writeMany(manyComponentsWriterOpts);\n }\n\n const appliedVersionComponents = componentsResults.map((c) => c.applyVersionResult);\n\n const componentIdsToRemove = allComponentsStatus\n .filter((componentStatus) => componentStatus.shouldBeRemoved)\n .map((c) => c.id.changeVersion(undefined));\n\n if (componentIdsToRemove.length) {\n await this.remove.removeLocallyByIds(componentIdsToRemove, { force: true, reasonForRemoval: 'checkout' });\n }\n\n return {\n components: appliedVersionComponents,\n removedComponents: componentIdsToRemove,\n addedComponents,\n newComponents,\n version,\n failedComponents,\n leftUnresolvedConflicts,\n configMergeConflicts,\n newFromLane: newFromLane?.map((n) => n.toString()),\n newFromLaneAdded,\n newFromScope: newFromScope?.map((n) => n.toString()),\n workspaceConfigUpdateResult: componentWriterResults?.workspaceConfigUpdateResult,\n installationError: componentWriterResults?.installationError,\n compilationError: componentWriterResults?.compilationError,\n };\n }\n\n /**\n * checkout keeps the local config of a component (the .bitmap \"config\", e.g. from \"bit env set\") on top of the\n * checked out version. when the checked out version changed the same aspect differently, it's a conflict, same as\n * a conflict in a file. only the aspects that are set locally are checked. the other aspects get their config from\n * the checked out version anyway.\n * the merge runs with \"manual\" to find the conflicts. the strategy of the user is applied by applyLocalConfigConflicts.\n */\n private getLocalConfigMergeResult(\n id: ComponentID,\n currentComponent: ConsumerComponent,\n baseComponent: Version,\n otherComponent: Version,\n currentLabel: string\n ): ConfigMergeResult | undefined {\n const localConfig = this.workspace.bitMap.getBitmapEntryIfExist(id, { ignoreVersion: true })?.config;\n if (!localConfig) return undefined;\n const result = new ComponentConfigMerger(\n id.toStringWithoutVersion(),\n this.workspace.listIds(),\n undefined,\n currentComponent.extensions,\n baseComponent.extensions,\n otherComponent.extensions,\n currentLabel,\n id.version as string,\n this.logger,\n 'manual'\n )\n .merge()\n .filterByAspects((aspectId) => isAspectInLocalConfig(aspectId, localConfig));\n return result.hasConflicts() ? result : undefined;\n }\n\n /**\n * \"ours\" keeps the local config. \"theirs\" removes the conflicted aspects from the local config, so the checked out\n * version wins. \"manual\" removes them as well and writes the conflicts into the config-merge file for the user to\n * resolve, same as \"bit merge\" does.\n * returns the component ids that were left with config conflicts.\n */\n private async applyLocalConfigConflicts(\n componentsStatus: ComponentStatus[],\n mergeStrategy?: MergeStrategy\n ): Promise<string[] | undefined> {\n const withConflicts = componentsStatus.filter((c) => c.configMergeResult?.hasConflicts());\n if (!withConflicts.length || mergeStrategy === 'ours') return undefined;\n const conflictFile = this.workspace.getConflictMergeFile();\n for (const { id, configMergeResult } of withConflicts) {\n if (!configMergeResult) continue;\n const localConfig = this.workspace.bitMap.getBitmapEntry(id, { ignoreVersion: true }).config || {};\n for (const key of getLocalConfigKeysToRemove(localConfig, configMergeResult.getConflictedAspectIds())) {\n await this.workspace.removeSpecificComponentConfig(id, key);\n }\n this.workspace.clearComponentCache(id);\n if (mergeStrategy === 'manual') {\n const conflict = configMergeResult.generateMergeConflictFile();\n if (conflict) conflictFile.addConflict(configMergeResult.compIdStr, conflict);\n }\n }\n await conflictFile.write(); // no-op when there are no conflicts\n return mergeStrategy === 'manual' ? withConflicts.map((c) => c.id.toStringWithoutVersion()) : undefined;\n }\n\n /**\n * if .bitmap entry exists but the rootDir is missing from the filesystem, find the component in the scope and restore it.\n * returns the restored component ids.\n */\n async restoreMissingComponents(checkoutProps: CheckoutProps): Promise<ComponentID[] | undefined> {\n if (checkoutProps.reset) {\n checkoutProps.restoreMissingComponents = true;\n }\n if (!checkoutProps.restoreMissingComponents) return undefined;\n const ids = checkoutProps.ids || [];\n const missing: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const bitMapEntry = this.workspace.bitMap.getBitmapEntry(id, { ignoreVersion: true });\n if (bitMapEntry.noFilesError && bitMapEntry.noFilesError instanceof ComponentNotFoundInPath) {\n delete bitMapEntry.noFilesError;\n missing.push(id);\n }\n })\n );\n if (!missing.length) return undefined;\n const comps = await this.workspace.scope.getMany(missing);\n await this.componentWriter.writeMany({\n components: comps.map((c) => c.state._consumer),\n skipDependencyInstallation: true,\n skipUpdatingBitMap: true,\n });\n\n return missing;\n }\n\n async addNewComponents(checkoutProps: CheckoutProps): Promise<undefined | ComponentID[]> {\n const stashedBitmapEntries = checkoutProps.stashedBitmapEntries;\n if (!stashedBitmapEntries) return;\n const newBitmapEntries = stashedBitmapEntries.filter((entry) => entry.defaultScope);\n if (!newBitmapEntries.length) return;\n const newComps = await mapSeries(newBitmapEntries, async (bitmapEntry) => {\n const id = bitmapEntry.id!;\n const existingId = this.workspace.bitMap.getBitmapEntryIfExist(id, { ignoreVersion: true });\n if (existingId) return;\n const modelComponent = ModelComponent.fromBitId(id);\n const repo = this.workspace.scope.legacyScope.objects;\n const consumerComp = await modelComponent.toConsumerComponent(id.version, id.scope, repo);\n const newCompId = ComponentID.fromObject({ name: id.fullName }, bitmapEntry.defaultScope!);\n await this.componentWriter.writeMany({\n components: [consumerComp],\n skipDependencyInstallation: true,\n writeToPath: bitmapEntry.rootDir,\n skipUpdatingBitMap: true,\n });\n\n this.workspace.consumer.bitMap.addComponent({\n componentId: newCompId,\n files: consumerComp.files.map((f) => ({\n name: f.basename,\n relativePath: f.relative,\n test: f.test,\n })),\n mainFile: bitmapEntry.mainFile!,\n config: bitmapEntry.config,\n defaultScope: bitmapEntry.defaultScope,\n });\n await this.workspace.triggerOnComponentAdd(newCompId, { compile: true });\n return newCompId;\n });\n await this.workspace.bitMap.write();\n return compact(newComps);\n }\n\n async checkoutByCLIValues(componentPattern: string, checkoutProps: CheckoutProps): Promise<ApplyVersionResults> {\n const { revert, head } = checkoutProps;\n this.logger.setStatusLine(revert ? 'reverting components...' : 'switching component version...');\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer = this.workspace.consumer;\n await this.importer.importCurrentObjects(); // important. among others, it fetches the remote lane object and its new components.\n if (head) await this.makeLaneComponentsAvailableOnMain();\n await this.parseValues(componentPattern, checkoutProps);\n const checkoutResults = await this.checkout(checkoutProps);\n await consumer.onDestroy(`checkout (${componentPattern})`);\n return checkoutResults;\n }\n\n private async syncNewComponents({ ids, head }: CheckoutProps) {\n if (!head) return;\n const notExported = ids?.filter((id) => !this.workspace.isExported(id)).map((id) => id.changeScope(id.scope));\n const scopeComponentsImporter = this.workspace.consumer.scope.scopeImporter;\n try {\n await scopeComponentsImporter.importWithoutDeps(ComponentIdList.fromArray(notExported || []).toVersionLatest(), {\n cache: false,\n reason: 'for making sure the new components are really new and are not out-of-sync',\n includeUnexported: true,\n });\n } catch (err) {\n // don't stop the process. it's possible that the scope doesn't exist yet because these are new components\n this.logger.error(`unable to sync new components, if these components are really new, ignore the error`, err);\n }\n }\n\n private async makeLaneComponentsAvailableOnMain() {\n const unavailableOnMain = await this.workspace.getUnavailableOnMainComponents();\n if (!unavailableOnMain.length) return;\n this.workspace.bitMap.makeComponentsAvailableOnMain(unavailableOnMain);\n }\n\n private async ensureCheckoutConfiguration(checkoutProps: CheckoutProps) {\n if (checkoutProps.reset || checkoutProps.head) {\n checkoutProps.includeLocallyDeleted = true;\n }\n if (checkoutProps.ids?.length) {\n return;\n }\n if (checkoutProps.head || checkoutProps.latest) {\n checkoutProps.all = true;\n }\n if (!checkoutProps.all) {\n return; // no ids and no all.\n }\n const idsOnWorkspace = checkoutProps.includeLocallyDeleted\n ? this.workspace.listIdsIncludeRemoved()\n : this.workspace.listIds();\n\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toComponentIds();\n\n // When on a lane and doing head checkout, only checkout lane components\n const ids =\n currentLaneIds && checkoutProps.head\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id))\n : idsOnWorkspace;\n\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async parseValues(componentPattern: string, checkoutProps: CheckoutProps) {\n // CLI-specific validations and deprecation warnings\n if (checkoutProps.head && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${HEAD}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (checkoutProps.latest && !componentPattern) {\n if (checkoutProps.all) {\n this.logger.console(`\"--all\" is deprecated for \"bit checkout ${LATEST}\", please omit it.`);\n }\n checkoutProps.all = true;\n }\n if (componentPattern && checkoutProps.all) {\n throw new BitError('please specify either [component-pattern] or --all, not both');\n }\n if (!componentPattern && !checkoutProps.all) {\n throw new BitError('please specify [component-pattern] or use --all flag');\n }\n if (checkoutProps.workspaceOnly && !checkoutProps.head) {\n throw new BitError(`--workspace-only flag can only be used with \"head\" (bit checkout head --workspace-only)`);\n }\n if (checkoutProps.reset || checkoutProps.head) {\n checkoutProps.includeLocallyDeleted = true;\n }\n\n const getIds = async () => {\n if (componentPattern) {\n return this.workspace.idsByPattern(componentPattern, true, {\n includeDeleted: checkoutProps.includeLocallyDeleted,\n });\n }\n return checkoutProps.includeLocallyDeleted ? this.workspace.listIdsIncludeRemoved() : this.workspace.listIds();\n };\n\n const idsOnWorkspace = await getIds();\n\n const currentLane = await this.workspace.consumer.getCurrentLaneObject();\n const currentLaneIds = currentLane?.toComponentIds();\n // when no ids were given and the user is on a lane, return lane-ids only.\n // it's relevant for cases like \"bit checkout head\" when on a lane to not checkout main components. (see https://github.com/teambit/bit/pull/6853)\n const ids =\n currentLaneIds && !componentPattern && checkoutProps.head\n ? idsOnWorkspace.filter((id) => currentLaneIds.hasWithoutVersion(id))\n : idsOnWorkspace;\n checkoutProps.ids = ids.map((id) => (checkoutProps.head || checkoutProps.latest ? id.changeVersion(LATEST) : id));\n }\n\n private async getNewComponentsFromLane(ids: ComponentID[]): Promise<ComponentID[]> {\n // current lane object is up to date due to the previous `importCurrentObjects()` call\n const lane = await this.workspace.consumer.getCurrentLaneObject();\n if (!lane) {\n return [];\n }\n const laneBitIds = lane.toComponentIds();\n const newComponentIds = laneBitIds.filter((bitId) => !ids.find((id) => id.isEqualWithoutVersion(bitId)));\n const nonRemovedNewIds: ComponentID[] = [];\n await Promise.all(\n newComponentIds.map(async (id) => {\n const isRemoved = await this.workspace.scope.isComponentRemoved(id);\n if (!isRemoved) nonRemovedNewIds.push(id);\n })\n );\n return nonRemovedNewIds;\n }\n\n private async getNewComponentsFromScope(): Promise<ComponentID[]> {\n const defaultScope = this.workspace.defaultScope;\n if (!defaultScope) return [];\n try {\n const remoteComponents = await this.lister.remoteList(defaultScope, { namespacesUsingWildcards: '**' });\n const workspaceIds = this.workspace.listIdsIncludeRemoved();\n const newComponents = remoteComponents.filter(\n (remote) => !remote.removed && !workspaceIds.hasWithoutVersion(remote.id)\n );\n return newComponents.map((c) => c.id);\n } catch (err) {\n this.logger.warn(`unable to list components from defaultScope \"${defaultScope}\"`, err);\n return [];\n }\n }\n\n // eslint-disable-next-line complexity\n private async getComponentStatusBeforeMergeAttempt(\n id: ComponentID,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatusBeforeMergeAttempt> {\n const consumer = this.workspace.consumer;\n const {\n version,\n head: headVersion,\n ancestor,\n reset,\n revert,\n main,\n latest: latestVersion,\n versionPerId,\n forceOurs,\n forceTheirs,\n loadStash,\n } = checkoutProps;\n const repo = consumer.scope.objects;\n\n let existingBitMapId = consumer.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n const getComponent = async () => {\n try {\n // an id that is not in the .bitmap must fail here. (workspace.get below would have\n // returned the component from the scope instead of throwing)\n if (!existingBitMapId) throw new MissingBitMapComponent(id.toString());\n const workspaceComp = await this.workspace.get(id);\n const legacyComp: ConsumerComponent = workspaceComp.state._consumer;\n if (!legacyComp.isRemoved()) return legacyComp;\n if (checkoutProps.includeLocallyDeleted) return legacyComp;\n } catch (err) {\n if (checkoutProps.allowAddingComponentsFromScope && !existingBitMapId) return undefined;\n throw err;\n }\n return undefined;\n };\n const component = await getComponent();\n if (component) {\n // the component might fix an out-of-sync issue and as a result, the id has changed\n id = component.id;\n existingBitMapId = consumer.bitMap.getComponentIdIfExist(id, { ignoreVersion: true });\n }\n\n const componentModel = await consumer.scope.getModelComponentIfExist(id);\n const componentStatus: ComponentStatusBeforeMergeAttempt = { id };\n const returnFailure = (msg: string, unchangedLegitimately = false) => {\n componentStatus.unchangedMessage = msg;\n componentStatus.unchangedLegitimately = unchangedLegitimately;\n return componentStatus;\n };\n if (!componentModel) {\n return returnFailure(`component ${id.toString()} is new, no version to checkout`, true);\n }\n if (main && !componentModel.head) {\n return returnFailure(`component ${id.toString()} is not available on main`);\n }\n const unmerged = repo.unmergedComponents.getEntry(id);\n if (!reset && unmerged) {\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is in during-merge state, please snap/tag it first (or use bit merge --resolve/--abort)`\n );\n }\n\n const getNewVersion = async (): Promise<string> => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (reset) return component!.id.version as string;\n if (headVersion) return componentModel.headIncludeRemote(repo);\n if (ancestor) {\n const previousParent = await componentModel.getRefOfAncestor(repo, ancestor);\n return componentModel.getTagOfRefIfExists(previousParent)?.toString() || previousParent.toString();\n }\n // we verified previously that head exists in case of \"main\"\n if (main) return componentModel.head?.toString() as string;\n if (latestVersion) {\n const latest = componentModel.latestVersionIfExist();\n return latest || componentModel.headIncludeRemote(repo);\n }\n if (versionPerId) {\n return versionPerId.find((bitId) => bitId.isEqualWithoutVersion(id))?.version as string;\n }\n\n // if all above are false, the version is defined\n return version as string;\n };\n const newVersion = await getNewVersion();\n if (version && !headVersion) {\n const hasVersion = await componentModel.hasVersion(version, repo);\n if (!hasVersion) return returnFailure(`component ${id.toStringWithoutVersion()} doesn't have version ${version}`);\n }\n const currentlyUsedVersion = existingBitMapId?.version;\n if (existingBitMapId && !currentlyUsedVersion) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is new`);\n }\n\n if ((version && currentlyUsedVersion === version) || (versionPerId && currentlyUsedVersion === newVersion)) {\n // it won't be relevant for 'reset' as it doesn't have a version/versionPerId\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is already at version ${version || newVersion}`,\n true\n );\n }\n if ((headVersion || latestVersion) && currentlyUsedVersion === newVersion) {\n return returnFailure(\n `component ${id.toStringWithoutVersion()} is already at the latest version, which is ${newVersion}`,\n true\n );\n }\n if (!reset) {\n const divergeDataForMergePending = await componentModel.getDivergeDataForMergePending(repo);\n const isMergePending = divergeDataForMergePending.isDiverged();\n if (isMergePending) {\n return returnFailure(`component is merge-pending and cannot be checked out, run \"bit status\" for more info`);\n }\n }\n let isModified = false;\n if (currentlyUsedVersion) {\n const currentVersionObject: Version = await componentModel.loadVersion(currentlyUsedVersion, repo);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n isModified = await consumer.isComponentModified(currentVersionObject, component!);\n const isRemoved = component && component.isRemoved();\n if (!isModified && !isRemoved && reset) {\n return returnFailure(`component ${id.toStringWithoutVersion()} is not modified`, true);\n }\n }\n\n const versionRef = componentModel.getRef(newVersion);\n if (!versionRef) throw new Error(`unable to get ref ${newVersion} from ${componentModel.id()}`);\n const componentVersion = (await consumer.scope.getObject(versionRef.hash)) as Version | undefined;\n if (componentVersion?.isRemoved()) {\n if (existingBitMapId) componentStatus.shouldBeRemoved = true;\n return returnFailure(`component has been removed`, true);\n }\n\n const newId = id.changeVersion(newVersion);\n\n if (reset || (!isModified && !loadStash) || revert || !currentlyUsedVersion || forceTheirs || forceOurs) {\n // if the component is not modified, no need to try merge the files, they will be written later on according to the\n // checked out version. same thing when no version is specified, it'll be reset to the model-version later.\n // in case of \"loadStash\", we want to merge the stashed modifications regardless whether it's modified currently.\n\n // if !currentlyUsedVersion it only exists in the model, so just write it. (happening during bit-switch/bit-lane-import)\n return { currentComponent: component, componentFromModel: componentVersion, id: newId };\n }\n\n const propsForMerge = {\n currentlyUsedVersion,\n componentModel,\n };\n\n return { currentComponent: component, componentFromModel: componentVersion, id: newId, propsForMerge };\n }\n\n private async getMergeStatus(\n { currentComponent: componentFromFS, componentFromModel, id, propsForMerge }: ComponentStatusBeforeMergeAttempt,\n checkoutProps: CheckoutProps\n ): Promise<ComponentStatus> {\n if (!propsForMerge) throw new Error(`propsForMerge is missing for ${id.toString()}`);\n if (!componentFromFS) throw new Error(`componentFromFS is missing for ${id.toString()}`);\n const consumer = this.workspace.consumer;\n const repo = consumer.scope.objects;\n const { currentlyUsedVersion, componentModel } = propsForMerge;\n\n // this is tricky. imagine the user is 0.0.2+modification and wants to checkout to 0.0.1.\n // the base is 0.0.1, as it's the common version for 0.0.1 and 0.0.2. however, if we let git merge-file use the 0.0.1\n // as the base, then, it'll get the changes done since 0.0.1 to 0.0.1, which is nothing, and put them on top of\n // 0.0.2+modification. in other words, it won't make any change.\n // this scenario of checking out while there are modified files, is forbidden in Git. here, we want to simulate a similar\n // experience of \"git stash\", then \"git checkout\", then \"git stash pop\". practically, we want the changes done on 0.0.2\n // to be added to 0.0.1\n // if there is no modification, it doesn't go the threeWayMerge anyway, so it doesn't matter what the base is.\n let baseVersion = currentlyUsedVersion;\n const newVersion = id.version as string;\n let baseComponent: Version = await componentModel.loadVersion(baseVersion, repo);\n const otherComponent: Version = await componentModel.loadVersion(newVersion, repo);\n const { loadStash } = checkoutProps;\n if (loadStash && otherComponent.parents.length) {\n // for stash, we want the stashed modifications to be added on top of the current version.\n // for this to happen, the \"base\" must be the parent of the stashed version.\n const parent = otherComponent.parents[0];\n baseVersion = parent.toString();\n baseComponent = await componentModel.loadVersion(baseVersion, repo);\n }\n\n const currentLabel = `${currentlyUsedVersion} modified`;\n const mergeResults = await threeWayMerge({\n scope: consumer.scope,\n otherComponent,\n otherLabel: loadStash ? 'stash' : newVersion,\n currentComponent: componentFromFS,\n currentLabel,\n baseComponent,\n });\n // a stash doesn't update the .bitmap, so there is no local config to merge\n const configMergeResult =\n loadStash || checkoutProps.skipUpdatingBitmap\n ? undefined\n : this.getLocalConfigMergeResult(id, componentFromFS, baseComponent, otherComponent, currentLabel);\n\n return { currentComponent: componentFromFS, componentFromModel, id, mergeResults, configMergeResult };\n }\n\n static slots = [];\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n LoggerAspect,\n ComponentWriterAspect,\n ImporterAspect,\n RemoveAspect,\n ListerAspect,\n ];\n\n static runtime = MainRuntime;\n\n static async provider([cli, workspace, loggerMain, compWriter, importer, remove, lister]: [\n CLIMain,\n Workspace,\n LoggerMain,\n ComponentWriterMain,\n ImporterMain,\n RemoveMain,\n ListerMain,\n ]) {\n const logger = loggerMain.createLogger(CheckoutAspect.id);\n const checkoutMain = new CheckoutMain(workspace, logger, compWriter, importer, remove, lister);\n cli.register(new CheckoutCmd(checkoutMain), new RevertCmd(checkoutMain));\n return checkoutMain;\n }\n}\n\nCheckoutAspect.addRuntime(CheckoutMain);\n\nexport default CheckoutMain;\n"],"mappings":";;;;;;AACA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,SAAA,YAAAA,CAA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AE1S,QAAQ,EAAEC,MAAM,EAAEC,MAAM,CAQtF,EAAE;IACD,MAAMJ,MAAM,GAAG2S,UAAU,CAACE,YAAY,CAACC,0BAAc,CAACxR,EAAE,CAAC;IACzD,MAAMyR,YAAY,GAAG,IAAIlT,YAAY,CAACE,SAAS,EAAEC,MAAM,EAAE4S,UAAU,EAAE1S,QAAQ,EAAEC,MAAM,EAAEC,MAAM,CAAC;IAC9FsS,GAAG,CAACM,QAAQ,CAAC,KAAIC,0BAAW,EAACF,YAAY,CAAC,EAAE,KAAIG,sBAAS,EAACH,YAAY,CAAC,CAAC;IACxE,OAAOA,YAAY;EACrB;AACF;AAACI,OAAA,CAAAtT,YAAA,GAAAA,YAAA;AAAAhB,eAAA,CAvqBYgB,YAAY,WA4oBR,EAAE;AAAAhB,eAAA,CA5oBNgB,YAAY,kBA6oBD,CACpBuT,gBAAS,EACTC,4BAAe,EACfC,sBAAY,EACZC,wCAAqB,EACrBC,0BAAc,EACdC,sBAAY,EACZC,sBAAY,CACb;AAAA7U,eAAA,CArpBUgB,YAAY,aAupBN8T,6BAAW;AAkB9Bb,0BAAc,CAACc,UAAU,CAAC/T,YAAY,CAAC;AAAC,IAAAgU,QAAA,GAAAV,OAAA,CAAAvV,OAAA,GAEzBiC,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* helpers for merging the local config of a component (the "config" prop of its .bitmap entry, e.g. from
|
|
3
|
+
* "bit env set" or "bit deps set") with the config of the version that gets checked out.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* whether the aspect is set in the local config. versions are ignored.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isAspectInLocalConfig(aspectId: string, localConfig: Record<string, any>): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* the keys to remove from the local config, so the conflicted aspects get their config from the checked out version.
|
|
11
|
+
* an env is saved in two keys: "teambit.envs/envs" ({ env: <env-id> }) and the env-id itself (with or without a
|
|
12
|
+
* version). a conflict of "teambit.envs/envs" removes both.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getLocalConfigKeysToRemove(localConfig: Record<string, any>, conflictedAspectIds: string[]): string[];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getLocalConfigKeysToRemove = getLocalConfigKeysToRemove;
|
|
7
|
+
exports.isAspectInLocalConfig = isAspectInLocalConfig;
|
|
8
|
+
function _componentId() {
|
|
9
|
+
const data = require("@teambit/component-id");
|
|
10
|
+
_componentId = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _legacy() {
|
|
16
|
+
const data = require("@teambit/legacy.constants");
|
|
17
|
+
_legacy = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* helpers for merging the local config of a component (the "config" prop of its .bitmap entry, e.g. from
|
|
24
|
+
* "bit env set" or "bit deps set") with the config of the version that gets checked out.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* whether the aspect is set in the local config. versions are ignored.
|
|
29
|
+
*/
|
|
30
|
+
function isAspectInLocalConfig(aspectId, localConfig) {
|
|
31
|
+
const target = _componentId().ComponentID.getStringWithoutVersion(aspectId);
|
|
32
|
+
return Object.keys(localConfig).some(key => _componentId().ComponentID.getStringWithoutVersion(key) === target);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* the keys to remove from the local config, so the conflicted aspects get their config from the checked out version.
|
|
37
|
+
* an env is saved in two keys: "teambit.envs/envs" ({ env: <env-id> }) and the env-id itself (with or without a
|
|
38
|
+
* version). a conflict of "teambit.envs/envs" removes both.
|
|
39
|
+
*/
|
|
40
|
+
function getLocalConfigKeysToRemove(localConfig, conflictedAspectIds) {
|
|
41
|
+
const envId = localConfig[_legacy().Extensions.envs]?.env;
|
|
42
|
+
const idsToRemove = conflictedAspectIds.flatMap(aspectId => {
|
|
43
|
+
const ids = [_componentId().ComponentID.getStringWithoutVersion(aspectId)];
|
|
44
|
+
if (aspectId === _legacy().Extensions.envs && typeof envId === 'string') ids.push(_componentId().ComponentID.getStringWithoutVersion(envId));
|
|
45
|
+
return ids;
|
|
46
|
+
});
|
|
47
|
+
return Object.keys(localConfig).filter(key => idsToRemove.includes(_componentId().ComponentID.getStringWithoutVersion(key)));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=local-config-merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_componentId","data","require","_legacy","isAspectInLocalConfig","aspectId","localConfig","target","ComponentID","getStringWithoutVersion","Object","keys","some","key","getLocalConfigKeysToRemove","conflictedAspectIds","envId","Extensions","envs","env","idsToRemove","flatMap","ids","push","filter","includes"],"sources":["local-config-merge.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport { Extensions } from '@teambit/legacy.constants';\n\n/**\n * helpers for merging the local config of a component (the \"config\" prop of its .bitmap entry, e.g. from\n * \"bit env set\" or \"bit deps set\") with the config of the version that gets checked out.\n */\n\n/**\n * whether the aspect is set in the local config. versions are ignored.\n */\nexport function isAspectInLocalConfig(aspectId: string, localConfig: Record<string, any>): boolean {\n const target = ComponentID.getStringWithoutVersion(aspectId);\n return Object.keys(localConfig).some((key) => ComponentID.getStringWithoutVersion(key) === target);\n}\n\n/**\n * the keys to remove from the local config, so the conflicted aspects get their config from the checked out version.\n * an env is saved in two keys: \"teambit.envs/envs\" ({ env: <env-id> }) and the env-id itself (with or without a\n * version). a conflict of \"teambit.envs/envs\" removes both.\n */\nexport function getLocalConfigKeysToRemove(localConfig: Record<string, any>, conflictedAspectIds: string[]): string[] {\n const envId = localConfig[Extensions.envs]?.env;\n const idsToRemove = conflictedAspectIds.flatMap((aspectId) => {\n const ids = [ComponentID.getStringWithoutVersion(aspectId)];\n if (aspectId === Extensions.envs && typeof envId === 'string') ids.push(ComponentID.getStringWithoutVersion(envId));\n return ids;\n });\n return Object.keys(localConfig).filter((key) => idsToRemove.includes(ComponentID.getStringWithoutVersion(key)));\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,SAASG,qBAAqBA,CAACC,QAAgB,EAAEC,WAAgC,EAAW;EACjG,MAAMC,MAAM,GAAGC,0BAAW,CAACC,uBAAuB,CAACJ,QAAQ,CAAC;EAC5D,OAAOK,MAAM,CAACC,IAAI,CAACL,WAAW,CAAC,CAACM,IAAI,CAAEC,GAAG,IAAKL,0BAAW,CAACC,uBAAuB,CAACI,GAAG,CAAC,KAAKN,MAAM,CAAC;AACpG;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASO,0BAA0BA,CAACR,WAAgC,EAAES,mBAA6B,EAAY;EACpH,MAAMC,KAAK,GAAGV,WAAW,CAACW,oBAAU,CAACC,IAAI,CAAC,EAAEC,GAAG;EAC/C,MAAMC,WAAW,GAAGL,mBAAmB,CAACM,OAAO,CAAEhB,QAAQ,IAAK;IAC5D,MAAMiB,GAAG,GAAG,CAACd,0BAAW,CAACC,uBAAuB,CAACJ,QAAQ,CAAC,CAAC;IAC3D,IAAIA,QAAQ,KAAKY,oBAAU,CAACC,IAAI,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAEM,GAAG,CAACC,IAAI,CAACf,0BAAW,CAACC,uBAAuB,CAACO,KAAK,CAAC,CAAC;IACnH,OAAOM,GAAG;EACZ,CAAC,CAAC;EACF,OAAOZ,MAAM,CAACC,IAAI,CAACL,WAAW,CAAC,CAACkB,MAAM,CAAEX,GAAG,IAAKO,WAAW,CAACK,QAAQ,CAACjB,0BAAW,CAACC,uBAAuB,CAACI,GAAG,CAAC,CAAC,CAAC;AACjH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _chai() {
|
|
4
|
+
const data = require("chai");
|
|
5
|
+
_chai = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _localConfigMerge() {
|
|
11
|
+
const data = require("./local-config-merge");
|
|
12
|
+
_localConfigMerge = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
describe('local-config-merge', () => {
|
|
18
|
+
const localConfigWithEnv = {
|
|
19
|
+
'teambit.envs/envs': {
|
|
20
|
+
env: 'my-org.my-scope/my-env'
|
|
21
|
+
},
|
|
22
|
+
'my-org.my-scope/my-env@1.0.0': {},
|
|
23
|
+
'teambit.dependencies/dependency-resolver': {
|
|
24
|
+
policy: {
|
|
25
|
+
dependencies: {
|
|
26
|
+
lodash: '4.17.21'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
describe('isAspectInLocalConfig', () => {
|
|
32
|
+
it('should ignore versions when comparing aspect ids', () => {
|
|
33
|
+
(0, _chai().expect)((0, _localConfigMerge().isAspectInLocalConfig)('my-org.my-scope/my-env@2.0.0', localConfigWithEnv)).to.be.true;
|
|
34
|
+
(0, _chai().expect)((0, _localConfigMerge().isAspectInLocalConfig)('my-org.my-scope/my-env', localConfigWithEnv)).to.be.true;
|
|
35
|
+
});
|
|
36
|
+
it('should return false for an aspect that is not set locally', () => {
|
|
37
|
+
(0, _chai().expect)((0, _localConfigMerge().isAspectInLocalConfig)('teambit.pkg/pkg', localConfigWithEnv)).to.be.false;
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
describe('getLocalConfigKeysToRemove', () => {
|
|
41
|
+
it('should remove both env keys when "teambit.envs/envs" is conflicted', () => {
|
|
42
|
+
(0, _chai().expect)((0, _localConfigMerge().getLocalConfigKeysToRemove)(localConfigWithEnv, ['teambit.envs/envs'])).to.have.members(['teambit.envs/envs', 'my-org.my-scope/my-env@1.0.0']);
|
|
43
|
+
});
|
|
44
|
+
it('should remove only the conflicted aspect, regardless of its version', () => {
|
|
45
|
+
const localConfig = {
|
|
46
|
+
'my-org.my-scope/my-aspect@0.0.1': {
|
|
47
|
+
foo: 'bar'
|
|
48
|
+
},
|
|
49
|
+
'teambit.pkg/pkg': {}
|
|
50
|
+
};
|
|
51
|
+
(0, _chai().expect)((0, _localConfigMerge().getLocalConfigKeysToRemove)(localConfig, ['my-org.my-scope/my-aspect@0.0.2'])).to.deep.equal(['my-org.my-scope/my-aspect@0.0.1']);
|
|
52
|
+
});
|
|
53
|
+
it('should not remove anything when there are no conflicts', () => {
|
|
54
|
+
(0, _chai().expect)((0, _localConfigMerge().getLocalConfigKeysToRemove)(localConfigWithEnv, [])).to.deep.equal([]);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=local-config-merge.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_localConfigMerge","describe","localConfigWithEnv","env","policy","dependencies","lodash","it","expect","isAspectInLocalConfig","to","be","true","false","getLocalConfigKeysToRemove","have","members","localConfig","foo","deep","equal"],"sources":["local-config-merge.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { getLocalConfigKeysToRemove, isAspectInLocalConfig } from './local-config-merge';\n\ndescribe('local-config-merge', () => {\n const localConfigWithEnv = {\n 'teambit.envs/envs': { env: 'my-org.my-scope/my-env' },\n 'my-org.my-scope/my-env@1.0.0': {},\n 'teambit.dependencies/dependency-resolver': { policy: { dependencies: { lodash: '4.17.21' } } },\n };\n describe('isAspectInLocalConfig', () => {\n it('should ignore versions when comparing aspect ids', () => {\n expect(isAspectInLocalConfig('my-org.my-scope/my-env@2.0.0', localConfigWithEnv)).to.be.true;\n expect(isAspectInLocalConfig('my-org.my-scope/my-env', localConfigWithEnv)).to.be.true;\n });\n it('should return false for an aspect that is not set locally', () => {\n expect(isAspectInLocalConfig('teambit.pkg/pkg', localConfigWithEnv)).to.be.false;\n });\n });\n describe('getLocalConfigKeysToRemove', () => {\n it('should remove both env keys when \"teambit.envs/envs\" is conflicted', () => {\n expect(getLocalConfigKeysToRemove(localConfigWithEnv, ['teambit.envs/envs'])).to.have.members([\n 'teambit.envs/envs',\n 'my-org.my-scope/my-env@1.0.0',\n ]);\n });\n it('should remove only the conflicted aspect, regardless of its version', () => {\n const localConfig = { 'my-org.my-scope/my-aspect@0.0.1': { foo: 'bar' }, 'teambit.pkg/pkg': {} };\n expect(getLocalConfigKeysToRemove(localConfig, ['my-org.my-scope/my-aspect@0.0.2'])).to.deep.equal([\n 'my-org.my-scope/my-aspect@0.0.1',\n ]);\n });\n it('should not remove anything when there are no conflicts', () => {\n expect(getLocalConfigKeysToRemove(localConfigWithEnv, [])).to.deep.equal([]);\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,kBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,iBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEAG,QAAQ,CAAC,oBAAoB,EAAE,MAAM;EACnC,MAAMC,kBAAkB,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,CAAC,iCAAiC,CAAC,CAAC,CAAC,CAACP,EAAE,CAACS,IAAI,CAACC,KAAK,CAAC,CACjG,iCAAiC,CAClC,CAAC;IACJ,CAAC,CAAC;IACFb,EAAE,CAAC,wDAAwD,EAAE,MAAM;MACjE,IAAAC,cAAM,EAAC,IAAAM,8CAA0B,EAACZ,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAACQ,EAAE,CAACS,IAAI,CAACC,KAAK,CAAC,EAAE,CAAC;IAC9E,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/checkout",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1294",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/checkout",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "checkout",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1294"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
13
13
|
"lodash": "4.18.1",
|
|
14
14
|
"p-map-series": "2.1.0",
|
|
15
15
|
"@teambit/bit-error": "0.0.404",
|
|
16
|
+
"@teambit/cli": "0.0.1436",
|
|
16
17
|
"@teambit/component-id": "1.2.5",
|
|
17
|
-
"@teambit/component.modules.merge-helper": "0.0.
|
|
18
|
+
"@teambit/component.modules.merge-helper": "0.0.150",
|
|
18
19
|
"@teambit/legacy.constants": "0.0.51",
|
|
19
20
|
"@teambit/component.sources": "0.0.247",
|
|
21
|
+
"@teambit/config-merger": "0.0.1147",
|
|
20
22
|
"@teambit/legacy.bit-map": "0.0.253",
|
|
21
23
|
"@teambit/legacy.consumer-component": "0.0.198",
|
|
22
24
|
"@teambit/legacy.consumer": "0.0.204",
|
|
23
25
|
"@teambit/legacy.utils": "0.0.57",
|
|
26
|
+
"@teambit/objects": "0.0.743",
|
|
24
27
|
"@teambit/harmony": "0.4.12",
|
|
28
|
+
"@teambit/component-writer": "1.0.1282",
|
|
25
29
|
"@teambit/harmony.modules.runtimes": "0.0.4",
|
|
30
|
+
"@teambit/importer": "1.0.1283",
|
|
26
31
|
"@teambit/legacy.scope": "0.0.204",
|
|
32
|
+
"@teambit/lister": "1.0.1280",
|
|
27
33
|
"@teambit/logger": "0.0.1503",
|
|
28
|
-
"@teambit/
|
|
29
|
-
"@teambit/
|
|
30
|
-
"@teambit/component-writer": "1.0.1281",
|
|
31
|
-
"@teambit/importer": "1.0.1282",
|
|
32
|
-
"@teambit/lister": "1.0.1279",
|
|
33
|
-
"@teambit/remove": "1.0.1283",
|
|
34
|
-
"@teambit/workspace": "1.0.1279"
|
|
34
|
+
"@teambit/remove": "1.0.1284",
|
|
35
|
+
"@teambit/workspace": "1.0.1280"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/lodash": "4.14.165",
|
|
@@ -40,9 +41,9 @@
|
|
|
40
41
|
"@types/mocha": "9.1.0",
|
|
41
42
|
"@teambit/component.testing.mock-components": "0.0.480",
|
|
42
43
|
"@teambit/harmony.testing.load-aspect": "0.0.474",
|
|
43
|
-
"@teambit/workspace.testing.mock-workspace": "0.0.
|
|
44
|
+
"@teambit/workspace.testing.mock-workspace": "0.0.292",
|
|
44
45
|
"@teambit/harmony.envs.core-aspect-env": "2.1.2",
|
|
45
|
-
"@teambit/snapping": "1.0.
|
|
46
|
+
"@teambit/snapping": "1.0.1292"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"chai": "5.2.1",
|
|
File without changes
|