@teambit/lanes 1.0.310 → 1.0.311
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 +16 -15
- package/artifacts/preview/teambit_lanes_lanes-preview.js +1 -1
- package/artifacts/schema.json +349 -300
- package/dist/lanes.create.route.d.ts +0 -1
- package/dist/lanes.delete.route.d.ts +0 -1
- package/dist/lanes.restore.route.d.ts +0 -1
- package/dist/lanes.spec.js +64 -0
- package/dist/lanes.spec.js.map +1 -1
- package/dist/lanes.ui.runtime.d.ts +4 -2
- package/dist/lanes.ui.runtime.js +12 -2
- package/dist/lanes.ui.runtime.js.map +1 -1
- package/dist/{preview-1718853656395.js → preview-1719137078208.js} +2 -2
- package/dist/switch-lanes.js +6 -5
- package/dist/switch-lanes.js.map +1 -1
- package/lanes.ui.runtime.tsx +15 -3
- package/package.json +21 -19
package/dist/switch-lanes.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_laneId","data","require","_componentId","_bitError","_createLane","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","LaneSwitcher","constructor","workspace","logger","switchProps","checkoutProps","lanes","consumer","switch","setStatusLine","isOnMain","throwForStagedComponents","populateSwitchProps","bitMapIds","bitmapIdsFromCurrentLaneIncludeRemoved","idsToSwitch","ids","map","id","bitMapId","searchWithoutVersion","allowAddingComponentsFromScope","versionPerId","resolveMultipleComponentIds","lane","laneToSwitchTo","results","checkout","saveLanesData","onDestroy","laneId","scope","parseLaneIdFromString","laneName","localLane","loadLane","getMainIds","mainIds","getIdsOfDefaultLane","head","legacyScope","scopeImporter","importWithoutDeps","cache","isDefault","populatePropsAccordingToDefaultLane","laneIds","populatePropsAccordingToLocalLane","populatePropsAccordingToRemoteLane","idsOnLaneOnly","find","isEqualWithoutVersion","idsOnMainOnly","laneBitIds","populateIdsAccordingToPattern","pattern","bitMap","getAllBitIdsFromAllLanes","BitError","allIds","patternIds","filterIdsFromPoolIdsByPattern","remoteLaneId","laneIdToSwitchTo","debug","toString","throwForSwitchingToCurrentLane","remoteLane","fetchLaneWithItsComponents","name","localTrackedLane","getAliasByLaneId","undefined","components","l","changeVersion","LaneId","from","DEFAULT_LANE","toLaneId","c","getCurrentLaneId","isEqual","laneIdStr","localLaneName","alias","trackLane","remoteScope","setCurrentLane","isNew","syncWithIds","ComponentIdList","fromArray","exports"],"sources":["switch-lanes.ts"],"sourcesContent":["import { Consumer } from '@teambit/legacy/dist/consumer';\nimport { LaneId, DEFAULT_LANE } from '@teambit/lane-id';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { CheckoutProps } from '@teambit/checkout';\nimport { Workspace } from '@teambit/workspace';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { LanesMain } from './lanes.main.runtime';\nimport { throwForStagedComponents } from './create-lane';\n\nexport type SwitchProps = {\n laneName: string;\n ids?: ComponentID[];\n laneBitIds?: ComponentID[]; // only needed for the deprecated onLanesOnly prop. once this prop is removed, this prop can be removed as well.\n pattern?: string;\n head?: boolean;\n existingOnWorkspaceOnly?: boolean;\n remoteLane?: Lane;\n localTrackedLane?: string;\n alias?: string;\n};\n\nexport class LaneSwitcher {\n private consumer: Consumer;\n private laneIdToSwitchTo: LaneId; // populated by `this.populateSwitchProps()`\n private laneToSwitchTo: Lane | undefined; // populated by `this.populateSwitchProps()`, if default-lane, it's undefined\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private switchProps: SwitchProps,\n private checkoutProps: CheckoutProps,\n private lanes: LanesMain\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n async switch(): Promise<ApplyVersionResults> {\n this.logger.setStatusLine(`switching lanes`);\n if (this.workspace.isOnMain()) {\n await throwForStagedComponents(this.consumer);\n }\n await this.populateSwitchProps();\n const bitMapIds = this.workspace.consumer.bitmapIdsFromCurrentLaneIncludeRemoved;\n const idsToSwitch = this.switchProps.ids || [];\n const ids = idsToSwitch.map((id) => {\n const bitMapId = bitMapIds.searchWithoutVersion(id);\n return bitMapId || id;\n });\n\n const checkoutProps: CheckoutProps = {\n ...this.checkoutProps,\n ids,\n allowAddingComponentsFromScope: true,\n versionPerId: await this.workspace.resolveMultipleComponentIds(idsToSwitch),\n lane: this.laneToSwitchTo,\n };\n\n const results = await this.lanes.checkout.checkout(checkoutProps);\n\n await this.saveLanesData();\n await this.consumer.onDestroy('lane-switch');\n\n return results;\n }\n\n private async populateSwitchProps() {\n const laneId = await this.consumer.scope.lanes.parseLaneIdFromString(this.switchProps.laneName);\n\n const localLane = await this.consumer.scope.loadLane(laneId);\n const getMainIds = async () => {\n const mainIds = await this.consumer.getIdsOfDefaultLane();\n if (this.switchProps.head) {\n await this.workspace.scope.legacyScope.scopeImporter.importWithoutDeps(mainIds, { cache: false });\n return this.consumer.getIdsOfDefaultLane();\n }\n return mainIds;\n };\n const mainIds = await getMainIds();\n if (laneId.isDefault()) {\n await this.populatePropsAccordingToDefaultLane();\n this.switchProps.ids = mainIds;\n } else {\n const laneIds =\n localLane && !this.switchProps.head\n ? this.populatePropsAccordingToLocalLane(localLane)\n : await this.populatePropsAccordingToRemoteLane(laneId);\n const idsOnLaneOnly = laneIds.filter((id) => !mainIds.find((i) => i.isEqualWithoutVersion(id)));\n const idsOnMainOnly = mainIds.filter((id) => !laneIds.find((i) => i.isEqualWithoutVersion(id)));\n this.switchProps.ids = [...idsOnMainOnly, ...laneIds];\n this.switchProps.laneBitIds = idsOnLaneOnly;\n }\n await this.populateIdsAccordingToPattern();\n }\n\n private async populateIdsAccordingToPattern() {\n if (!this.switchProps.pattern) {\n return;\n }\n if (this.consumer.bitMap.getAllBitIdsFromAllLanes().length) {\n // if the workspace is not empty, it's possible that it has components from lane-x, and is now switching\n // partially to lane-y, while lane-y has the same components as lane-x. in which case, the user ends up with\n // an invalid state of components from lane-x and lane-y together.\n throw new BitError('error: use --pattern only when the workspace is empty');\n }\n const allIds = this.switchProps.ids || [];\n const patternIds = await this.workspace.filterIdsFromPoolIdsByPattern(this.switchProps.pattern, allIds);\n this.switchProps.ids = patternIds.map((id) => id);\n }\n\n private async populatePropsAccordingToRemoteLane(remoteLaneId: LaneId): Promise<ComponentID[]> {\n this.laneIdToSwitchTo = remoteLaneId;\n this.logger.debug(`populatePropsAccordingToRemoteLane, remoteLaneId: ${remoteLaneId.toString()}`);\n this.throwForSwitchingToCurrentLane();\n const remoteLane = await this.lanes.fetchLaneWithItsComponents(remoteLaneId);\n this.switchProps.laneName = remoteLaneId.name;\n this.switchProps.localTrackedLane = this.consumer.scope.lanes.getAliasByLaneId(remoteLaneId) || undefined;\n this.switchProps.remoteLane = remoteLane;\n this.laneToSwitchTo = remoteLane;\n this.logger.debug(`populatePropsAccordingToRemoteLane, completed`);\n return remoteLane.components.map((l) => l.id.changeVersion(l.head.toString()));\n }\n\n private async populatePropsAccordingToDefaultLane() {\n this.laneIdToSwitchTo = LaneId.from(DEFAULT_LANE, this.consumer.scope.name);\n this.throwForSwitchingToCurrentLane();\n }\n\n private populatePropsAccordingToLocalLane(localLane: Lane): ComponentID[] {\n this.laneIdToSwitchTo = localLane.toLaneId();\n this.laneToSwitchTo = localLane;\n this.throwForSwitchingToCurrentLane();\n return localLane.components.map((c) => c.id.changeVersion(c.head.toString()));\n }\n\n private throwForSwitchingToCurrentLane() {\n if (this.consumer.getCurrentLaneId().isEqual(this.laneIdToSwitchTo)) {\n const laneIdStr = this.laneIdToSwitchTo.isDefault()\n ? this.laneIdToSwitchTo.name\n : this.laneIdToSwitchTo.toString();\n throw new BitError(`already checked out to \"${laneIdStr}\".\nto be up to date with the remote lane, please run \"bit checkout head\"`);\n }\n }\n\n private async saveLanesData() {\n const localLaneName = this.switchProps.alias || this.laneIdToSwitchTo.name;\n if (this.switchProps.remoteLane) {\n if (!this.switchProps.localTrackedLane) {\n this.consumer.scope.lanes.trackLane({\n localLane: localLaneName,\n remoteLane: this.laneIdToSwitchTo.name,\n remoteScope: this.laneIdToSwitchTo.scope,\n });\n }\n }\n\n this.consumer.setCurrentLane(this.laneIdToSwitchTo, !this.laneToSwitchTo?.isNew);\n this.consumer.bitMap.syncWithIds(\n ComponentIdList.fromArray(this.switchProps.ids || []),\n ComponentIdList.fromArray(this.switchProps.laneBitIds || [])\n );\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyD,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA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AI,CAACxB,QAAQ,CAACiF,cAAc,CAAC,IAAI,CAACzB,gBAAgB,EAAE,CAAC,IAAI,CAACtC,cAAc,EAAEgE,KAAK,CAAC;IAChF,IAAI,CAAClF,QAAQ,CAACiD,MAAM,CAACkC,WAAW,CAC9BC,8BAAe,CAACC,SAAS,CAAC,IAAI,CAACxF,WAAW,CAACY,GAAG,IAAI,EAAE,CAAC,EACrD2E,8BAAe,CAACC,SAAS,CAAC,IAAI,CAACxF,WAAW,CAACiD,UAAU,IAAI,EAAE,CAC7D,CAAC;EACH;AACF;AAACwC,OAAA,CAAA7F,YAAA,GAAAA,YAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_laneId","data","require","_componentId","_bitError","_createLane","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","LaneSwitcher","constructor","workspace","logger","switchProps","checkoutProps","lanes","consumer","switch","setStatusLine","isOnMain","throwForStagedComponents","populateSwitchProps","bitMapIds","bitmapIdsFromCurrentLaneIncludeRemoved","idsToSwitch","ids","map","id","bitMapId","searchWithoutVersion","allowAddingComponentsFromScope","versionPerId","resolveMultipleComponentIds","lane","laneToSwitchTo","results","checkout","saveLanesData","onDestroy","laneId","scope","parseLaneIdFromString","laneName","localLane","loadLane","getMainIds","head","allIds","listIds","legacyScope","scopeImporter","importWithoutDeps","cache","ignoreMissingHead","getIdsOfDefaultLane","mainIds","isDefault","populatePropsAccordingToDefaultLane","laneIds","populatePropsAccordingToLocalLane","populatePropsAccordingToRemoteLane","idsOnLaneOnly","find","isEqualWithoutVersion","idsOnMainOnly","laneBitIds","populateIdsAccordingToPattern","pattern","bitMap","getAllBitIdsFromAllLanes","BitError","filterIdsFromPoolIdsByPattern","remoteLaneId","laneIdToSwitchTo","debug","toString","throwForSwitchingToCurrentLane","remoteLane","fetchLaneWithItsComponents","name","localTrackedLane","getAliasByLaneId","undefined","components","l","changeVersion","LaneId","from","DEFAULT_LANE","toLaneId","c","getCurrentLaneId","isEqual","laneIdStr","localLaneName","alias","trackLane","remoteScope","setCurrentLane","isNew","syncWithIds","ComponentIdList","fromArray","exports"],"sources":["switch-lanes.ts"],"sourcesContent":["import { Consumer } from '@teambit/legacy/dist/consumer';\nimport { LaneId, DEFAULT_LANE } from '@teambit/lane-id';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { ApplyVersionResults } from '@teambit/merging';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { CheckoutProps } from '@teambit/checkout';\nimport { Workspace } from '@teambit/workspace';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { LanesMain } from './lanes.main.runtime';\nimport { throwForStagedComponents } from './create-lane';\n\nexport type SwitchProps = {\n laneName: string;\n ids?: ComponentID[];\n laneBitIds?: ComponentID[]; // only needed for the deprecated onLanesOnly prop. once this prop is removed, this prop can be removed as well.\n pattern?: string;\n head?: boolean;\n existingOnWorkspaceOnly?: boolean;\n remoteLane?: Lane;\n localTrackedLane?: string;\n alias?: string;\n};\n\nexport class LaneSwitcher {\n private consumer: Consumer;\n private laneIdToSwitchTo: LaneId; // populated by `this.populateSwitchProps()`\n private laneToSwitchTo: Lane | undefined; // populated by `this.populateSwitchProps()`, if default-lane, it's undefined\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private switchProps: SwitchProps,\n private checkoutProps: CheckoutProps,\n private lanes: LanesMain\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n async switch(): Promise<ApplyVersionResults> {\n this.logger.setStatusLine(`switching lanes`);\n if (this.workspace.isOnMain()) {\n await throwForStagedComponents(this.consumer);\n }\n await this.populateSwitchProps();\n const bitMapIds = this.workspace.consumer.bitmapIdsFromCurrentLaneIncludeRemoved;\n const idsToSwitch = this.switchProps.ids || [];\n const ids = idsToSwitch.map((id) => {\n const bitMapId = bitMapIds.searchWithoutVersion(id);\n return bitMapId || id;\n });\n\n const checkoutProps: CheckoutProps = {\n ...this.checkoutProps,\n ids,\n allowAddingComponentsFromScope: true,\n versionPerId: await this.workspace.resolveMultipleComponentIds(idsToSwitch),\n lane: this.laneToSwitchTo,\n };\n\n const results = await this.lanes.checkout.checkout(checkoutProps);\n\n await this.saveLanesData();\n await this.consumer.onDestroy('lane-switch');\n\n return results;\n }\n\n private async populateSwitchProps() {\n const laneId = await this.consumer.scope.lanes.parseLaneIdFromString(this.switchProps.laneName);\n\n const localLane = await this.consumer.scope.loadLane(laneId);\n const getMainIds = async () => {\n if (this.switchProps.head) {\n const allIds = this.workspace.listIds();\n await this.workspace.scope.legacyScope.scopeImporter.importWithoutDeps(allIds, {\n cache: false,\n ignoreMissingHead: true,\n });\n return this.consumer.getIdsOfDefaultLane();\n }\n const mainIds = await this.consumer.getIdsOfDefaultLane();\n return mainIds;\n };\n const mainIds = await getMainIds();\n if (laneId.isDefault()) {\n await this.populatePropsAccordingToDefaultLane();\n this.switchProps.ids = mainIds;\n } else {\n const laneIds =\n localLane && !this.switchProps.head\n ? this.populatePropsAccordingToLocalLane(localLane)\n : await this.populatePropsAccordingToRemoteLane(laneId);\n const idsOnLaneOnly = laneIds.filter((id) => !mainIds.find((i) => i.isEqualWithoutVersion(id)));\n const idsOnMainOnly = mainIds.filter((id) => !laneIds.find((i) => i.isEqualWithoutVersion(id)));\n this.switchProps.ids = [...idsOnMainOnly, ...laneIds];\n this.switchProps.laneBitIds = idsOnLaneOnly;\n }\n await this.populateIdsAccordingToPattern();\n }\n\n private async populateIdsAccordingToPattern() {\n if (!this.switchProps.pattern) {\n return;\n }\n if (this.consumer.bitMap.getAllBitIdsFromAllLanes().length) {\n // if the workspace is not empty, it's possible that it has components from lane-x, and is now switching\n // partially to lane-y, while lane-y has the same components as lane-x. in which case, the user ends up with\n // an invalid state of components from lane-x and lane-y together.\n throw new BitError('error: use --pattern only when the workspace is empty');\n }\n const allIds = this.switchProps.ids || [];\n this.switchProps.ids = await this.workspace.filterIdsFromPoolIdsByPattern(this.switchProps.pattern, allIds);\n }\n\n private async populatePropsAccordingToRemoteLane(remoteLaneId: LaneId): Promise<ComponentID[]> {\n this.laneIdToSwitchTo = remoteLaneId;\n this.logger.debug(`populatePropsAccordingToRemoteLane, remoteLaneId: ${remoteLaneId.toString()}`);\n this.throwForSwitchingToCurrentLane();\n const remoteLane = await this.lanes.fetchLaneWithItsComponents(remoteLaneId);\n this.switchProps.laneName = remoteLaneId.name;\n this.switchProps.localTrackedLane = this.consumer.scope.lanes.getAliasByLaneId(remoteLaneId) || undefined;\n this.switchProps.remoteLane = remoteLane;\n this.laneToSwitchTo = remoteLane;\n this.logger.debug(`populatePropsAccordingToRemoteLane, completed`);\n return remoteLane.components.map((l) => l.id.changeVersion(l.head.toString()));\n }\n\n private async populatePropsAccordingToDefaultLane() {\n this.laneIdToSwitchTo = LaneId.from(DEFAULT_LANE, this.consumer.scope.name);\n this.throwForSwitchingToCurrentLane();\n }\n\n private populatePropsAccordingToLocalLane(localLane: Lane): ComponentID[] {\n this.laneIdToSwitchTo = localLane.toLaneId();\n this.laneToSwitchTo = localLane;\n this.throwForSwitchingToCurrentLane();\n return localLane.components.map((c) => c.id.changeVersion(c.head.toString()));\n }\n\n private throwForSwitchingToCurrentLane() {\n if (this.consumer.getCurrentLaneId().isEqual(this.laneIdToSwitchTo)) {\n const laneIdStr = this.laneIdToSwitchTo.isDefault()\n ? this.laneIdToSwitchTo.name\n : this.laneIdToSwitchTo.toString();\n throw new BitError(`already checked out to \"${laneIdStr}\".\nto be up to date with the remote lane, please run \"bit checkout head\"`);\n }\n }\n\n private async saveLanesData() {\n const localLaneName = this.switchProps.alias || this.laneIdToSwitchTo.name;\n if (this.switchProps.remoteLane) {\n if (!this.switchProps.localTrackedLane) {\n this.consumer.scope.lanes.trackLane({\n localLane: localLaneName,\n remoteLane: this.laneIdToSwitchTo.name,\n remoteScope: this.laneIdToSwitchTo.scope,\n });\n }\n }\n\n this.consumer.setCurrentLane(this.laneIdToSwitchTo, !this.laneToSwitchTo?.isNew);\n this.consumer.bitMap.syncWithIds(\n ComponentIdList.fromArray(this.switchProps.ids || []),\n ComponentIdList.fromArray(this.switchProps.laneBitIds || [])\n );\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyD,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAA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9BC,8BAAe,CAACC,SAAS,CAAC,IAAI,CAACzF,WAAW,CAACY,GAAG,IAAI,EAAE,CAAC,EACrD4E,8BAAe,CAACC,SAAS,CAAC,IAAI,CAACzF,WAAW,CAACoD,UAAU,IAAI,EAAE,CAC7D,CAAC;EACH;AACF;AAACsC,OAAA,CAAA9F,YAAA,GAAAA,YAAA","ignoreList":[]}
|
package/lanes.ui.runtime.tsx
CHANGED
@@ -25,6 +25,7 @@ import { useViewedLaneFromUrl } from '@teambit/lanes.hooks.use-viewed-lane-from-
|
|
25
25
|
import { ComponentCompareAspect, ComponentCompareUI } from '@teambit/component-compare';
|
26
26
|
import { LaneComparePage } from '@teambit/lanes.ui.compare.lane-compare-page';
|
27
27
|
import { ScopeIcon } from '@teambit/scope.ui.scope-icon';
|
28
|
+
import { CommandBarUI, CommandBarAspect } from '@teambit/command-bar';
|
28
29
|
|
29
30
|
import { LanesAspect } from './lanes.aspect';
|
30
31
|
import styles from './lanes.ui.module.scss';
|
@@ -84,7 +85,14 @@ export function useComponentId() {
|
|
84
85
|
}
|
85
86
|
|
86
87
|
export class LanesUI {
|
87
|
-
static dependencies = [
|
88
|
+
static dependencies = [
|
89
|
+
UIAspect,
|
90
|
+
ComponentAspect,
|
91
|
+
WorkspaceAspect,
|
92
|
+
ScopeAspect,
|
93
|
+
ComponentCompareAspect,
|
94
|
+
CommandBarAspect,
|
95
|
+
];
|
88
96
|
|
89
97
|
static runtime = UIRuntime;
|
90
98
|
static slots = [
|
@@ -346,12 +354,13 @@ export class LanesUI {
|
|
346
354
|
};
|
347
355
|
|
348
356
|
static async provider(
|
349
|
-
[uiUi, componentUI, workspaceUi, scopeUi, componentCompareUI]: [
|
357
|
+
[uiUi, componentUI, workspaceUi, scopeUi, componentCompareUI, commandBarUI]: [
|
350
358
|
UiUI,
|
351
359
|
ComponentUI,
|
352
360
|
WorkspaceUI,
|
353
361
|
ScopeUI,
|
354
|
-
ComponentCompareUI
|
362
|
+
ComponentCompareUI,
|
363
|
+
CommandBarUI
|
355
364
|
],
|
356
365
|
_,
|
357
366
|
[routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot]: [
|
@@ -401,6 +410,9 @@ export class LanesUI {
|
|
401
410
|
);
|
402
411
|
});
|
403
412
|
lanesUi.registerLanesDropdown();
|
413
|
+
if (workspace) {
|
414
|
+
lanesUi.registerMenuWidget(commandBarUI.CommandBarButton);
|
415
|
+
}
|
404
416
|
return lanesUi;
|
405
417
|
}
|
406
418
|
}
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/lanes",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.311",
|
4
4
|
"homepage": "https://bit.cloud/teambit/lanes/lanes",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.lanes",
|
8
8
|
"name": "lanes",
|
9
|
-
"version": "1.0.
|
9
|
+
"version": "1.0.311"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"lodash": "4.17.21",
|
@@ -30,30 +30,31 @@
|
|
30
30
|
"@teambit/lanes.ui.compare.lane-compare-page": "0.0.162",
|
31
31
|
"@teambit/lanes.ui.compare.lane-compare": "0.0.193",
|
32
32
|
"@teambit/lanes.ui.navigation.lane-switcher": "0.0.225",
|
33
|
-
"@teambit/scope": "1.0.
|
34
|
-
"@teambit/workspace": "1.0.
|
33
|
+
"@teambit/scope": "1.0.311",
|
34
|
+
"@teambit/workspace": "1.0.311",
|
35
35
|
"@teambit/lanes.ui.models.lanes-model": "0.0.216",
|
36
|
-
"@teambit/checkout": "1.0.
|
37
|
-
"@teambit/cli": "0.0.
|
38
|
-
"@teambit/importer": "1.0.
|
39
|
-
"@teambit/express": "0.0.
|
40
|
-
"@teambit/logger": "0.0.
|
41
|
-
"@teambit/graphql": "1.0.
|
42
|
-
"@teambit/component-compare": "1.0.
|
43
|
-
"@teambit/component-writer": "1.0.
|
44
|
-
"@teambit/component": "1.0.
|
45
|
-
"@teambit/export": "1.0.
|
46
|
-
"@teambit/install": "1.0.
|
36
|
+
"@teambit/checkout": "1.0.311",
|
37
|
+
"@teambit/cli": "0.0.888",
|
38
|
+
"@teambit/importer": "1.0.311",
|
39
|
+
"@teambit/express": "0.0.987",
|
40
|
+
"@teambit/logger": "0.0.981",
|
41
|
+
"@teambit/graphql": "1.0.311",
|
42
|
+
"@teambit/component-compare": "1.0.311",
|
43
|
+
"@teambit/component-writer": "1.0.311",
|
44
|
+
"@teambit/component": "1.0.311",
|
45
|
+
"@teambit/export": "1.0.311",
|
46
|
+
"@teambit/install": "1.0.311",
|
47
47
|
"@teambit/lanes.entities.lane-diff": "0.0.166",
|
48
48
|
"@teambit/lanes.modules.diff": "0.0.443",
|
49
|
-
"@teambit/merging": "1.0.
|
50
|
-
"@teambit/remove": "1.0.
|
49
|
+
"@teambit/merging": "1.0.311",
|
50
|
+
"@teambit/remove": "1.0.311",
|
51
|
+
"@teambit/command-bar": "1.0.311",
|
51
52
|
"@teambit/lanes.hooks.use-lanes": "0.0.264",
|
52
53
|
"@teambit/lanes.hooks.use-viewed-lane-from-url": "0.0.223",
|
53
54
|
"@teambit/lanes.ui.lane-overview": "0.0.232",
|
54
55
|
"@teambit/lanes.ui.menus.use-lanes-menu": "0.0.216",
|
55
56
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.509",
|
56
|
-
"@teambit/ui": "1.0.
|
57
|
+
"@teambit/ui": "1.0.311"
|
57
58
|
},
|
58
59
|
"devDependencies": {
|
59
60
|
"@types/lodash": "4.14.165",
|
@@ -65,7 +66,8 @@
|
|
65
66
|
"@teambit/harmony.envs.core-aspect-env": "0.0.39",
|
66
67
|
"@teambit/component.testing.mock-components": "0.0.205",
|
67
68
|
"@teambit/harmony.testing.load-aspect": "0.0.200",
|
68
|
-
"@teambit/
|
69
|
+
"@teambit/merge-lanes": "1.0.311",
|
70
|
+
"@teambit/snapping": "1.0.311",
|
69
71
|
"@teambit/workspace.testing.mock-workspace": "0.0.27"
|
70
72
|
},
|
71
73
|
"peerDependencies": {
|