@teambit/snapping 1.0.1234 → 1.0.1236
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/generate-comp-from-scope.d.ts +2 -1
- package/dist/generate-comp-from-scope.js +2 -2
- package/dist/generate-comp-from-scope.js.map +1 -1
- package/dist/snapping.main.runtime.d.ts +10 -0
- package/dist/snapping.main.runtime.js +97 -24
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/version-maker.d.ts +9 -3
- package/dist/version-maker.js +34 -10
- package/dist/version-maker.js.map +1 -1
- package/package.json +37 -37
- /package/dist/{preview-1792418223123.js → preview-1792527927744.js} +0 -0
package/dist/version-maker.d.ts
CHANGED
|
@@ -126,10 +126,16 @@ export declare class VersionMaker {
|
|
|
126
126
|
private getVersionByEnteredId;
|
|
127
127
|
private addBuildStatus;
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
129
|
+
* when not building, replace the builder data, otherwise, it has the old build data of the previous snap/tag.
|
|
130
|
+
* (when building, the build overrides it anyway).
|
|
131
|
+
* the new data has only the tasks that are going to run once the component is built (e.g. by the CI), so they can
|
|
132
|
+
* be shown before the build starts.
|
|
131
133
|
*/
|
|
132
|
-
private
|
|
134
|
+
private setUnbuiltBuilderData;
|
|
135
|
+
/**
|
|
136
|
+
* the harmony components that were already loaded. (the auto-tagged ones are available only in a workspace).
|
|
137
|
+
*/
|
|
138
|
+
private getHarmonyComps;
|
|
133
139
|
private updateDependenciesVersions;
|
|
134
140
|
private getDependentsWithPinnedDeps;
|
|
135
141
|
/**
|
package/dist/version-maker.js
CHANGED
|
@@ -131,6 +131,13 @@ function _objects() {
|
|
|
131
131
|
};
|
|
132
132
|
return data;
|
|
133
133
|
}
|
|
134
|
+
function _legacy4() {
|
|
135
|
+
const data = require("@teambit/legacy.extension-data");
|
|
136
|
+
_legacy4 = function () {
|
|
137
|
+
return data;
|
|
138
|
+
};
|
|
139
|
+
return data;
|
|
140
|
+
}
|
|
134
141
|
function _messagePerComponent() {
|
|
135
142
|
const data = require("./message-per-component");
|
|
136
143
|
_messagePerComponent = function () {
|
|
@@ -215,10 +222,10 @@ class VersionMaker {
|
|
|
215
222
|
this.allWorkspaceComps = this.workspace ? await this.workspace.list() : undefined;
|
|
216
223
|
const componentsToTag = this.getUniqCompsToTag();
|
|
217
224
|
const idsToTag = _componentId().ComponentIdList.fromArray(componentsToTag.map(c => c.id));
|
|
218
|
-
|
|
225
|
+
// a component that is tagged explicitly is not auto-tagged too (the scope flow may find it as both)
|
|
226
|
+
const autoTagData = (await this.getAutoTagData(idsToTag)).filter(autoTagItem => !idsToTag.has(autoTagItem.component.id));
|
|
219
227
|
const autoTagComponents = autoTagData.map(autoTagItem => autoTagItem.component);
|
|
220
|
-
const
|
|
221
|
-
const autoTagIds = _componentId().ComponentIdList.fromArray(autoTagComponentsFiltered.map(autoTag => autoTag.id));
|
|
228
|
+
const autoTagIds = _componentId().ComponentIdList.fromArray(autoTagComponents.map(autoTag => autoTag.id));
|
|
222
229
|
|
|
223
230
|
// Validate component issues for auto-tag components
|
|
224
231
|
if (this.allWorkspaceComps && autoTagIds.length) {
|
|
@@ -226,7 +233,7 @@ class VersionMaker {
|
|
|
226
233
|
await this.builder.throwForComponentIssues(autoTagHarmonyComponents, this.params.ignoreIssues);
|
|
227
234
|
}
|
|
228
235
|
await this.triggerOnPreSnap(autoTagIds);
|
|
229
|
-
this.allComponentsToTag = [...componentsToTag, ...
|
|
236
|
+
this.allComponentsToTag = [...componentsToTag, ...autoTagComponents];
|
|
230
237
|
await this.parseVersionsFile(idsToTag, autoTagIds);
|
|
231
238
|
const messagePerId = await this.getMessagePerId(idsToTag, autoTagIds);
|
|
232
239
|
await this.checkForNewerVersions();
|
|
@@ -270,7 +277,7 @@ class VersionMaker {
|
|
|
270
277
|
await this._addDependenciesGraphToComponents();
|
|
271
278
|
}
|
|
272
279
|
await this.snapping.throwForDepsFromAnotherLane(this.allComponentsToTag);
|
|
273
|
-
if (!build) this.
|
|
280
|
+
if (!build) this.setUnbuiltBuilderData();
|
|
274
281
|
this.addBuildStatus(this.allComponentsToTag, _legacy().BuildStatus.Pending);
|
|
275
282
|
const currentLane = this.consumer?.getCurrentLaneId();
|
|
276
283
|
await (0, _pMapSeries().default)(this.allComponentsToTag, async component => {
|
|
@@ -576,7 +583,9 @@ class VersionMaker {
|
|
|
576
583
|
if (Object.keys(dependentsMap).length === 0) return [];
|
|
577
584
|
const allDependentsIds = _componentId().ComponentIdList.uniqFromArray(Object.values(dependentsMap).flat());
|
|
578
585
|
const allDependents = await this.legacyScope.getManyConsumerComponents(allDependentsIds);
|
|
579
|
-
|
|
586
|
+
// a component that was removed from the lane is not snapped again, same as in a workspace, where it's not loaded
|
|
587
|
+
const notRemovedDependents = allDependents.filter(dependent => !dependent.isRemoved());
|
|
588
|
+
return notRemovedDependents.map(dependent => {
|
|
580
589
|
const triggeredByIds = Object.keys(dependentsMap).filter(id => dependentsMap[id].has(dependent.id));
|
|
581
590
|
const triggeredBy = _componentId().ComponentIdList.fromStringArray(triggeredByIds);
|
|
582
591
|
return {
|
|
@@ -743,16 +752,31 @@ class VersionMaker {
|
|
|
743
752
|
}
|
|
744
753
|
|
|
745
754
|
/**
|
|
746
|
-
*
|
|
747
|
-
*
|
|
755
|
+
* when not building, replace the builder data, otherwise, it has the old build data of the previous snap/tag.
|
|
756
|
+
* (when building, the build overrides it anyway).
|
|
757
|
+
* the new data has only the tasks that are going to run once the component is built (e.g. by the CI), so they can
|
|
758
|
+
* be shown before the build starts.
|
|
748
759
|
*/
|
|
749
|
-
|
|
760
|
+
setUnbuiltBuilderData() {
|
|
761
|
+
const plannedTasksPerComp = this.builder.getPlannedTasks(this.getHarmonyComps(this.allComponentsToTag.filter(c => !c.isRemoved())), this.params.isSnap ? 'snap' : 'tag');
|
|
750
762
|
this.allComponentsToTag.forEach(component => {
|
|
751
763
|
component.extensions = component.extensions.clone();
|
|
764
|
+
const plannedTasks = plannedTasksPerComp.get(component.id.toStringWithoutVersion());
|
|
765
|
+
const data = plannedTasks ? {
|
|
766
|
+
plannedTasks
|
|
767
|
+
} : {};
|
|
752
768
|
const existingBuilder = component.extensions.findCoreExtension(_legacy().Extensions.builder);
|
|
753
|
-
if (existingBuilder) existingBuilder.data = {};
|
|
769
|
+
if (existingBuilder) existingBuilder.data = data;else if (plannedTasks) component.extensions.push(new (_legacy4().ExtensionDataEntry)(undefined, undefined, _legacy().Extensions.builder, {}, data));
|
|
754
770
|
});
|
|
755
771
|
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* the harmony components that were already loaded. (the auto-tagged ones are available only in a workspace).
|
|
775
|
+
*/
|
|
776
|
+
getHarmonyComps(consumerComponents) {
|
|
777
|
+
const loadedComps = [...this.components, ...(this.allWorkspaceComps || [])];
|
|
778
|
+
return (0, _lodash().compact)(consumerComponents.map(consumerComp => loadedComps.find(comp => comp.id.isEqualWithoutVersion(consumerComp.id))));
|
|
779
|
+
}
|
|
756
780
|
updateDependenciesVersions() {
|
|
757
781
|
// filter out removed components.
|
|
758
782
|
// if a component has a deleted-component as a dependency, it was probably running "bit install <dep>" with a version
|