@teambit/lanes 1.0.108 → 1.0.110

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/lanes",
3
- "version": "1.0.108",
3
+ "version": "1.0.110",
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.108"
9
+ "version": "1.0.110"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -36,33 +36,33 @@
36
36
  "@teambit/ui-foundation.ui.menu": "0.0.502",
37
37
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.506",
38
38
  "@teambit/ui-foundation.ui.react-router.use-query": "0.0.501",
39
- "@teambit/scope": "1.0.108",
40
- "@teambit/snapping": "1.0.108",
41
- "@teambit/workspace": "1.0.108",
42
- "@teambit/cli": "0.0.840",
43
- "@teambit/express": "0.0.939",
44
- "@teambit/logger": "0.0.933",
45
- "@teambit/graphql": "1.0.108",
46
- "@teambit/checkout": "1.0.108",
47
- "@teambit/component-compare": "1.0.108",
48
- "@teambit/component-writer": "1.0.108",
49
- "@teambit/component": "1.0.108",
50
- "@teambit/export": "1.0.108",
51
- "@teambit/importer": "1.0.108",
52
- "@teambit/lanes.modules.diff": "0.0.438",
53
- "@teambit/merging": "1.0.108",
54
- "@teambit/remove": "1.0.108",
39
+ "@teambit/scope": "1.0.110",
40
+ "@teambit/snapping": "1.0.110",
41
+ "@teambit/workspace": "1.0.110",
42
+ "@teambit/cli": "0.0.842",
43
+ "@teambit/express": "0.0.941",
44
+ "@teambit/logger": "0.0.935",
45
+ "@teambit/graphql": "1.0.110",
46
+ "@teambit/checkout": "1.0.110",
47
+ "@teambit/component-compare": "1.0.110",
48
+ "@teambit/component-writer": "1.0.110",
49
+ "@teambit/component": "1.0.110",
50
+ "@teambit/export": "1.0.110",
51
+ "@teambit/importer": "1.0.110",
52
+ "@teambit/lanes.modules.diff": "0.0.439",
53
+ "@teambit/merging": "1.0.110",
54
+ "@teambit/remove": "1.0.110",
55
55
  "@teambit/lanes.entities.lane-diff": "0.0.164",
56
- "@teambit/ui": "1.0.108"
56
+ "@teambit/ui": "1.0.110"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/lodash": "4.14.165",
60
60
  "@types/mocha": "9.1.0",
61
61
  "@types/jest": "^29.2.2",
62
62
  "@types/testing-library__jest-dom": "^5.9.5",
63
- "@teambit/harmony.envs.core-aspect-env": "0.0.13",
64
- "@teambit/component.testing.mock-components": "0.0.180",
65
- "@teambit/harmony.testing.load-aspect": "0.0.179",
63
+ "@teambit/harmony.envs.core-aspect-env": "0.0.15",
64
+ "@teambit/component.testing.mock-components": "0.0.181",
65
+ "@teambit/harmony.testing.load-aspect": "0.0.180",
66
66
  "@teambit/workspace.testing.mock-workspace": "0.0.18"
67
67
  },
68
68
  "peerDependencies": {
@@ -75,11 +75,15 @@
75
75
  "optionalDependencies": {},
76
76
  "peerDependenciesMeta": {},
77
77
  "exports": {
78
- "node": {
79
- "require": "./dist/index.js",
80
- "import": "./dist/esm.mjs"
78
+ ".": {
79
+ "node": {
80
+ "require": "./dist/index.js",
81
+ "import": "./dist/esm.mjs"
82
+ },
83
+ "default": "./dist/index.js"
81
84
  },
82
- "default": "./dist/index.js"
85
+ "./dist/*": "./dist/*",
86
+ "./artifacts/*": "./artifacts/*"
83
87
  },
84
88
  "private": false,
85
89
  "engines": {
package/create-lane.ts DELETED
@@ -1,118 +0,0 @@
1
- import { BitError } from '@teambit/bit-error';
2
- import { LaneId } from '@teambit/lane-id';
3
- import { Consumer } from '@teambit/legacy/dist/consumer';
4
- import { ScopeMain } from '@teambit/scope';
5
- // import { ComponentIdList } from '@teambit/component-id';
6
- import Lane, { LaneComponent } from '@teambit/legacy/dist/scope/models/lane';
7
- import { isSnap } from '@teambit/component-version';
8
- import { getBitCloudUser } from '@teambit/snapping';
9
- import ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';
10
- import { Ref } from '@teambit/legacy/dist/scope/objects';
11
- import { Workspace } from '@teambit/workspace';
12
- import { compact } from 'lodash';
13
-
14
- const MAX_LANE_NAME_LENGTH = 800;
15
-
16
- export async function createLane(
17
- workspace: Workspace,
18
- laneName: string,
19
- scopeName: string,
20
- remoteLane?: Lane
21
- ): Promise<Lane> {
22
- const consumer = workspace.consumer;
23
- const lanes = await consumer.scope.listLanes();
24
- if (lanes.find((lane) => lane.name === laneName)) {
25
- throw new BitError(`lane "${laneName}" already exists, to switch to this lane, please use "bit switch" command`);
26
- }
27
- const bitCloudUser = await getBitCloudUser();
28
- throwForInvalidLaneName(laneName);
29
- await throwForStagedComponents(consumer);
30
- const getDataToPopulateLaneObjectIfNeeded = async (): Promise<LaneComponent[]> => {
31
- if (remoteLane) return remoteLane.components;
32
- // when branching from one lane to another, copy components from the origin lane
33
- // when branching from main, no need to copy anything
34
- const currentLaneObject = await consumer.getCurrentLaneObject();
35
- if (!currentLaneObject) return [];
36
- const laneComponents = currentLaneObject.components;
37
- const workspaceIds = consumer.bitMap.getAllBitIds();
38
- const laneComponentWithBitmapHead = await Promise.all(
39
- laneComponents.map(async ({ id, head }) => {
40
- const compId = await workspace.resolveComponentId(id.changeVersion(head.toString()));
41
- const isRemoved = await workspace.scope.isComponentRemoved(compId);
42
- if (isRemoved) return null;
43
- const bitmapHead = workspaceIds.searchWithoutVersion(id);
44
- if (bitmapHead && isSnap(bitmapHead.version)) {
45
- return { id, head: Ref.from(bitmapHead.version as string) };
46
- }
47
- return { id, head };
48
- })
49
- );
50
- return compact(laneComponentWithBitmapHead);
51
- };
52
-
53
- const forkedFrom = await getLaneOrigin(consumer);
54
- const newLane = remoteLane
55
- ? Lane.from({
56
- name: laneName,
57
- hash: remoteLane.hash().toString(),
58
- log: remoteLane.log,
59
- scope: remoteLane.scope,
60
- forkedFrom,
61
- })
62
- : Lane.create(laneName, scopeName, forkedFrom, bitCloudUser);
63
- const dataToPopulate = await getDataToPopulateLaneObjectIfNeeded();
64
- newLane.setLaneComponents(dataToPopulate);
65
-
66
- await consumer.scope.lanes.saveLane(newLane);
67
-
68
- return newLane;
69
- }
70
-
71
- export async function createLaneInScope(laneName: string, scope: ScopeMain): Promise<Lane> {
72
- const lanes = await scope.legacyScope.listLanes();
73
- if (lanes.find((lane) => lane.name === laneName)) {
74
- throw new BitError(`lane "${laneName}" already exists`);
75
- }
76
- throwForInvalidLaneName(laneName);
77
- const newLane = Lane.create(laneName, scope.name);
78
- await scope.legacyScope.lanes.saveLane(newLane);
79
- return newLane;
80
- }
81
-
82
- async function getLaneOrigin(consumer: Consumer): Promise<LaneId | undefined> {
83
- const currentLaneId = consumer.bitMap.laneId;
84
- if (!currentLaneId) return undefined;
85
- if (consumer.bitMap.isLaneExported) {
86
- return currentLaneId;
87
- }
88
- // current lane is new.
89
- const currentLane = await consumer.getCurrentLaneObject();
90
- return currentLane?.forkedFrom;
91
- }
92
-
93
- export function throwForInvalidLaneName(laneName: string) {
94
- if (!isValidLaneName(laneName)) {
95
- throw new BitError(
96
- `lane "${laneName}" has invalid characters. lane name can only contain alphanumeric, lowercase characters, and the following ["-", "_", "$", "!"]`
97
- );
98
- }
99
- }
100
-
101
- export async function throwForStagedComponents(consumer: Consumer) {
102
- const componentList = new ComponentsList(consumer);
103
- const stagedComponents = await componentList.listExportPendingComponentsIds();
104
- if (stagedComponents.length) {
105
- throw new BitError(
106
- `unable to switch/create a new lane, please export or reset the following components first: ${stagedComponents.join(
107
- ', '
108
- )}`
109
- );
110
- }
111
- }
112
-
113
- function isValidLaneName(val: unknown): boolean {
114
- if (typeof val !== 'string') return false;
115
- if (val.length > MAX_LANE_NAME_LENGTH) return false;
116
- // @todo: should we allow slash? if so, we should probably replace the lane-delimiter with something else. (maybe ":")
117
- return /^[$\-_!a-z0-9]+$/.test(val);
118
- }
package/index.ts DELETED
@@ -1,8 +0,0 @@
1
- import { LanesAspect } from './lanes.aspect';
2
-
3
- export type { LanesMain, Lane } from './lanes.main.runtime';
4
- export type { LanesQuery } from '@teambit/lanes.ui.models.lanes-model';
5
- export { LanesModel } from '@teambit/lanes.ui.models.lanes-model';
6
- export type { LanesUI, LaneCompareProps, LaneProviderIgnoreSlot } from './lanes.ui.runtime';
7
- export default LanesAspect;
8
- export { LanesAspect };