Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor, move feature-toggle from legacy to a new component #8984

Merged
merged 4 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .bitmap
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,13 @@
"mainFile": "index.ts",
"rootDir": "scopes/lanes/diff"
},
"modules/feature-toggle": {
"name": "modules/feature-toggle",
"scope": "teambit.harmony",
"version": "0.0.1",
"mainFile": "feature-toggle.ts",
"rootDir": "scopes/harmony/modules/feature-toggle"
},
"modules/fetch-html-from-url": {
"name": "modules/fetch-html-from-url",
"scope": "teambit.html",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"@pnpm/node-fetch": "^1.0.0",
"@teambit/defender.fs.global-bit-temp-dir": "0.0.1",
"@teambit/legacy.analytics": "~0.0.1",
"@teambit/harmony.modules.feature-toggle": "~0.0.1",
"@teambit/bit-error": "~0.0.404",
"@teambit/bit-roots": "~0.0.133",
"@teambit/lane-id": "~0.0.311",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* per command. see the docs of CommandHelper class for more info.
*/

import { CFG_FEATURE_TOGGLE } from '../../../constants';
import { getSync } from './global-config';
import { CFG_FEATURE_TOGGLE } from '@teambit/legacy/dist/constants';
import { getSync } from '@teambit/legacy/dist/api/consumer/lib/global-config';

export const ENV_VAR_FEATURE_TOGGLE = 'BIT_FEATURES';

Expand Down
2 changes: 1 addition & 1 deletion scopes/lanes/lanes/lanes.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { ChangeType } from '@teambit/lanes.entities.lane-diff';
import ComponentsList, { DivergeDataPerId } from '@teambit/legacy/dist/consumer/component/components-list';
import { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap';
import { concurrentComponentsLimit } from '@teambit/legacy/dist/utils/concurrency';
import { SUPPORT_LANE_HISTORY, isFeatureEnabled } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';
import { SUPPORT_LANE_HISTORY, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle';
import { LanesAspect } from './lanes.aspect';
import {
LaneCmd,
Expand Down
2 changes: 1 addition & 1 deletion scopes/lanes/lanes/lanes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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/legacy/dist/api/consumer/lib/feature-toggle';
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';
Expand Down
2 changes: 1 addition & 1 deletion scopes/preview/preview/preview.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { ArtifactFiles } from '@teambit/legacy/dist/consumer/component/sources/a
import { WatcherAspect, WatcherMain } from '@teambit/watcher';
import { GraphqlAspect, GraphqlMain } from '@teambit/graphql';
import { ScopeAspect, ScopeMain } from '@teambit/scope';
import { ONLY_OVERVIEW, isFeatureEnabled } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';
import { ONLY_OVERVIEW, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle';
import { BundlingStrategyNotFound } from './exceptions';
import { generateLink, MainModulesMap } from './generate-link';
import { PreviewArtifact } from './preview-artifact';
Expand Down
2 changes: 1 addition & 1 deletion scopes/scope/export/export.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ 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/legacy/dist/api/consumer/lib/feature-toggle';
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';
Expand Down
2 changes: 1 addition & 1 deletion src/consumer/component/component-fs-cache.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cacache, { GetCacheObject } from 'cacache';
import path from 'path';
import fs from 'fs-extra';
import { isFeatureEnabled, NO_FS_CACHE_FEATURE } from '../../api/consumer/lib/feature-toggle';
import { isFeatureEnabled, NO_FS_CACHE_FEATURE } from '@teambit/harmony.modules.feature-toggle';
import { PathOsBasedAbsolute } from '../../utils/path';
import type { ComponentMapFile } from '../bit-map/component-map';
import logger from '../../logger/logger';
Expand Down
2 changes: 1 addition & 1 deletion src/e2e-helper/e2e-command-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';
import tar from 'tar';
import { LANE_REMOTE_DELIMITER } from '@teambit/lane-id';
import { NOTHING_TO_TAG_MSG } from '@teambit/snapping';
import { ENV_VAR_FEATURE_TOGGLE } from '../api/consumer/lib/feature-toggle';
import { ENV_VAR_FEATURE_TOGGLE } from '@teambit/harmony.modules.feature-toggle';
import { Extensions, NOTHING_TO_SNAP_MSG } from '../constants';
import { removeChalkCharacters } from '../utils';
import ScopesData from './e2e-scopes';
Expand Down
2 changes: 1 addition & 1 deletion src/scope/component-ops/scope-components-importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DEFAULT_LANE, LaneId } from '@teambit/lane-id';
import { BitError } from '@teambit/bit-error';
import groupArray from 'group-array';
import R from 'ramda';
import { CLOUD_IMPORTER, CLOUD_IMPORTER_V2, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle';
import { compact, flatten, partition, uniq } from 'lodash';
import { Scope } from '..';
import ConsumerComponent from '../../consumer/component';
Expand All @@ -29,7 +30,6 @@ import { HashesPerRemotes, MissingObjects } from '../exceptions/missing-objects'
import { getAllVersionHashes } from './traverse-versions';
import { FETCH_OPTIONS } from '../../api/scope/lib/fetch';
import { pMapPool } from '../../utils/promise-with-concurrent';
import { CLOUD_IMPORTER, CLOUD_IMPORTER_V2, isFeatureEnabled } from '../../api/consumer/lib/feature-toggle';

type HashesPerRemote = { [remoteName: string]: string[] };

Expand Down
2 changes: 1 addition & 1 deletion src/scope/network/http/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ComponentID, ComponentIdList } from '@teambit/component-id';
import { HttpsProxyAgent } from 'https-proxy-agent';
import { SocksProxyAgent } from 'socks-proxy-agent';
import { HttpProxyAgent } from 'http-proxy-agent';
import { CLOUD_IMPORTER, CLOUD_IMPORTER_V2, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle';
import { LaneId } from '@teambit/lane-id';
import { getAgent, AgentOptions } from '@teambit/toolbox.network.agent';
import { Network } from '../network';
Expand Down Expand Up @@ -55,7 +56,6 @@ import RemovedObjects from '../../removed-components';
import { GraphQLClientError } from '../exceptions/graphql-client-error';
import loader from '../../../cli/loader';
import { UnexpectedNetworkError } from '../exceptions';
import { CLOUD_IMPORTER, CLOUD_IMPORTER_V2, isFeatureEnabled } from '../../../api/consumer/lib/feature-toggle';

const _fetch: typeof fetch = nodeFetch as unknown as typeof fetch;

Expand Down