@teambit/lanes 0.0.532 → 0.0.534
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/create-lane.js
CHANGED
@@ -22,6 +22,20 @@ function _lane() {
|
|
22
22
|
};
|
23
23
|
return data;
|
24
24
|
}
|
25
|
+
function _componentVersion() {
|
26
|
+
const data = require("@teambit/component-version");
|
27
|
+
_componentVersion = function () {
|
28
|
+
return data;
|
29
|
+
};
|
30
|
+
return data;
|
31
|
+
}
|
32
|
+
function _objects() {
|
33
|
+
const data = require("@teambit/legacy/dist/scope/objects");
|
34
|
+
_objects = function () {
|
35
|
+
return data;
|
36
|
+
};
|
37
|
+
return data;
|
38
|
+
}
|
25
39
|
// import { BitIds } from '@teambit/legacy/dist/bit-id';
|
26
40
|
|
27
41
|
async function createLane(consumer, laneName, scopeName, remoteLane) {
|
@@ -35,7 +49,26 @@ async function createLane(consumer, laneName, scopeName, remoteLane) {
|
|
35
49
|
// when branching from one lane to another, copy components from the origin lane
|
36
50
|
// when branching from main, no need to copy anything
|
37
51
|
const currentLaneObject = await consumer.getCurrentLaneObject();
|
38
|
-
|
52
|
+
if (!currentLaneObject) return [];
|
53
|
+
const laneComponents = currentLaneObject.components;
|
54
|
+
const workspaceIds = consumer.bitMap.getAllBitIds();
|
55
|
+
const laneComponentWithBitmapHead = laneComponents.map(({
|
56
|
+
id,
|
57
|
+
head
|
58
|
+
}) => {
|
59
|
+
const bitmapHead = workspaceIds.searchWithoutVersion(id);
|
60
|
+
if (bitmapHead && (0, _componentVersion().isHash)(bitmapHead.version)) {
|
61
|
+
return {
|
62
|
+
id,
|
63
|
+
head: _objects().Ref.from(bitmapHead.version)
|
64
|
+
};
|
65
|
+
}
|
66
|
+
return {
|
67
|
+
id,
|
68
|
+
head
|
69
|
+
};
|
70
|
+
});
|
71
|
+
return laneComponentWithBitmapHead;
|
39
72
|
};
|
40
73
|
const forkedFrom = await getLaneOrigin(consumer);
|
41
74
|
const newLane = remoteLane ? _lane().default.from({
|
package/dist/create-lane.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createLane","consumer","laneName","scopeName","remoteLane","lanes","scope","listLanes","find","lane","name","BitError","throwForInvalidLaneName","getDataToPopulateLaneObjectIfNeeded","components","currentLaneObject","getCurrentLaneObject","forkedFrom","getLaneOrigin","newLane","Lane","
|
1
|
+
{"version":3,"names":["createLane","consumer","laneName","scopeName","remoteLane","lanes","scope","listLanes","find","lane","name","BitError","throwForInvalidLaneName","getDataToPopulateLaneObjectIfNeeded","components","currentLaneObject","getCurrentLaneObject","laneComponents","workspaceIds","bitMap","getAllBitIds","laneComponentWithBitmapHead","map","id","head","bitmapHead","searchWithoutVersion","isHash","version","Ref","from","forkedFrom","getLaneOrigin","newLane","Lane","hash","toString","log","create","dataToPopulate","setLaneComponents","saveLane","createLaneInScope","legacyScope","currentLaneId","laneId","undefined","isLaneExported","currentLane","isValidLaneName","val","test"],"sources":["create-lane.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { ScopeMain } from '@teambit/scope';\n// import { BitIds } from '@teambit/legacy/dist/bit-id';\nimport Lane, { LaneComponent } from '@teambit/legacy/dist/scope/models/lane';\nimport { isHash } from '@teambit/component-version';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\n\nexport async function createLane(\n consumer: Consumer,\n laneName: string,\n scopeName: string,\n remoteLane?: Lane\n): Promise<Lane> {\n const lanes = await consumer.scope.listLanes();\n if (lanes.find((lane) => lane.name === laneName)) {\n throw new BitError(`lane \"${laneName}\" already exists, to switch to this lane, please use \"bit switch\" command`);\n }\n throwForInvalidLaneName(laneName);\n const getDataToPopulateLaneObjectIfNeeded = async (): Promise<LaneComponent[]> => {\n if (remoteLane) return remoteLane.components;\n // when branching from one lane to another, copy components from the origin lane\n // when branching from main, no need to copy anything\n const currentLaneObject = await consumer.getCurrentLaneObject();\n if (!currentLaneObject) return [];\n const laneComponents = currentLaneObject.components;\n const workspaceIds = consumer.bitMap.getAllBitIds();\n const laneComponentWithBitmapHead = laneComponents.map(({ id, head }) => {\n const bitmapHead = workspaceIds.searchWithoutVersion(id);\n if (bitmapHead && isHash(bitmapHead.version)) {\n return { id, head: Ref.from(bitmapHead.version as string) };\n }\n return { id, head };\n });\n return laneComponentWithBitmapHead;\n };\n\n const forkedFrom = await getLaneOrigin(consumer);\n const newLane = remoteLane\n ? Lane.from({\n name: laneName,\n hash: remoteLane.hash().toString(),\n log: remoteLane.log,\n scope: remoteLane.scope,\n forkedFrom,\n })\n : Lane.create(laneName, scopeName, forkedFrom);\n const dataToPopulate = await getDataToPopulateLaneObjectIfNeeded();\n newLane.setLaneComponents(dataToPopulate);\n\n await consumer.scope.lanes.saveLane(newLane);\n\n return newLane;\n}\n\nexport async function createLaneInScope(laneName: string, scope: ScopeMain): Promise<Lane> {\n const lanes = await scope.legacyScope.listLanes();\n if (lanes.find((lane) => lane.name === laneName)) {\n throw new BitError(`lane \"${laneName}\" already exists`);\n }\n throwForInvalidLaneName(laneName);\n const newLane = Lane.create(laneName, scope.name);\n await scope.legacyScope.lanes.saveLane(newLane);\n return newLane;\n}\n\nasync function getLaneOrigin(consumer: Consumer): Promise<LaneId | undefined> {\n const currentLaneId = consumer.bitMap.laneId;\n if (!currentLaneId) return undefined;\n if (consumer.bitMap.isLaneExported) {\n return currentLaneId;\n }\n // current lane is new.\n const currentLane = await consumer.getCurrentLaneObject();\n return currentLane?.forkedFrom;\n}\n\nexport function throwForInvalidLaneName(laneName: string) {\n if (!isValidLaneName(laneName)) {\n throw new BitError(\n `lane \"${laneName}\" has invalid characters. lane name can only contain alphanumeric, lowercase characters, and the following [\"-\", \"_\", \"$\", \"!\"]`\n );\n }\n}\n\nfunction isValidLaneName(val: unknown): boolean {\n if (typeof val !== 'string') return false;\n // @todo: should we allow slash? if so, we should probably replace the lane-delimiter with something else. (maybe \":\")\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;AAEA,eAAeD,aAAa,CAAC/B,QAAkB,EAA+B;EAC5E,MAAM2C,aAAa,GAAG3C,QAAQ,CAACkB,MAAM,CAAC0B,MAAM;EAC5C,IAAI,CAACD,aAAa,EAAE,OAAOE,SAAS;EACpC,IAAI7C,QAAQ,CAACkB,MAAM,CAAC4B,cAAc,EAAE;IAClC,OAAOH,aAAa;EACtB;EACA;EACA,MAAMI,WAAW,GAAG,MAAM/C,QAAQ,CAACe,oBAAoB,EAAE;EACzD,OAAOgC,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEjB,UAAU;AAChC;AAEO,SAASnB,uBAAuB,CAACV,QAAgB,EAAE;EACxD,IAAI,CAAC+C,eAAe,CAAC/C,QAAQ,CAAC,EAAE;IAC9B,MAAM,KAAIS,oBAAQ,EACf,SAAQT,QAAS,iIAAgI,CACnJ;EACH;AACF;AAEA,SAAS+C,eAAe,CAACC,GAAY,EAAW;EAC9C,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE,OAAO,KAAK;EACzC;EACA,OAAO,kBAAkB,CAACC,IAAI,CAACD,GAAG,CAAC;AACrC"}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.534/dist/lanes.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.lanes_lanes@0.0.534/dist/lanes.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
Binary file
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/lanes",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.534",
|
4
4
|
"homepage": "https://bit.dev/teambit/lanes/lanes",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.lanes",
|
8
8
|
"name": "lanes",
|
9
|
-
"version": "0.0.
|
9
|
+
"version": "0.0.534"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"chalk": "2.4.2",
|
@@ -16,37 +16,38 @@
|
|
16
16
|
"p-map-series": "2.1.0",
|
17
17
|
"core-js": "^3.0.0",
|
18
18
|
"@babel/runtime": "7.20.0",
|
19
|
+
"@teambit/component-version": "0.0.406",
|
19
20
|
"@teambit/harmony": "0.4.6",
|
20
21
|
"@teambit/bit-error": "0.0.402",
|
21
|
-
"@teambit/lane-id": "0.0.
|
22
|
-
"@teambit/scope": "0.0.
|
23
|
-
"@teambit/lanes.ui.models.lanes-model": "0.0.
|
24
|
-
"@teambit/cli": "0.0.
|
25
|
-
"@teambit/workspace": "0.0.
|
26
|
-
"@teambit/express": "0.0.
|
27
|
-
"@teambit/logger": "0.0.
|
28
|
-
"@teambit/graphql": "0.0.
|
29
|
-
"@teambit/component-compare": "0.0.
|
30
|
-
"@teambit/component": "0.0.
|
31
|
-
"@teambit/export": "0.0.
|
32
|
-
"@teambit/importer": "0.0.
|
33
|
-
"@teambit/lanes.entities.lane-diff": "0.0.
|
34
|
-
"@teambit/lanes.modules.diff": "0.0.
|
22
|
+
"@teambit/lane-id": "0.0.162",
|
23
|
+
"@teambit/scope": "0.0.962",
|
24
|
+
"@teambit/lanes.ui.models.lanes-model": "0.0.70",
|
25
|
+
"@teambit/cli": "0.0.645",
|
26
|
+
"@teambit/workspace": "0.0.962",
|
27
|
+
"@teambit/express": "0.0.743",
|
28
|
+
"@teambit/logger": "0.0.738",
|
29
|
+
"@teambit/graphql": "0.0.962",
|
30
|
+
"@teambit/component-compare": "0.0.210",
|
31
|
+
"@teambit/component": "0.0.962",
|
32
|
+
"@teambit/export": "0.0.962",
|
33
|
+
"@teambit/importer": "0.0.391",
|
34
|
+
"@teambit/lanes.entities.lane-diff": "0.0.7",
|
35
|
+
"@teambit/lanes.modules.diff": "0.0.280",
|
35
36
|
"@teambit/legacy-bit-id": "0.0.421",
|
36
|
-
"@teambit/merging": "0.0.
|
37
|
+
"@teambit/merging": "0.0.277",
|
37
38
|
"@teambit/component.ui.component-compare.models.component-compare-props": "0.0.3",
|
38
39
|
"@teambit/design.ui.pages.not-found": "0.0.366",
|
39
|
-
"@teambit/lanes.hooks.use-lanes": "0.0.
|
40
|
-
"@teambit/lanes.hooks.use-viewed-lane-from-url": "0.0.
|
41
|
-
"@teambit/lanes.ui.compare.lane-compare-page": "0.0.
|
42
|
-
"@teambit/lanes.ui.compare.lane-compare": "0.0.
|
43
|
-
"@teambit/lanes.ui.lane-overview": "0.0.
|
40
|
+
"@teambit/lanes.hooks.use-lanes": "0.0.108",
|
41
|
+
"@teambit/lanes.hooks.use-viewed-lane-from-url": "0.0.70",
|
42
|
+
"@teambit/lanes.ui.compare.lane-compare-page": "0.0.7",
|
43
|
+
"@teambit/lanes.ui.compare.lane-compare": "0.0.26",
|
44
|
+
"@teambit/lanes.ui.lane-overview": "0.0.71",
|
44
45
|
"@teambit/lanes.ui.menus.lanes-overview-menu": "0.0.5",
|
45
|
-
"@teambit/lanes.ui.menus.use-lanes-menu": "0.0.
|
46
|
-
"@teambit/lanes.ui.navigation.lane-switcher": "0.0.
|
46
|
+
"@teambit/lanes.ui.menus.use-lanes-menu": "0.0.70",
|
47
|
+
"@teambit/lanes.ui.navigation.lane-switcher": "0.0.70",
|
47
48
|
"@teambit/ui-foundation.ui.menu": "0.0.497",
|
48
49
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.501",
|
49
|
-
"@teambit/ui": "0.0.
|
50
|
+
"@teambit/ui": "0.0.962"
|
50
51
|
},
|
51
52
|
"devDependencies": {
|
52
53
|
"@types/react": "^17.0.8",
|
@@ -60,12 +61,12 @@
|
|
60
61
|
"@types/testing-library__jest-dom": "5.9.5",
|
61
62
|
"@teambit/component.testing.mock-components": "0.0.18",
|
62
63
|
"@teambit/harmony.testing.load-aspect": "0.0.17",
|
63
|
-
"@teambit/snapping": "0.0.
|
64
|
+
"@teambit/snapping": "0.0.277",
|
64
65
|
"@teambit/workspace.testing.mock-workspace": "0.0.14"
|
65
66
|
},
|
66
67
|
"peerDependencies": {
|
67
68
|
"react-router-dom": "^6.0.0",
|
68
|
-
"@teambit/legacy": "1.0.
|
69
|
+
"@teambit/legacy": "1.0.426",
|
69
70
|
"react": "^16.8.0 || ^17.0.0",
|
70
71
|
"react-dom": "^16.8.0 || ^17.0.0"
|
71
72
|
},
|
Binary file
|