@teambit/snapping 1.0.506 → 1.0.508
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +7 -7
- package/artifacts/schema.json +388 -198
- package/dist/reset-component.d.ts +3 -2
- package/dist/reset-component.js +7 -7
- package/dist/reset-component.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +15 -2
- package/dist/snapping.main.runtime.js +28 -11
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/tag-model-component.js +1 -1
- package/dist/tag-model-component.js.map +1 -1
- package/package.json +37 -37
- /package/dist/{preview-1736306355320.js → preview-1736535915537.js} +0 -0
|
@@ -2,6 +2,7 @@ import { ComponentID } from '@teambit/component-id';
|
|
|
2
2
|
import { Consumer } from '@teambit/legacy.consumer';
|
|
3
3
|
import { Lane, ModelComponent } from '@teambit/scope.objects';
|
|
4
4
|
import { RemoveMain } from '@teambit/remove';
|
|
5
|
+
import { Workspace } from '@teambit/workspace';
|
|
5
6
|
export type ResetResult = {
|
|
6
7
|
id: ComponentID;
|
|
7
8
|
versions: string[];
|
|
@@ -16,6 +17,6 @@ export type ResetResult = {
|
|
|
16
17
|
* If head is false, remove all local versions.
|
|
17
18
|
*/
|
|
18
19
|
export declare function removeLocalVersion(consumer: Consumer, id: ComponentID, lane?: Lane, head?: boolean, force?: boolean): Promise<ResetResult>;
|
|
19
|
-
export declare function removeLocalVersionsForAllComponents(
|
|
20
|
+
export declare function removeLocalVersionsForAllComponents(workspace: Workspace, remove: RemoveMain, lane?: Lane, head?: boolean): Promise<ResetResult[]>;
|
|
20
21
|
export declare function removeLocalVersionsForMultipleComponents(consumer: Consumer, componentsToUntag: ModelComponent[], lane?: Lane, head?: boolean, force?: boolean): Promise<ResetResult[]>;
|
|
21
|
-
export declare function getComponentsWithOptionToUntag(
|
|
22
|
+
export declare function getComponentsWithOptionToUntag(workspace: Workspace, remove: RemoveMain): Promise<ModelComponent[]>;
|
package/dist/reset-component.js
CHANGED
|
@@ -80,10 +80,10 @@ async function removeLocalVersion(consumer, id, lane, head, force = false) {
|
|
|
80
80
|
versionToSetInBitmap
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
async function removeLocalVersionsForAllComponents(
|
|
84
|
-
const componentsToUntag = await getComponentsWithOptionToUntag(
|
|
83
|
+
async function removeLocalVersionsForAllComponents(workspace, remove, lane, head) {
|
|
84
|
+
const componentsToUntag = await getComponentsWithOptionToUntag(workspace, remove);
|
|
85
85
|
const force = true; // when removing local versions from all components, no need to check if the component is used as a dependency
|
|
86
|
-
return removeLocalVersionsForMultipleComponents(consumer, componentsToUntag, lane, head, force);
|
|
86
|
+
return removeLocalVersionsForMultipleComponents(workspace.consumer, componentsToUntag, lane, head, force);
|
|
87
87
|
}
|
|
88
88
|
async function removeLocalVersionsForMultipleComponents(consumer, componentsToUntag, lane, head, force) {
|
|
89
89
|
if (!componentsToUntag.length) {
|
|
@@ -113,16 +113,16 @@ async function removeLocalVersionsForMultipleComponents(consumer, componentsToUn
|
|
|
113
113
|
_legacy2().logger.debug(`found ${componentsToUntag.length} components to untag`);
|
|
114
114
|
return Promise.all(componentsToUntag.map(component => removeLocalVersion(consumer, component.toComponentId(), lane, head, force)));
|
|
115
115
|
}
|
|
116
|
-
async function getComponentsWithOptionToUntag(
|
|
117
|
-
const componentList = new (_legacy().ComponentsList)(
|
|
118
|
-
const laneObj = await
|
|
116
|
+
async function getComponentsWithOptionToUntag(workspace, remove) {
|
|
117
|
+
const componentList = new (_legacy().ComponentsList)(workspace);
|
|
118
|
+
const laneObj = await workspace.getCurrentLaneObject();
|
|
119
119
|
const components = await componentList.listExportPendingComponents(laneObj);
|
|
120
120
|
const removedStagedIds = await remove.getRemovedStaged();
|
|
121
121
|
if (!removedStagedIds.length) return components;
|
|
122
122
|
const removedStagedBitIds = removedStagedIds.map(id => id);
|
|
123
123
|
const nonExistsInStaged = removedStagedBitIds.filter(id => !components.find(c => c.toComponentId().isEqualWithoutVersion(id)));
|
|
124
124
|
if (!nonExistsInStaged.length) return components;
|
|
125
|
-
const modelComps = await Promise.all(nonExistsInStaged.map(id => consumer.scope.getModelComponent(id)));
|
|
125
|
+
const modelComps = await Promise.all(nonExistsInStaged.map(id => workspace.consumer.scope.getModelComponent(id)));
|
|
126
126
|
components.push(...modelComps);
|
|
127
127
|
return components;
|
|
128
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","_legacy","_legacy2","_legacy3","removeLocalVersion","consumer","id","lane","head","force","component","scope","getModelComponent","idStr","toString","fromBitmap","bitMap","getComponentIdIfExist","localVersions","getLocalHashes","objects","length","BitError","headRef","getHeadRegardlessOfLane","Error","find","v","isEqual","versionsToRemove","versionsToRemoveStr","switchHashesWithTagsIfExist","dependencyGraph","DependencyGraph","loadAllVersions","forEach","versionToRemove","idWithVersion","toComponentId","changeVersion","dependents","getImmediateDependentsPerId","join","headBefore","getHead","sources","removeComponentVersions","headAfter","versionToSetInBitmap","divergeData","getDivergeData","snapBeforeDetached","commonSnapBeforeDiverge","getTagOfRefIfExists","versions","removeLocalVersionsForAllComponents","remove","componentsToUntag","getComponentsWithOptionToUntag","removeLocalVersionsForMultipleComponents","candidateComponentsIds","map","bitId","candidateComponentsIdsStr","dependentsNotCandidates","filter","dependent","includes","version","logger","debug","Promise","all","componentList","ComponentsList","laneObj","getCurrentLaneObject","components","listExportPendingComponents","removedStagedIds","getRemovedStaged","removedStagedBitIds","nonExistsInStaged","c","isEqualWithoutVersion","modelComps","push"],"sources":["reset-component.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { ComponentID } from '@teambit/component-id';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport { logger } from '@teambit/legacy.logger';\nimport { Lane, ModelComponent } from '@teambit/scope.objects';\nimport { RemoveMain } from '@teambit/remove';\nimport { DependencyGraph } from '@teambit/legacy.dependency-graph';\n\nexport type ResetResult = {\n id: ComponentID;\n versions: string[];\n component?: ModelComponent;\n /**\n * relevant when the component was detached head so the head didn't change.\n * we want .bitmap to have the version before the detachment. not as the head.\n */\n versionToSetInBitmap?: string;\n};\n\n/**\n * If head is false, remove all local versions.\n */\nexport async function removeLocalVersion(\n consumer: Consumer,\n id: ComponentID,\n lane?: Lane,\n head?: boolean,\n force = false\n): Promise<ResetResult> {\n const component: ModelComponent = await consumer.scope.getModelComponent(id);\n const idStr = id.toString();\n const fromBitmap = consumer.bitMap.getComponentIdIfExist(id);\n const localVersions = await component.getLocalHashes(consumer.scope.objects, fromBitmap);\n if (!localVersions.length) throw new BitError(`unable to untag ${idStr}, the component is not staged`);\n const headRef = component.getHeadRegardlessOfLane();\n if (!headRef) {\n throw new Error(`unable to reset ${idStr}, it has not head`);\n }\n if (head && !localVersions.find((v) => v.isEqual(headRef))) {\n throw new Error(`unable to reset ${idStr}, the head ${headRef.toString()} is exported`);\n }\n const versionsToRemove = head ? [headRef] : localVersions;\n const versionsToRemoveStr = component.switchHashesWithTagsIfExist(versionsToRemove);\n\n if (!force) {\n const dependencyGraph = await DependencyGraph.loadAllVersions(consumer.scope);\n\n versionsToRemoveStr.forEach((versionToRemove) => {\n const idWithVersion = component.toComponentId().changeVersion(versionToRemove);\n const dependents = dependencyGraph.getImmediateDependentsPerId(idWithVersion);\n if (dependents.length) {\n throw new BitError(\n `unable to reset ${idStr}, the version ${versionToRemove} has the following dependent(s) ${dependents.join(\n ', '\n )}`\n );\n }\n });\n }\n\n const headBefore = component.getHead();\n await consumer.scope.sources.removeComponentVersions(component, versionsToRemove, versionsToRemoveStr, lane, head);\n const headAfter = component.getHead();\n let versionToSetInBitmap;\n if (headBefore && headAfter && headBefore.isEqual(headAfter) && !lane) {\n // if it's on main and the head didn't change, it means that it was in a detached-head state.\n const divergeData = component.getDivergeData();\n const snapBeforeDetached = divergeData.commonSnapBeforeDiverge;\n if (snapBeforeDetached) versionToSetInBitmap = component.getTagOfRefIfExists(snapBeforeDetached);\n }\n\n return { id, versions: versionsToRemoveStr, component, versionToSetInBitmap };\n}\n\nexport async function removeLocalVersionsForAllComponents(\n consumer: Consumer,\n remove: RemoveMain,\n lane?: Lane,\n head?: boolean\n): Promise<ResetResult[]> {\n const componentsToUntag = await getComponentsWithOptionToUntag(consumer, remove);\n const force = true; // when removing local versions from all components, no need to check if the component is used as a dependency\n return removeLocalVersionsForMultipleComponents(consumer, componentsToUntag, lane, head, force);\n}\n\nexport async function removeLocalVersionsForMultipleComponents(\n consumer: Consumer,\n componentsToUntag: ModelComponent[],\n lane?: Lane,\n head?: boolean,\n force?: boolean\n) {\n if (!componentsToUntag.length) {\n throw new BitError(`no components found to reset on your workspace`);\n }\n // if only head is removed, there is risk of deleting dependencies version without their dependents.\n if (!force && head) {\n const dependencyGraph = await DependencyGraph.loadAllVersions(consumer.scope);\n const candidateComponentsIds = componentsToUntag.map((component) => {\n const bitId = component.toComponentId();\n const headRef = component.getHeadRegardlessOfLane();\n if (!headRef)\n throw new Error(`component ${bitId.toString()} does not have head. it should not be a candidate for reset`);\n\n return bitId.changeVersion(component.getTagOfRefIfExists(headRef) || headRef.toString());\n });\n const candidateComponentsIdsStr = candidateComponentsIds.map((id) => id.toString());\n candidateComponentsIds.forEach((bitId: ComponentID) => {\n const dependents = dependencyGraph.getImmediateDependentsPerId(bitId);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const dependentsNotCandidates = dependents.filter((dependent) => !candidateComponentsIdsStr.includes(dependent));\n if (dependentsNotCandidates.length) {\n throw new BitError( // $FlowFixMe\n `unable to untag ${bitId}, the version ${bitId.version} has the following dependent(s) ${dependents.join(\n ', '\n )}`\n );\n }\n });\n }\n logger.debug(`found ${componentsToUntag.length} components to untag`);\n return Promise.all(\n componentsToUntag.map((component) => removeLocalVersion(consumer, component.toComponentId(), lane, head, force))\n );\n}\n\nexport async function getComponentsWithOptionToUntag(\n consumer: Consumer,\n remove: RemoveMain\n): Promise<ModelComponent[]> {\n const componentList = new ComponentsList(consumer);\n const laneObj = await consumer.getCurrentLaneObject();\n const components: ModelComponent[] = await componentList.listExportPendingComponents(laneObj);\n const removedStagedIds = await remove.getRemovedStaged();\n if (!removedStagedIds.length) return components;\n const removedStagedBitIds = removedStagedIds.map((id) => id);\n const nonExistsInStaged = removedStagedBitIds.filter(\n (id) => !components.find((c) => c.toComponentId().isEqualWithoutVersion(id))\n );\n if (!nonExistsInStaged.length) return components;\n const modelComps = await Promise.all(nonExistsInStaged.map((id) => consumer.scope.getModelComponent(id)));\n components.push(...modelComps);\n\n return components;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,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,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAaA;AACA;AACA;AACO,eAAeK,kBAAkBA,CACtCC,QAAkB,EAClBC,EAAe,EACfC,IAAW,EACXC,IAAc,EACdC,KAAK,GAAG,KAAK,EACS;EACtB,MAAMC,SAAyB,GAAG,MAAML,QAAQ,CAACM,KAAK,CAACC,iBAAiB,CAACN,EAAE,CAAC;EAC5E,MAAMO,KAAK,GAAGP,EAAE,CAACQ,QAAQ,CAAC,CAAC;EAC3B,MAAMC,UAAU,GAAGV,QAAQ,CAACW,MAAM,CAACC,qBAAqB,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":3,"names":["_bitError","data","require","_legacy","_legacy2","_legacy3","removeLocalVersion","consumer","id","lane","head","force","component","scope","getModelComponent","idStr","toString","fromBitmap","bitMap","getComponentIdIfExist","localVersions","getLocalHashes","objects","length","BitError","headRef","getHeadRegardlessOfLane","Error","find","v","isEqual","versionsToRemove","versionsToRemoveStr","switchHashesWithTagsIfExist","dependencyGraph","DependencyGraph","loadAllVersions","forEach","versionToRemove","idWithVersion","toComponentId","changeVersion","dependents","getImmediateDependentsPerId","join","headBefore","getHead","sources","removeComponentVersions","headAfter","versionToSetInBitmap","divergeData","getDivergeData","snapBeforeDetached","commonSnapBeforeDiverge","getTagOfRefIfExists","versions","removeLocalVersionsForAllComponents","workspace","remove","componentsToUntag","getComponentsWithOptionToUntag","removeLocalVersionsForMultipleComponents","candidateComponentsIds","map","bitId","candidateComponentsIdsStr","dependentsNotCandidates","filter","dependent","includes","version","logger","debug","Promise","all","componentList","ComponentsList","laneObj","getCurrentLaneObject","components","listExportPendingComponents","removedStagedIds","getRemovedStaged","removedStagedBitIds","nonExistsInStaged","c","isEqualWithoutVersion","modelComps","push"],"sources":["reset-component.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { ComponentID } from '@teambit/component-id';\nimport { Consumer } from '@teambit/legacy.consumer';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport { logger } from '@teambit/legacy.logger';\nimport { Lane, ModelComponent } from '@teambit/scope.objects';\nimport { RemoveMain } from '@teambit/remove';\nimport { DependencyGraph } from '@teambit/legacy.dependency-graph';\nimport { Workspace } from '@teambit/workspace';\n\nexport type ResetResult = {\n id: ComponentID;\n versions: string[];\n component?: ModelComponent;\n /**\n * relevant when the component was detached head so the head didn't change.\n * we want .bitmap to have the version before the detachment. not as the head.\n */\n versionToSetInBitmap?: string;\n};\n\n/**\n * If head is false, remove all local versions.\n */\nexport async function removeLocalVersion(\n consumer: Consumer,\n id: ComponentID,\n lane?: Lane,\n head?: boolean,\n force = false\n): Promise<ResetResult> {\n const component: ModelComponent = await consumer.scope.getModelComponent(id);\n const idStr = id.toString();\n const fromBitmap = consumer.bitMap.getComponentIdIfExist(id);\n const localVersions = await component.getLocalHashes(consumer.scope.objects, fromBitmap);\n if (!localVersions.length) throw new BitError(`unable to untag ${idStr}, the component is not staged`);\n const headRef = component.getHeadRegardlessOfLane();\n if (!headRef) {\n throw new Error(`unable to reset ${idStr}, it has not head`);\n }\n if (head && !localVersions.find((v) => v.isEqual(headRef))) {\n throw new Error(`unable to reset ${idStr}, the head ${headRef.toString()} is exported`);\n }\n const versionsToRemove = head ? [headRef] : localVersions;\n const versionsToRemoveStr = component.switchHashesWithTagsIfExist(versionsToRemove);\n\n if (!force) {\n const dependencyGraph = await DependencyGraph.loadAllVersions(consumer.scope);\n\n versionsToRemoveStr.forEach((versionToRemove) => {\n const idWithVersion = component.toComponentId().changeVersion(versionToRemove);\n const dependents = dependencyGraph.getImmediateDependentsPerId(idWithVersion);\n if (dependents.length) {\n throw new BitError(\n `unable to reset ${idStr}, the version ${versionToRemove} has the following dependent(s) ${dependents.join(\n ', '\n )}`\n );\n }\n });\n }\n\n const headBefore = component.getHead();\n await consumer.scope.sources.removeComponentVersions(component, versionsToRemove, versionsToRemoveStr, lane, head);\n const headAfter = component.getHead();\n let versionToSetInBitmap;\n if (headBefore && headAfter && headBefore.isEqual(headAfter) && !lane) {\n // if it's on main and the head didn't change, it means that it was in a detached-head state.\n const divergeData = component.getDivergeData();\n const snapBeforeDetached = divergeData.commonSnapBeforeDiverge;\n if (snapBeforeDetached) versionToSetInBitmap = component.getTagOfRefIfExists(snapBeforeDetached);\n }\n\n return { id, versions: versionsToRemoveStr, component, versionToSetInBitmap };\n}\n\nexport async function removeLocalVersionsForAllComponents(\n workspace: Workspace,\n remove: RemoveMain,\n lane?: Lane,\n head?: boolean\n): Promise<ResetResult[]> {\n const componentsToUntag = await getComponentsWithOptionToUntag(workspace, remove);\n const force = true; // when removing local versions from all components, no need to check if the component is used as a dependency\n return removeLocalVersionsForMultipleComponents(workspace.consumer, componentsToUntag, lane, head, force);\n}\n\nexport async function removeLocalVersionsForMultipleComponents(\n consumer: Consumer,\n componentsToUntag: ModelComponent[],\n lane?: Lane,\n head?: boolean,\n force?: boolean\n) {\n if (!componentsToUntag.length) {\n throw new BitError(`no components found to reset on your workspace`);\n }\n // if only head is removed, there is risk of deleting dependencies version without their dependents.\n if (!force && head) {\n const dependencyGraph = await DependencyGraph.loadAllVersions(consumer.scope);\n const candidateComponentsIds = componentsToUntag.map((component) => {\n const bitId = component.toComponentId();\n const headRef = component.getHeadRegardlessOfLane();\n if (!headRef)\n throw new Error(`component ${bitId.toString()} does not have head. it should not be a candidate for reset`);\n\n return bitId.changeVersion(component.getTagOfRefIfExists(headRef) || headRef.toString());\n });\n const candidateComponentsIdsStr = candidateComponentsIds.map((id) => id.toString());\n candidateComponentsIds.forEach((bitId: ComponentID) => {\n const dependents = dependencyGraph.getImmediateDependentsPerId(bitId);\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n const dependentsNotCandidates = dependents.filter((dependent) => !candidateComponentsIdsStr.includes(dependent));\n if (dependentsNotCandidates.length) {\n throw new BitError( // $FlowFixMe\n `unable to untag ${bitId}, the version ${bitId.version} has the following dependent(s) ${dependents.join(\n ', '\n )}`\n );\n }\n });\n }\n logger.debug(`found ${componentsToUntag.length} components to untag`);\n return Promise.all(\n componentsToUntag.map((component) => removeLocalVersion(consumer, component.toComponentId(), lane, head, force))\n );\n}\n\nexport async function getComponentsWithOptionToUntag(\n workspace: Workspace,\n remove: RemoveMain\n): Promise<ModelComponent[]> {\n const componentList = new ComponentsList(workspace);\n const laneObj = await workspace.getCurrentLaneObject();\n const components: ModelComponent[] = await componentList.listExportPendingComponents(laneObj);\n const removedStagedIds = await remove.getRemovedStaged();\n if (!removedStagedIds.length) return components;\n const removedStagedBitIds = removedStagedIds.map((id) => id);\n const nonExistsInStaged = removedStagedBitIds.filter(\n (id) => !components.find((c) => c.toComponentId().isEqualWithoutVersion(id))\n );\n if (!nonExistsInStaged.length) return components;\n const modelComps = await Promise.all(nonExistsInStaged.map((id) => workspace.consumer.scope.getModelComponent(id)));\n components.push(...modelComps);\n\n return components;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,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,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAcA;AACA;AACA;AACO,eAAeK,kBAAkBA,CACtCC,QAAkB,EAClBC,EAAe,EACfC,IAAW,EACXC,IAAc,EACdC,KAAK,GAAG,KAAK,EACS;EACtB,MAAMC,SAAyB,GAAG,MAAML,QAAQ,CAACM,KAAK,CAACC,iBAAiB,CAACN,EAAE,CAAC;EAC5E,MAAMO,KAAK,GAAGP,EAAE,CAACQ,QAAQ,CAAC,CAAC;EAC3B,MAAMC,UAAU,GAAGV,QAAQ,CAACW,MAAM,CAACC,qBAAqB,CAACX,EAAE,CAAC;EAC5D,MAAMY,aAAa,GAAG,MAAMR,SAAS,CAACS,cAAc,CAACd,QAAQ,CAACM,KAAK,CAACS,OAAO,EAAEL,UAAU,CAAC;EACxF,IAAI,CAACG,aAAa,CAACG,MAAM,EAAE,MAAM,KAAIC,oBAAQ,EAAC,mBAAmBT,KAAK,+BAA+B,CAAC;EACtG,MAAMU,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BA,CAClDH,SAAoB,EACpBC,MAAkB,EACS;EAC3B,MAAMiB,aAAa,GAAG,KAAIC,wBAAc,EAACnB,SAAS,CAAC;EACnD,MAAMoB,OAAO,GAAG,MAAMpB,SAAS,CAACqB,oBAAoB,CAAC,CAAC;EACtD,MAAMC,UAA4B,GAAG,MAAMJ,aAAa,CAACK,2BAA2B,CAACH,OAAO,CAAC;EAC7F,MAAMI,gBAAgB,GAAG,MAAMvB,MAAM,CAACwB,gBAAgB,CAAC,CAAC;EACxD,IAAI,CAACD,gBAAgB,CAAC3D,MAAM,EAAE,OAAOyD,UAAU;EAC/C,MAAMI,mBAAmB,GAAGF,gBAAgB,CAAClB,GAAG,CAAExD,EAAE,IAAKA,EAAE,CAAC;EAC5D,MAAM6E,iBAAiB,GAAGD,mBAAmB,CAAChB,MAAM,CACjD5D,EAAE,IAAK,CAACwE,UAAU,CAACpD,IAAI,CAAE0D,CAAC,IAAKA,CAAC,CAAC9C,aAAa,CAAC,CAAC,CAAC+C,qBAAqB,CAAC/E,EAAE,CAAC,CAC7E,CAAC;EACD,IAAI,CAAC6E,iBAAiB,CAAC9D,MAAM,EAAE,OAAOyD,UAAU;EAChD,MAAMQ,UAAU,GAAG,MAAMd,OAAO,CAACC,GAAG,CAACU,iBAAiB,CAACrB,GAAG,CAAExD,EAAE,IAAKkD,SAAS,CAACnD,QAAQ,CAACM,KAAK,CAACC,iBAAiB,CAACN,EAAE,CAAC,CAAC,CAAC;EACnHwE,UAAU,CAACS,IAAI,CAAC,GAAGD,UAAU,CAAC;EAE9B,OAAOR,UAAU;AACnB","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import { LegacyOnTagResult } from '@teambit/legacy.scope';
|
|
|
3
3
|
import { Workspace, AutoTagResult } from '@teambit/workspace';
|
|
4
4
|
import { ReleaseType } from 'semver';
|
|
5
5
|
import { ComponentID, ComponentIdList } from '@teambit/component-id';
|
|
6
|
+
import { BuildStatus } from '@teambit/legacy.constants';
|
|
6
7
|
import { Logger, LoggerMain } from '@teambit/logger';
|
|
7
8
|
import { ConsumerComponent } from '@teambit/legacy.consumer-component';
|
|
8
9
|
import { InsightsMain } from '@teambit/insights';
|
|
@@ -166,8 +167,20 @@ export declare class SnappingMain {
|
|
|
166
167
|
version: Version;
|
|
167
168
|
addedVersionStr: string;
|
|
168
169
|
}>;
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
/**
|
|
171
|
+
* for an existing component in the local scope, add the updated Version-object/artifacts to the repository
|
|
172
|
+
* so the next "persist()" call will save them to the filesystem
|
|
173
|
+
*/
|
|
174
|
+
enrichComp(component: Component, modifiedLog?: Log): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* needed to be updated after the build-pipeline was running
|
|
177
|
+
*/
|
|
178
|
+
setBuildStatus(component: Component, buildStatus: BuildStatus): void;
|
|
179
|
+
/**
|
|
180
|
+
* for an existing component in the local scope, update the Version object with the updated data from the
|
|
181
|
+
* consumer-component and return the objects that need to be saved in the filesystem
|
|
182
|
+
*/
|
|
183
|
+
getObjectsToEnrichComp(component: Component, modifiedLog?: Log): Promise<BitObject[]>;
|
|
171
184
|
private transformArtifactsFromVinylToSource;
|
|
172
185
|
private loadComponentsForTagOrSnap;
|
|
173
186
|
private throwForPendingImport;
|
|
@@ -402,7 +402,7 @@ class SnappingMain {
|
|
|
402
402
|
if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
|
|
403
403
|
const validExactVersion = (0, _pkgModules().validateVersion)(exactVersion);
|
|
404
404
|
const consumer = this.workspace.consumer;
|
|
405
|
-
const componentsList = new (_legacy4().ComponentsList)(
|
|
405
|
+
const componentsList = new (_legacy4().ComponentsList)(this.workspace);
|
|
406
406
|
this.logger.setStatusLine('determine components to tag...');
|
|
407
407
|
const newComponents = await componentsList.listNewComponents();
|
|
408
408
|
const {
|
|
@@ -746,7 +746,7 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
746
746
|
if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
|
|
747
747
|
if (pattern && legacyBitIds) throw new Error(`please pass either pattern or legacyBitIds, not both`);
|
|
748
748
|
const consumer = this.workspace.consumer;
|
|
749
|
-
const componentsList = new (_legacy4().ComponentsList)(
|
|
749
|
+
const componentsList = new (_legacy4().ComponentsList)(this.workspace);
|
|
750
750
|
const newComponents = await componentsList.listNewComponents();
|
|
751
751
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
752
752
|
const self = this;
|
|
@@ -838,9 +838,9 @@ in case you're unsure about the pattern syntax, use "bit pattern [--help]"`);
|
|
|
838
838
|
const currentLane = await consumer.getCurrentLaneObject();
|
|
839
839
|
const untag = async () => {
|
|
840
840
|
if (!componentPattern) {
|
|
841
|
-
return (0, _resetComponent().removeLocalVersionsForAllComponents)(
|
|
841
|
+
return (0, _resetComponent().removeLocalVersionsForAllComponents)(this.workspace, this.remove, currentLane, head);
|
|
842
842
|
}
|
|
843
|
-
const candidateComponents = await (0, _resetComponent().getComponentsWithOptionToUntag)(
|
|
843
|
+
const candidateComponents = await (0, _resetComponent().getComponentsWithOptionToUntag)(this.workspace, this.remove);
|
|
844
844
|
const idsMatchingPattern = await this.workspace.idsByPattern(componentPattern, true, {
|
|
845
845
|
includeDeleted: true
|
|
846
846
|
});
|
|
@@ -1176,16 +1176,33 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1176
1176
|
addedVersionStr
|
|
1177
1177
|
};
|
|
1178
1178
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* for an existing component in the local scope, add the updated Version-object/artifacts to the repository
|
|
1182
|
+
* so the next "persist()" call will save them to the filesystem
|
|
1183
|
+
*/
|
|
1184
|
+
async enrichComp(component, modifiedLog) {
|
|
1185
|
+
const objects = await this.getObjectsToEnrichComp(component, modifiedLog);
|
|
1181
1186
|
objects.forEach(obj => this.objectsRepo.add(obj));
|
|
1182
|
-
return consumerComponent;
|
|
1183
1187
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* needed to be updated after the build-pipeline was running
|
|
1191
|
+
*/
|
|
1192
|
+
setBuildStatus(component, buildStatus) {
|
|
1193
|
+
component.state._consumer.buildStatus = buildStatus;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* for an existing component in the local scope, update the Version object with the updated data from the
|
|
1198
|
+
* consumer-component and return the objects that need to be saved in the filesystem
|
|
1199
|
+
*/
|
|
1200
|
+
async getObjectsToEnrichComp(component, modifiedLog) {
|
|
1201
|
+
const consumerComponent = component.state._consumer;
|
|
1202
|
+
const modelComp = consumerComponent.modelComponent || (
|
|
1186
1203
|
// @todo: fix the ts error here with "source"
|
|
1187
1204
|
await this.scope.legacyScope.sources.findOrAddComponent(consumerComponent));
|
|
1188
|
-
const version = await
|
|
1205
|
+
const version = await modelComp.loadVersion(consumerComponent.id.version, this.objectsRepo, true);
|
|
1189
1206
|
if (modifiedLog) version.addModifiedLog(modifiedLog);
|
|
1190
1207
|
const artifactFiles = (0, _component().getArtifactsFiles)(consumerComponent.extensions);
|
|
1191
1208
|
const artifacts = this.transformArtifactsFromVinylToSource(artifactFiles);
|
|
@@ -1359,7 +1376,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1359
1376
|
}
|
|
1360
1377
|
async getComponentsToTag(includeUnmodified, exactVersion, persist, ids, snapped, unmerged) {
|
|
1361
1378
|
const warnings = [];
|
|
1362
|
-
const componentsList = new (_legacy4().ComponentsList)(this.workspace
|
|
1379
|
+
const componentsList = new (_legacy4().ComponentsList)(this.workspace);
|
|
1363
1380
|
if (persist) {
|
|
1364
1381
|
const softTaggedComponents = this.workspace.filter.bySoftTagged();
|
|
1365
1382
|
return {
|