@teambit/snapping 1.0.346 → 1.0.348
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 +9 -4
- package/artifacts/schema.json +154 -154
- package/dist/snapping.main.runtime.d.ts +1 -0
- package/dist/snapping.main.runtime.js +30 -10
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/snapping.spec.js +75 -0
- package/dist/snapping.spec.js.map +1 -1
- package/dist/tag-model-component.js +3 -1
- package/dist/tag-model-component.js.map +1 -1
- package/package.json +24 -24
- /package/dist/{preview-1721618348248.js → preview-1721791303259.js} +0 -0
|
@@ -180,6 +180,7 @@ export declare class SnappingMain {
|
|
|
180
180
|
* 2. save all dependencies data from the legacy into DependencyResolver aspect.
|
|
181
181
|
*/
|
|
182
182
|
UpdateDepsAspectsSaveIntoDepsResolver(component: Component, updatedIds: string[]): Promise<void>;
|
|
183
|
+
private getTagPendingComponentsIds;
|
|
183
184
|
private getComponentsToTag;
|
|
184
185
|
static slots: never[];
|
|
185
186
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
@@ -714,7 +714,9 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
714
714
|
const consumer = this.workspace.consumer;
|
|
715
715
|
const componentsList = new (_legacy().ComponentsList)(consumer);
|
|
716
716
|
const newComponents = await componentsList.listNewComponents();
|
|
717
|
-
|
|
717
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
718
|
+
const self = this;
|
|
719
|
+
const ids = legacyBitIds || (await getIdsToSnap());
|
|
718
720
|
if (!ids) return null;
|
|
719
721
|
this.logger.debug(`snapping the following components: ${ids.toString()}`);
|
|
720
722
|
const components = await this.loadComponentsForTagOrSnap(ids);
|
|
@@ -761,11 +763,11 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
761
763
|
await stagedConfig?.write();
|
|
762
764
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
763
765
|
return snapResults;
|
|
764
|
-
async function getIdsToSnap(
|
|
766
|
+
async function getIdsToSnap() {
|
|
765
767
|
if (unmerged) {
|
|
766
768
|
return componentsList.listDuringMergeStateComponents();
|
|
767
769
|
}
|
|
768
|
-
const tagPendingComponentsIds =
|
|
770
|
+
const tagPendingComponentsIds = await self.getTagPendingComponentsIds(unmodified);
|
|
769
771
|
if (!tagPendingComponentsIds.length) return null;
|
|
770
772
|
// when unmodified, we ask for all components, throw if no matching. if not unmodified and no matching, see error
|
|
771
773
|
// below, suggesting to use --unmodified flag.
|
|
@@ -773,14 +775,14 @@ if you're willing to lose the history from the head to the specified version, us
|
|
|
773
775
|
const getCompIds = async () => {
|
|
774
776
|
if (!pattern) return tagPendingComponentsIds;
|
|
775
777
|
if (!pattern.includes('*') && !pattern.includes(',')) {
|
|
776
|
-
const compId = await workspace.resolveComponentId(pattern);
|
|
778
|
+
const compId = await self.workspace.resolveComponentId(pattern);
|
|
777
779
|
return [compId];
|
|
778
780
|
}
|
|
779
|
-
return workspace.filterIdsFromPoolIdsByPattern(pattern, tagPendingComponentsIds, shouldThrowForNoMatching);
|
|
781
|
+
return self.workspace.filterIdsFromPoolIdsByPattern(pattern, tagPendingComponentsIds, shouldThrowForNoMatching);
|
|
780
782
|
};
|
|
781
783
|
const componentIds = await getCompIds();
|
|
782
784
|
if (!componentIds.length && pattern) {
|
|
783
|
-
const allTagPending = await workspace.listPotentialTagIds();
|
|
785
|
+
const allTagPending = await self.workspace.listPotentialTagIds();
|
|
784
786
|
if (allTagPending.length) {
|
|
785
787
|
throw new (_bitError().BitError)(`unable to find matching for "${pattern}" pattern among modified/new components.
|
|
786
788
|
there are matching among unmodified components though. consider using --unmodified flag if needed.
|
|
@@ -1269,6 +1271,15 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1269
1271
|
const extension = new (_config().ExtensionDataEntry)(undefined, undefined, extId, undefined, data);
|
|
1270
1272
|
component.config.extensions.push(extension);
|
|
1271
1273
|
}
|
|
1274
|
+
async getTagPendingComponentsIds(includeUnmodified = false) {
|
|
1275
|
+
const ids = includeUnmodified ? await this.workspace.listPotentialTagIds() : await this.workspace.listTagPendingIds();
|
|
1276
|
+
const localOnlyIds = this.workspace.filter.byLocalOnly(ids);
|
|
1277
|
+
if (!localOnlyIds.length) {
|
|
1278
|
+
return ids;
|
|
1279
|
+
}
|
|
1280
|
+
const localOnlyListIds = _componentId().ComponentIdList.fromArray(localOnlyIds);
|
|
1281
|
+
return ids.filter(id => !localOnlyListIds.hasWithoutVersion(id));
|
|
1282
|
+
}
|
|
1272
1283
|
async getComponentsToTag(includeUnmodified, exactVersion, persist, ids, snapped, unmerged) {
|
|
1273
1284
|
const warnings = [];
|
|
1274
1285
|
const componentsList = new (_legacy().ComponentsList)(this.workspace.consumer);
|
|
@@ -1279,8 +1290,18 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1279
1290
|
warnings: []
|
|
1280
1291
|
};
|
|
1281
1292
|
}
|
|
1282
|
-
const tagPendingComponentsIds =
|
|
1293
|
+
const tagPendingComponentsIds = await this.getTagPendingComponentsIds(includeUnmodified);
|
|
1283
1294
|
const snappedComponentsIds = (await this.workspace.filter.bySnappedOnMain()).map(id => id.changeVersion(undefined));
|
|
1295
|
+
if (snappedComponentsIds.length) {
|
|
1296
|
+
const localOnlyIds = this.workspace.filter.byLocalOnly(snappedComponentsIds);
|
|
1297
|
+
const localOnlyListIds = _componentId().ComponentIdList.fromArray(localOnlyIds);
|
|
1298
|
+
snappedComponentsIds.forEach(id => {
|
|
1299
|
+
if (localOnlyListIds.hasWithoutVersion(id)) {
|
|
1300
|
+
const index = snappedComponentsIds.findIndex(c => c.isEqual(id));
|
|
1301
|
+
snappedComponentsIds.splice(index, 1);
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1284
1305
|
if (ids.length) {
|
|
1285
1306
|
const componentIds = await (0, _pMapSeries().default)(ids, async id => {
|
|
1286
1307
|
const [idWithoutVer, version] = id.split('@');
|
|
@@ -1313,10 +1334,9 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1313
1334
|
warnings
|
|
1314
1335
|
};
|
|
1315
1336
|
}
|
|
1316
|
-
const
|
|
1317
|
-
const tagPendingBitIdsIncludeSnapped = [...tagPendingBitIds, ...snappedComponentsIds];
|
|
1337
|
+
const tagPendingBitIdsIncludeSnapped = [...tagPendingComponentsIds, ...snappedComponentsIds];
|
|
1318
1338
|
if (includeUnmodified && exactVersion) {
|
|
1319
|
-
const tagPendingComponentsLatest = await this.workspace.scope.legacyScope.latestVersions(
|
|
1339
|
+
const tagPendingComponentsLatest = await this.workspace.scope.legacyScope.latestVersions(tagPendingComponentsIds, false);
|
|
1320
1340
|
tagPendingComponentsLatest.forEach(componentId => {
|
|
1321
1341
|
if (componentId.version && _semver().default.valid(componentId.version) && _semver().default.gt(componentId.version, exactVersion)) {
|
|
1322
1342
|
warnings.push(`warning: ${componentId.toString()} has a version greater than ${exactVersion}`);
|