From a4dc760f0a021c9cef084e7c18f290a7b4fba63a Mon Sep 17 00:00:00 2001 From: David First Date: Tue, 6 Aug 2024 16:04:28 -0400 Subject: [PATCH 1/2] remove lane-history from the feature flag, is now enabled by default --- scopes/harmony/modules/feature-toggle/feature-toggle.ts | 2 -- scopes/lanes/lanes/lanes.main.runtime.ts | 9 +++------ scopes/lanes/lanes/lanes.spec.ts | 5 ----- scopes/scope/export/export.main.runtime.ts | 9 +++------ 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/scopes/harmony/modules/feature-toggle/feature-toggle.ts b/scopes/harmony/modules/feature-toggle/feature-toggle.ts index 70abb212669f..73c0d3799aa5 100644 --- a/scopes/harmony/modules/feature-toggle/feature-toggle.ts +++ b/scopes/harmony/modules/feature-toggle/feature-toggle.ts @@ -66,5 +66,3 @@ export const CLOUD_IMPORTER = 'cloud-importer'; export const CLOUD_IMPORTER_V2 = 'cloud-importer-v2'; export const ALLOW_SAME_NAME = 'allow-same-name'; // not in use anymore - -export const SUPPORT_LANE_HISTORY = 'support-lane-history'; diff --git a/scopes/lanes/lanes/lanes.main.runtime.ts b/scopes/lanes/lanes/lanes.main.runtime.ts index c5083defa731..93c8788a7e81 100644 --- a/scopes/lanes/lanes/lanes.main.runtime.ts +++ b/scopes/lanes/lanes/lanes.main.runtime.ts @@ -34,7 +34,6 @@ import { ChangeType } from '@teambit/lanes.entities.lane-diff'; import { ComponentsList, DivergeDataPerId } from '@teambit/legacy.component-list'; import { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap'; import { concurrentComponentsLimit } from '@teambit/harmony.modules.concurrency'; -import { SUPPORT_LANE_HISTORY, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle'; import { removeLanes } from './remove-lanes'; import { LanesAspect } from './lanes.aspect'; import { @@ -1187,11 +1186,9 @@ please create a new lane instead, which will include all components of this lane new LaneFetchCmd(fetchCmd, lanesMain), new LaneEjectCmd(lanesMain), ]; - if (isFeatureEnabled(SUPPORT_LANE_HISTORY)) { - laneCmd.commands.push(new LaneHistoryCmd(lanesMain)); - laneCmd.commands.push(new LaneCheckoutCmd(lanesMain)); - laneCmd.commands.push(new LaneRevertCmd(lanesMain)); - } + laneCmd.commands.push(new LaneHistoryCmd(lanesMain)); + laneCmd.commands.push(new LaneCheckoutCmd(lanesMain)); + laneCmd.commands.push(new LaneRevertCmd(lanesMain)); cli.register(laneCmd, switchCmd, new CatLaneHistoryCmd(lanesMain)); cli.registerOnStart(async () => { await lanesMain.recreateNewLaneIfDeleted(); diff --git a/scopes/lanes/lanes/lanes.spec.ts b/scopes/lanes/lanes/lanes.spec.ts index 5fa672f763e1..2f68361a9665 100644 --- a/scopes/lanes/lanes/lanes.spec.ts +++ b/scopes/lanes/lanes/lanes.spec.ts @@ -8,7 +8,6 @@ import { SnappingAspect, SnappingMain } from '@teambit/snapping'; import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { ExportAspect, ExportMain } from '@teambit/export'; import { LaneId } from '@teambit/lane-id'; -import { SUPPORT_LANE_HISTORY, addFeature, removeFeature } from '@teambit/harmony.modules.feature-toggle'; import { mockWorkspace, destroyWorkspace, WorkspaceData } from '@teambit/workspace.testing.mock-workspace'; import { mockComponents, modifyMockedComponents } from '@teambit/component.testing.mock-components'; import { ChangeType } from '@teambit/lanes.entities.lane-diff'; @@ -216,7 +215,6 @@ describe('LanesAspect', function () { let snapping: SnappingMain; let laneId: LaneId; before(async () => { - addFeature(SUPPORT_LANE_HISTORY); workspaceData = mockWorkspace(); const { workspacePath } = workspaceData; await mockComponents(workspacePath); @@ -228,7 +226,6 @@ describe('LanesAspect', function () { laneId = currentLaneId; }); after(async () => { - removeFeature(SUPPORT_LANE_HISTORY); await destroyWorkspace(workspaceData); }); it('should create lane history object when creating a new lane', async () => { @@ -363,7 +360,6 @@ describe('LanesAspect', function () { let snapping: SnappingMain; let laneId: LaneId; before(async () => { - addFeature(SUPPORT_LANE_HISTORY); workspaceData = mockWorkspace(); const { workspacePath } = workspaceData; await mockComponents(workspacePath); @@ -389,7 +385,6 @@ describe('LanesAspect', function () { await snapping.snap({ build: false }); }); after(async () => { - removeFeature(SUPPORT_LANE_HISTORY); await destroyWorkspace(workspaceData); }); it('should save the deleted data into the lane object', async () => { diff --git a/scopes/scope/export/export.main.runtime.ts b/scopes/scope/export/export.main.runtime.ts index 53e7d86579cb..fbabd5026850 100644 --- a/scopes/scope/export/export.main.runtime.ts +++ b/scopes/scope/export/export.main.runtime.ts @@ -28,7 +28,6 @@ import mapSeries from 'p-map-series'; import { LaneId, DEFAULT_LANE } from '@teambit/lane-id'; import { Remote, Remotes } from '@teambit/legacy/dist/remotes'; import { EjectAspect, EjectMain, EjectResults } from '@teambit/eject'; -import { SUPPORT_LANE_HISTORY, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle'; import { getScopeRemotes } from '@teambit/legacy/dist/scope/scope-remotes'; import { ExportOrigin } from '@teambit/legacy/dist/scope/network/http/http'; import { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker'; @@ -434,11 +433,9 @@ if the export fails with missing objects/versions/components, run "bit fetch --l // don't use Promise.all, otherwise, it'll throw "JavaScript heap out of memory" on a large set of data await mapSeries(refsToExportPerComponent, processModelComponent); if (lane) { - if (isFeatureEnabled(SUPPORT_LANE_HISTORY)) { - const laneHistory = await this.workspace.scope.legacyScope.lanes.getOrCreateLaneHistory(lane); - const laneHistoryData = await bitObjectToObjectItem(laneHistory); - objectList.addIfNotExist([laneHistoryData]); - } + const laneHistory = await this.workspace.scope.legacyScope.lanes.getOrCreateLaneHistory(lane); + const laneHistoryData = await bitObjectToObjectItem(laneHistory); + objectList.addIfNotExist([laneHistoryData]); const laneData = await bitObjectToObjectItem(lane); objectList.addIfNotExist([laneData]); } From 13638beb706560c32c8f7cbedb3cc98b04c07ac0 Mon Sep 17 00:00:00 2001 From: David First Date: Mon, 2 Sep 2024 12:43:51 -0400 Subject: [PATCH 2/2] fix tests --- scopes/scope/export/export.main.runtime.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scopes/scope/export/export.main.runtime.ts b/scopes/scope/export/export.main.runtime.ts index fbabd5026850..96b7f2e9072d 100644 --- a/scopes/scope/export/export.main.runtime.ts +++ b/scopes/scope/export/export.main.runtime.ts @@ -433,7 +433,7 @@ if the export fails with missing objects/versions/components, run "bit fetch --l // don't use Promise.all, otherwise, it'll throw "JavaScript heap out of memory" on a large set of data await mapSeries(refsToExportPerComponent, processModelComponent); if (lane) { - const laneHistory = await this.workspace.scope.legacyScope.lanes.getOrCreateLaneHistory(lane); + const laneHistory = await scope.lanes.getOrCreateLaneHistory(lane); const laneHistoryData = await bitObjectToObjectItem(laneHistory); objectList.addIfNotExist([laneHistoryData]); const laneData = await bitObjectToObjectItem(lane);