@teambit/snapping 1.0.523 → 1.0.525

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/esm.mjs CHANGED
@@ -4,6 +4,5 @@ import cjsModule from './index.js';
4
4
  export const SnappingAspect = cjsModule.SnappingAspect;
5
5
  export const inputDataDescription = cjsModule.inputDataDescription;
6
6
  export const snapFromScopeOptions = cjsModule.snapFromScopeOptions;
7
- export const tagModelComponent = cjsModule.tagModelComponent;
8
7
 
9
8
  export default cjsModule;
@@ -22,7 +22,7 @@ import { SnapDataPerCompRaw, FileData } from './snap-from-scope.cmd';
22
22
  import { ResetResult } from './reset-component';
23
23
  import { ApplicationMain } from '@teambit/application';
24
24
  import { RemoveMain } from '@teambit/remove';
25
- import { BasicTagParams, BasicTagSnapParams } from './version-maker';
25
+ import { BasicTagParams, BasicTagSnapParams, VersionMakerParams } from './version-maker';
26
26
  export type PackageIntegritiesByPublishedPackages = Map<string, string | undefined>;
27
27
  export type TagDataPerComp = {
28
28
  componentId: ComponentID;
@@ -103,6 +103,13 @@ export declare class SnappingMain {
103
103
  incrementBy?: number;
104
104
  failFast?: boolean;
105
105
  } & Partial<BasicTagParams>): Promise<TagResults | null>;
106
+ makeVersion(ids: ComponentID[], components: Component[], params: VersionMakerParams): Promise<{
107
+ taggedComponents: ConsumerComponent[];
108
+ autoTaggedResults: AutoTagResult[];
109
+ publishedPackages: string[];
110
+ stagedConfig?: import("@teambit/scope").StagedConfig;
111
+ removedComponents?: ComponentIdList;
112
+ }>;
106
113
  tagFromScope(tagDataPerCompRaw: TagDataPerCompRaw[], params: {
107
114
  push?: boolean;
108
115
  version?: string;
@@ -420,7 +420,6 @@ class SnappingMain {
420
420
  const compIds = _componentId().ComponentIdList.fromArray(bitIds);
421
421
  this.logger.debug(`tagging the following components: ${compIds.toString()}`);
422
422
  const components = await this.loadComponentsForTagOrSnap(compIds, !soft);
423
- const consumerComponents = components.map(c => c.state._consumer);
424
423
  await this.throwForVariousIssues(components, ignoreIssues);
425
424
  const params = {
426
425
  message,
@@ -444,14 +443,13 @@ class SnappingMain {
444
443
  detachHead,
445
444
  overrideHead
446
445
  };
447
- const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, compIds, params);
448
446
  const {
449
447
  taggedComponents,
450
448
  autoTaggedResults,
451
449
  publishedPackages,
452
450
  stagedConfig,
453
451
  removedComponents
454
- } = await versionMaker.makeVersion();
452
+ } = await this.makeVersion(compIds, components, params);
455
453
  const tagResults = {
456
454
  taggedComponents,
457
455
  autoTaggedResults,
@@ -466,6 +464,12 @@ class SnappingMain {
466
464
  // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
467
465
  return tagResults;
468
466
  }
467
+ async makeVersion(ids, components, params) {
468
+ const consumerComponents = components.map(c => c.state._consumer);
469
+ const componentIds = _componentId().ComponentIdList.fromArray(ids);
470
+ const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, componentIds, params);
471
+ return versionMaker.makeVersion();
472
+ }
469
473
  async tagFromScope(tagDataPerCompRaw, params) {
470
474
  if (this.workspace) {
471
475
  throw new (_bitError().BitError)(`unable to run this command from a workspace, please create a new bare-scope and run it from there`);
@@ -524,12 +528,11 @@ if you're willing to lose the history from the head to the specified version, us
524
528
  await this.updateDependenciesVersionsOfComponent(comp, tagData.dependencies, componentIds);
525
529
  }));
526
530
  await this.scope.loadManyCompsAspects(components);
527
- const consumerComponents = components.map(c => c.state._consumer);
528
531
  const shouldUsePopulateArtifactsFrom = components.every(comp => {
529
532
  if (!comp.buildStatus) throw new Error(`tag-from-scope expect ${comp.id.toString()} to have buildStatus`);
530
533
  return comp.buildStatus === _legacy2().BuildStatus.Succeed && !params.rebuildArtifacts;
531
534
  });
532
- const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, componentIds, _objectSpread(_objectSpread({}, params), {}, {
535
+ const makeVersionParams = _objectSpread(_objectSpread({}, params), {}, {
533
536
  tagDataPerComp,
534
537
  populateArtifactsFrom: shouldUsePopulateArtifactsFrom ? components.map(c => c.id) : undefined,
535
538
  populateArtifactsIgnorePkgJson: params.ignoreLastPkgJson,
@@ -538,8 +541,8 @@ if you're willing to lose the history from the head to the specified version, us
538
541
  persist: true,
539
542
  message: params.message,
540
543
  setHeadAsParent: params.overrideHead
541
- }));
542
- const results = await versionMaker.makeVersion();
544
+ });
545
+ const results = await this.makeVersion(componentIds, components, makeVersionParams);
543
546
  const {
544
547
  taggedComponents,
545
548
  publishedPackages
@@ -675,10 +678,9 @@ if you're willing to lose the history from the head to the specified version, us
675
678
 
676
679
  // this is similar to what happens in the workspace. the "onLoad" is running and populating the "data" of the aspects.
677
680
  await (0, _pMapSeries().default)(components, async comp => this.scope.executeOnCompAspectReCalcSlot(comp));
678
- const consumerComponents = components.map(c => c.state._consumer);
679
681
  const ids = _componentId().ComponentIdList.fromArray(allCompIds);
680
682
  const shouldTag = Boolean(params.tag);
681
- const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, ids, _objectSpread(_objectSpread({}, params), {}, {
683
+ const makeVersionParams = _objectSpread(_objectSpread({}, params), {}, {
682
684
  tagDataPerComp: snapDataPerComp.map(s => ({
683
685
  componentId: s.componentId,
684
686
  message: s.message,
@@ -690,8 +692,8 @@ if you're willing to lose the history from the head to the specified version, us
690
692
  isSnap: !shouldTag,
691
693
  message: params.message,
692
694
  updateDependentsOnLane: params.updateDependents
693
- }));
694
- const results = await versionMaker.makeVersion();
695
+ });
696
+ const results = await this.makeVersion(ids, components, makeVersionParams);
695
697
  const {
696
698
  taggedComponents
697
699
  } = results;
@@ -753,9 +755,8 @@ if you're willing to lose the history from the head to the specified version, us
753
755
  if (!ids) return null;
754
756
  this.logger.debug(`snapping the following components: ${ids.toString()}`);
755
757
  const components = await this.loadComponentsForTagOrSnap(ids);
756
- const consumerComponents = components.map(c => c.state._consumer);
757
758
  await this.throwForVariousIssues(components, ignoreIssues);
758
- const versionMaker = new (_versionMaker().VersionMaker)(this, components, consumerComponents, ids, {
759
+ const makeVersionParams = {
759
760
  editor,
760
761
  ignoreNewestVersion: false,
761
762
  message,
@@ -772,13 +773,13 @@ if you're willing to lose the history from the head to the specified version, us
772
773
  packageManagerConfigRootDir: this.workspace.path,
773
774
  exitOnFirstFailedTask,
774
775
  detachHead
775
- });
776
+ };
776
777
  const {
777
778
  taggedComponents,
778
779
  autoTaggedResults,
779
780
  stagedConfig,
780
781
  removedComponents
781
- } = await versionMaker.makeVersion();
782
+ } = await this.makeVersion(ids, components, makeVersionParams);
782
783
  const snapResults = {
783
784
  snappedComponents: taggedComponents,
784
785
  autoSnappedResults: autoTaggedResults,