@teambit/lanes 0.0.453 → 0.0.454
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 +7 -24
- package/dist/create-lane.js.map +1 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/lane.cmd.js +3 -91
- package/dist/lane.cmd.js.map +1 -1
- package/dist/lanes.aspect.js +0 -5
- package/dist/lanes.aspect.js.map +1 -1
- package/dist/lanes.composition.js +0 -6
- package/dist/lanes.composition.js.map +1 -1
- package/dist/lanes.graphql.js +0 -21
- package/dist/lanes.graphql.js.map +1 -1
- package/dist/lanes.main.runtime.js +15 -190
- package/dist/lanes.main.runtime.js.map +1 -1
- package/dist/lanes.spec.js +0 -13
- package/dist/lanes.spec.js.map +1 -1
- package/dist/lanes.ui.runtime.js +6 -91
- package/dist/lanes.ui.runtime.js.map +1 -1
- package/dist/switch-lanes.js +12 -86
- package/dist/switch-lanes.js.map +1 -1
- package/dist/switch.cmd.js +0 -23
- package/dist/switch.cmd.js.map +1 -1
- package/package-tar/teambit-lanes-0.0.454.tgz +0 -0
- package/package.json +11 -11
- package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-lanes-0.0.453.tgz +0 -0
package/dist/create-lane.js
CHANGED
@@ -1,53 +1,41 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
require("core-js/modules/es.promise.js");
|
6
|
-
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
8
6
|
value: true
|
9
7
|
});
|
10
8
|
exports.createLane = createLane;
|
11
9
|
exports.throwForInvalidLaneName = throwForInvalidLaneName;
|
12
|
-
|
13
10
|
function _bitError() {
|
14
11
|
const data = require("@teambit/bit-error");
|
15
|
-
|
16
12
|
_bitError = function () {
|
17
13
|
return data;
|
18
14
|
};
|
19
|
-
|
20
15
|
return data;
|
21
16
|
}
|
22
|
-
|
23
17
|
function _lane() {
|
24
18
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/models/lane"));
|
25
|
-
|
26
19
|
_lane = function () {
|
27
20
|
return data;
|
28
21
|
};
|
29
|
-
|
30
22
|
return data;
|
31
23
|
}
|
32
|
-
|
33
24
|
// import { BitIds } from '@teambit/legacy/dist/bit-id';
|
25
|
+
|
34
26
|
async function createLane(consumer, laneName, scopeName, remoteLane) {
|
35
27
|
const lanes = await consumer.scope.listLanes();
|
36
|
-
|
37
28
|
if (lanes.find(lane => lane.name === laneName)) {
|
38
29
|
throw new (_bitError().BitError)(`lane "${laneName}" already exists, to switch to this lane, please use "bit switch" command`);
|
39
30
|
}
|
40
|
-
|
41
31
|
throwForInvalidLaneName(laneName);
|
42
|
-
|
43
32
|
const getDataToPopulateLaneObjectIfNeeded = async () => {
|
44
|
-
if (remoteLane) return remoteLane.components;
|
33
|
+
if (remoteLane) return remoteLane.components;
|
34
|
+
// when branching from one lane to another, copy components from the origin lane
|
45
35
|
// when branching from main, no need to copy anything
|
46
|
-
|
47
36
|
const currentLaneObject = await consumer.getCurrentLaneObject();
|
48
37
|
return currentLaneObject ? currentLaneObject.components : [];
|
49
38
|
};
|
50
|
-
|
51
39
|
const forkedFrom = await getLaneOrigin(consumer);
|
52
40
|
const newLane = remoteLane ? _lane().default.from({
|
53
41
|
name: laneName,
|
@@ -61,29 +49,24 @@ async function createLane(consumer, laneName, scopeName, remoteLane) {
|
|
61
49
|
await consumer.scope.lanes.saveLane(newLane);
|
62
50
|
return newLane;
|
63
51
|
}
|
64
|
-
|
65
52
|
async function getLaneOrigin(consumer) {
|
66
53
|
const currentLaneId = consumer.bitMap.laneId;
|
67
54
|
if (!currentLaneId) return undefined;
|
68
|
-
|
69
55
|
if (consumer.bitMap.isLaneExported) {
|
70
56
|
return currentLaneId;
|
71
|
-
}
|
72
|
-
|
73
|
-
|
57
|
+
}
|
58
|
+
// current lane is new.
|
74
59
|
const currentLane = await consumer.getCurrentLaneObject();
|
75
60
|
return currentLane === null || currentLane === void 0 ? void 0 : currentLane.forkedFrom;
|
76
61
|
}
|
77
|
-
|
78
62
|
function throwForInvalidLaneName(laneName) {
|
79
63
|
if (!isValidLaneName(laneName)) {
|
80
64
|
throw new (_bitError().BitError)(`lane "${laneName}" has invalid characters. lane name can only contain alphanumeric, lowercase characters, and the following ["-", "_", "$", "!"]`);
|
81
65
|
}
|
82
66
|
}
|
83
|
-
|
84
67
|
function isValidLaneName(val) {
|
85
|
-
if (typeof val !== 'string') return false;
|
86
|
-
|
68
|
+
if (typeof val !== 'string') return false;
|
69
|
+
// @todo: should we allow slash? if so, we should probably replace the lane-delimiter with something else. (maybe ":")
|
87
70
|
return /^[$\-_!a-z0-9]+$/.test(val);
|
88
71
|
}
|
89
72
|
|
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","from","hash","toString","log","create","dataToPopulate","setLaneComponents","saveLane","currentLaneId","bitMap","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';\n// import { BitIds } from '@teambit/legacy/dist/bit-id';\nimport Lane, { LaneComponent } from '@teambit/legacy/dist/scope/models/lane';\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 return currentLaneObject ? currentLaneObject.components : [];\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\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 \":\")\n return /^[$\\-_!a-z0-9]+$/.test(val);\n}\n"],"mappings":"
|
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","from","hash","toString","log","create","dataToPopulate","setLaneComponents","saveLane","currentLaneId","bitMap","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';\n// import { BitIds } from '@teambit/legacy/dist/bit-id';\nimport Lane, { LaneComponent } from '@teambit/legacy/dist/scope/models/lane';\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 return currentLaneObject ? currentLaneObject.components : [];\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\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 \":\")\n return /^[$\\-_!a-z0-9]+$/.test(val);\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AADA;;AAGO,eAAeA,UAAU,CAC9BC,QAAkB,EAClBC,QAAgB,EAChBC,SAAiB,EACjBC,UAAiB,EACF;EACf,MAAMC,KAAK,GAAG,MAAMJ,QAAQ,CAACK,KAAK,CAACC,SAAS,EAAE;EAC9C,IAAIF,KAAK,CAACG,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAKR,QAAQ,CAAC,EAAE;IAChD,MAAM,KAAIS,oBAAQ,EAAE,SAAQT,QAAS,2EAA0E,CAAC;EAClH;EACAU,uBAAuB,CAACV,QAAQ,CAAC;EACjC,MAAMW,mCAAmC,GAAG,YAAsC;IAChF,IAAIT,UAAU,EAAE,OAAOA,UAAU,CAACU,UAAU;IAC5C;IACA;IACA,MAAMC,iBAAiB,GAAG,MAAMd,QAAQ,CAACe,oBAAoB,EAAE;IAC/D,OAAOD,iBAAiB,GAAGA,iBAAiB,CAACD,UAAU,GAAG,EAAE;EAC9D,CAAC;EAED,MAAMG,UAAU,GAAG,MAAMC,aAAa,CAACjB,QAAQ,CAAC;EAChD,MAAMkB,OAAO,GAAGf,UAAU,GACtBgB,eAAI,CAACC,IAAI,CAAC;IACRX,IAAI,EAAER,QAAQ;IACdoB,IAAI,EAAElB,UAAU,CAACkB,IAAI,EAAE,CAACC,QAAQ,EAAE;IAClCC,GAAG,EAAEpB,UAAU,CAACoB,GAAG;IACnBlB,KAAK,EAAEF,UAAU,CAACE,KAAK;IACvBW;EACF,CAAC,CAAC,GACFG,eAAI,CAACK,MAAM,CAACvB,QAAQ,EAAEC,SAAS,EAAEc,UAAU,CAAC;EAChD,MAAMS,cAAc,GAAG,MAAMb,mCAAmC,EAAE;EAClEM,OAAO,CAACQ,iBAAiB,CAACD,cAAc,CAAC;EAEzC,MAAMzB,QAAQ,CAACK,KAAK,CAACD,KAAK,CAACuB,QAAQ,CAACT,OAAO,CAAC;EAE5C,OAAOA,OAAO;AAChB;AAEA,eAAeD,aAAa,CAACjB,QAAkB,EAA+B;EAC5E,MAAM4B,aAAa,GAAG5B,QAAQ,CAAC6B,MAAM,CAACC,MAAM;EAC5C,IAAI,CAACF,aAAa,EAAE,OAAOG,SAAS;EACpC,IAAI/B,QAAQ,CAAC6B,MAAM,CAACG,cAAc,EAAE;IAClC,OAAOJ,aAAa;EACtB;EACA;EACA,MAAMK,WAAW,GAAG,MAAMjC,QAAQ,CAACe,oBAAoB,EAAE;EACzD,OAAOkB,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEjB,UAAU;AAChC;AAEO,SAASL,uBAAuB,CAACV,QAAgB,EAAE;EACxD,IAAI,CAACiC,eAAe,CAACjC,QAAQ,CAAC,EAAE;IAC9B,MAAM,KAAIS,oBAAQ,EACf,SAAQT,QAAS,iIAAgI,CACnJ;EACH;AACF;AAEA,SAASiC,eAAe,CAACC,GAAY,EAAW;EAC9C,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE,OAAO,KAAK;EACzC;EACA,OAAO,kBAAkB,CAACC,IAAI,CAACD,GAAG,CAAC;AACrC"}
|
package/dist/index.js
CHANGED
@@ -22,29 +22,21 @@ Object.defineProperty(exports, "LanesQuery", {
|
|
22
22
|
}
|
23
23
|
});
|
24
24
|
exports.default = void 0;
|
25
|
-
|
26
25
|
function _lanes() {
|
27
26
|
const data = require("./lanes.aspect");
|
28
|
-
|
29
27
|
_lanes = function () {
|
30
28
|
return data;
|
31
29
|
};
|
32
|
-
|
33
30
|
return data;
|
34
31
|
}
|
35
|
-
|
36
32
|
function _lanesUiModels() {
|
37
33
|
const data = require("@teambit/lanes.ui.models.lanes-model");
|
38
|
-
|
39
34
|
_lanesUiModels = function () {
|
40
35
|
return data;
|
41
36
|
};
|
42
|
-
|
43
37
|
return data;
|
44
38
|
}
|
45
|
-
|
46
39
|
var _default = _lanes().LanesAspect;
|
47
|
-
|
48
40
|
exports.default = _default;
|
49
41
|
|
50
42
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["LanesAspect"],"sources":["index.ts"],"sourcesContent":["import { LanesAspect } from './lanes.aspect';\n\nexport type { LanesMain, Lane } from './lanes.main.runtime';\nexport { LanesModel, LanesQuery } from '@teambit/lanes.ui.models.lanes-model';\nexport type { LanesUI } from './lanes.ui.runtime';\nexport default LanesAspect;\nexport { LanesAspect };\n"],"mappings":"
|
1
|
+
{"version":3,"names":["LanesAspect"],"sources":["index.ts"],"sourcesContent":["import { LanesAspect } from './lanes.aspect';\n\nexport type { LanesMain, Lane } from './lanes.main.runtime';\nexport { LanesModel, LanesQuery } from '@teambit/lanes.ui.models.lanes-model';\nexport type { LanesUI } from './lanes.ui.runtime';\nexport default LanesAspect;\nexport { LanesAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA8E,eAE/DA,oBAAW;AAAA"}
|
package/dist/lane.cmd.js
CHANGED
@@ -1,69 +1,50 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
require("core-js/modules/es.symbol.description.js");
|
6
|
-
|
7
5
|
require("core-js/modules/es.array.iterator.js");
|
8
|
-
|
9
6
|
require("core-js/modules/es.promise.js");
|
10
|
-
|
11
7
|
Object.defineProperty(exports, "__esModule", {
|
12
8
|
value: true
|
13
9
|
});
|
14
10
|
exports.LaneShowCmd = exports.LaneRenameCmd = exports.LaneRemoveReadmeCmd = exports.LaneRemoveCmd = exports.LaneListCmd = exports.LaneImportCmd = exports.LaneCreateCmd = exports.LaneCmd = exports.LaneChangeScopeCmd = exports.LaneAliasCmd = exports.LaneAddReadmeCmd = void 0;
|
15
|
-
|
16
11
|
function _defineProperty2() {
|
17
12
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
18
|
-
|
19
13
|
_defineProperty2 = function () {
|
20
14
|
return data;
|
21
15
|
};
|
22
|
-
|
23
16
|
return data;
|
24
17
|
}
|
25
|
-
|
26
18
|
function _chalk() {
|
27
19
|
const data = _interopRequireDefault(require("chalk"));
|
28
|
-
|
29
20
|
_chalk = function () {
|
30
21
|
return data;
|
31
22
|
};
|
32
|
-
|
33
23
|
return data;
|
34
24
|
}
|
35
|
-
|
36
25
|
function _yn() {
|
37
26
|
const data = _interopRequireDefault(require("yn"));
|
38
|
-
|
39
27
|
_yn = function () {
|
40
28
|
return data;
|
41
29
|
};
|
42
|
-
|
43
30
|
return data;
|
44
31
|
}
|
45
|
-
|
46
32
|
function _bitError() {
|
47
33
|
const data = require("@teambit/bit-error");
|
48
|
-
|
49
34
|
_bitError = function () {
|
50
35
|
return data;
|
51
36
|
};
|
52
|
-
|
53
37
|
return data;
|
54
38
|
}
|
55
|
-
|
56
39
|
function _prompts() {
|
57
40
|
const data = require("@teambit/legacy/dist/prompts");
|
58
|
-
|
59
41
|
_prompts = function () {
|
60
42
|
return data;
|
61
43
|
};
|
62
|
-
|
63
44
|
return data;
|
64
45
|
}
|
65
|
-
|
66
46
|
// eslint-disable-next-line max-classes-per-file
|
47
|
+
|
67
48
|
class LaneListCmd {
|
68
49
|
constructor(lanes, workspace, scope) {
|
69
50
|
this.lanes = lanes;
|
@@ -79,7 +60,6 @@ class LaneListCmd {
|
|
79
60
|
(0, _defineProperty2().default)(this, "remoteOp", true);
|
80
61
|
(0, _defineProperty2().default)(this, "skipWorkspace", true);
|
81
62
|
}
|
82
|
-
|
83
63
|
async report(args, laneOptions) {
|
84
64
|
const {
|
85
65
|
details,
|
@@ -87,84 +67,67 @@ class LaneListCmd {
|
|
87
67
|
merged,
|
88
68
|
notMerged
|
89
69
|
} = laneOptions;
|
90
|
-
|
91
70
|
const laneIdStr = (laneId, alias) => {
|
92
71
|
if (laneId.isDefault()) return laneId.name;
|
93
72
|
if (alias) return `${laneId.toString()} (${alias})`;
|
94
73
|
return laneId.toString();
|
95
74
|
};
|
96
|
-
|
97
75
|
const lanes = await this.lanes.getLanes({
|
98
76
|
remote,
|
99
77
|
merged,
|
100
78
|
notMerged,
|
101
79
|
showDefaultLane: true
|
102
80
|
});
|
103
|
-
|
104
81
|
if (merged) {
|
105
82
|
const mergedLanes = lanes.filter(l => l.isMerged);
|
106
83
|
if (!mergedLanes.length) return _chalk().default.green('None of the lanes is merged');
|
107
84
|
return _chalk().default.green(mergedLanes.map(m => m.name).join('\n'));
|
108
85
|
}
|
109
|
-
|
110
86
|
if (notMerged) {
|
111
87
|
const unmergedLanes = lanes.filter(l => !l.isMerged);
|
112
88
|
if (!unmergedLanes.length) return _chalk().default.green('All lanes are merged');
|
113
89
|
return _chalk().default.green(unmergedLanes.map(m => m.name).join('\n'));
|
114
90
|
}
|
115
|
-
|
116
91
|
const currentLane = this.lanes.getCurrentLaneId() || this.lanes.getDefaultLaneId();
|
117
92
|
const laneDataOfCurrentLane = currentLane ? lanes.find(l => currentLane.isEqual(l.id)) : undefined;
|
118
93
|
const currentAlias = laneDataOfCurrentLane ? laneDataOfCurrentLane.alias : undefined;
|
119
94
|
const currentLaneReadmeComponentStr = outputReadmeComponent(laneDataOfCurrentLane === null || laneDataOfCurrentLane === void 0 ? void 0 : laneDataOfCurrentLane.readmeComponent);
|
120
95
|
let currentLaneStr = `current lane - ${_chalk().default.green.green(laneIdStr(currentLane, currentAlias))}`;
|
121
96
|
currentLaneStr += currentLaneReadmeComponentStr;
|
122
|
-
|
123
97
|
if (details) {
|
124
98
|
const currentLaneComponents = laneDataOfCurrentLane ? outputComponents(laneDataOfCurrentLane.components) : '';
|
125
|
-
|
126
99
|
if (currentLaneStr) {
|
127
100
|
currentLaneStr += `\n${currentLaneComponents}`;
|
128
101
|
}
|
129
102
|
}
|
130
|
-
|
131
103
|
const availableLanes = lanes.filter(l => !currentLane.isEqual(l.id)).map(laneData => {
|
132
104
|
const readmeComponentStr = outputReadmeComponent(laneData.readmeComponent);
|
133
|
-
|
134
105
|
if (details) {
|
135
106
|
const laneTitle = `> ${_chalk().default.bold(laneIdStr(laneData.id, laneData.alias))}\n`;
|
136
107
|
const components = outputComponents(laneData.components);
|
137
108
|
return laneTitle + readmeComponentStr.concat('\n') + components;
|
138
109
|
}
|
139
|
-
|
140
110
|
return ` > ${_chalk().default.green(laneIdStr(laneData.id, laneData.alias))} (${laneData.components.length} components)${readmeComponentStr}`;
|
141
111
|
}).join('\n');
|
142
|
-
|
143
112
|
const outputFooter = () => {
|
144
113
|
let footer = '\n';
|
145
|
-
|
146
114
|
if (details) {
|
147
115
|
footer += 'You can use --merged and --not-merged to see which of the lanes is fully merged.';
|
148
116
|
} else {
|
149
117
|
footer += "to get more info on all lanes in workspace use 'bit lane list --details' or 'bit lane show <lane-name>' for a specific lane.";
|
150
118
|
}
|
151
|
-
|
152
119
|
if (!remote && this.workspace) footer += `\nswitch lanes using 'bit switch <name>'.`;
|
153
120
|
return footer;
|
154
121
|
};
|
155
|
-
|
156
122
|
return outputCurrentLane() + outputAvailableLanes() + outputFooter();
|
157
|
-
|
158
123
|
function outputCurrentLane() {
|
159
124
|
return currentLaneStr ? `${currentLaneStr}\n` : '';
|
160
125
|
}
|
161
|
-
|
162
126
|
function outputAvailableLanes() {
|
163
127
|
if (!availableLanes) return '';
|
164
128
|
return remote ? `${availableLanes}\n` : `\nAvailable lanes:\n${availableLanes}\n`;
|
165
129
|
}
|
166
130
|
}
|
167
|
-
|
168
131
|
async json(args, laneOptions) {
|
169
132
|
const {
|
170
133
|
remote,
|
@@ -183,11 +146,8 @@ class LaneListCmd {
|
|
183
146
|
currentLane
|
184
147
|
};
|
185
148
|
}
|
186
|
-
|
187
149
|
}
|
188
|
-
|
189
150
|
exports.LaneListCmd = LaneListCmd;
|
190
|
-
|
191
151
|
class LaneShowCmd {
|
192
152
|
constructor(lanes, workspace, scope) {
|
193
153
|
this.lanes = lanes;
|
@@ -203,10 +163,8 @@ class LaneShowCmd {
|
|
203
163
|
(0, _defineProperty2().default)(this, "remoteOp", true);
|
204
164
|
(0, _defineProperty2().default)(this, "skipWorkspace", true);
|
205
165
|
}
|
206
|
-
|
207
166
|
async report([name], laneOptions) {
|
208
167
|
var _onlyLane$log, _onlyLane$log2, _onlyLane$log3;
|
209
|
-
|
210
168
|
const {
|
211
169
|
remote
|
212
170
|
} = laneOptions;
|
@@ -220,7 +178,6 @@ class LaneShowCmd {
|
|
220
178
|
const date = (_onlyLane$log3 = onlyLane.log) !== null && _onlyLane$log3 !== void 0 && _onlyLane$log3.date ? `${new Date(parseInt(onlyLane.log.date)).toLocaleString()}\n` : undefined;
|
221
179
|
return title + author + date + outputComponents(onlyLane.components);
|
222
180
|
}
|
223
|
-
|
224
181
|
async json([name], laneOptions) {
|
225
182
|
const {
|
226
183
|
remote
|
@@ -231,11 +188,8 @@ class LaneShowCmd {
|
|
231
188
|
});
|
232
189
|
return lanes[0];
|
233
190
|
}
|
234
|
-
|
235
191
|
}
|
236
|
-
|
237
192
|
exports.LaneShowCmd = LaneShowCmd;
|
238
|
-
|
239
193
|
class LaneCreateCmd {
|
240
194
|
constructor(lanes) {
|
241
195
|
this.lanes = lanes;
|
@@ -253,21 +207,15 @@ a lane created from another lane has all the components of the original lane.`);
|
|
253
207
|
(0, _defineProperty2().default)(this, "private", true);
|
254
208
|
(0, _defineProperty2().default)(this, "migration", true);
|
255
209
|
}
|
256
|
-
|
257
210
|
async report([name], createLaneOptions) {
|
258
211
|
const result = await this.lanes.createLane(name, createLaneOptions);
|
259
212
|
const remoteScopeOrDefaultScope = createLaneOptions.remoteScope ? `the remote scope ${_chalk().default.bold(createLaneOptions.remoteScope)}` : `the default-scope ${_chalk().default.bold(result.remoteScope)}. to change it, please run "bit lane change-scope" command`;
|
260
|
-
|
261
213
|
const title = _chalk().default.green(`successfully added and checked out to a new lane ${_chalk().default.bold(result.localLane)}`);
|
262
|
-
|
263
214
|
const remoteScopeOutput = `this lane will be exported to ${remoteScopeOrDefaultScope}`;
|
264
215
|
return `${title}\n${remoteScopeOutput}`;
|
265
216
|
}
|
266
|
-
|
267
217
|
}
|
268
|
-
|
269
218
|
exports.LaneCreateCmd = LaneCreateCmd;
|
270
|
-
|
271
219
|
class LaneAliasCmd {
|
272
220
|
constructor(lanes) {
|
273
221
|
this.lanes = lanes;
|
@@ -281,18 +229,14 @@ it is useful when having multiple lanes with the same name, but with different r
|
|
281
229
|
(0, _defineProperty2().default)(this, "private", true);
|
282
230
|
(0, _defineProperty2().default)(this, "migration", true);
|
283
231
|
}
|
284
|
-
|
285
232
|
async report([laneName, alias]) {
|
286
233
|
const {
|
287
234
|
laneId
|
288
235
|
} = await this.lanes.aliasLane(laneName, alias);
|
289
236
|
return `successfully added the alias ${_chalk().default.bold(alias)} to the lane ${_chalk().default.bold(laneId.toString())}`;
|
290
237
|
}
|
291
|
-
|
292
238
|
}
|
293
|
-
|
294
239
|
exports.LaneAliasCmd = LaneAliasCmd;
|
295
|
-
|
296
240
|
class LaneChangeScopeCmd {
|
297
241
|
constructor(lanes) {
|
298
242
|
this.lanes = lanes;
|
@@ -304,18 +248,14 @@ class LaneChangeScopeCmd {
|
|
304
248
|
(0, _defineProperty2().default)(this, "private", true);
|
305
249
|
(0, _defineProperty2().default)(this, "migration", true);
|
306
250
|
}
|
307
|
-
|
308
251
|
async report([localName, remoteScope]) {
|
309
252
|
const {
|
310
253
|
remoteScopeBefore
|
311
254
|
} = await this.lanes.changeScope(localName, remoteScope);
|
312
255
|
return `the remote-scope of ${_chalk().default.bold(localName)} has been changed from ${_chalk().default.bold(remoteScopeBefore)} to ${_chalk().default.bold(remoteScope)}`;
|
313
256
|
}
|
314
|
-
|
315
257
|
}
|
316
|
-
|
317
258
|
exports.LaneChangeScopeCmd = LaneChangeScopeCmd;
|
318
|
-
|
319
259
|
class LaneRenameCmd {
|
320
260
|
constructor(lanes) {
|
321
261
|
this.lanes = lanes;
|
@@ -327,7 +267,6 @@ class LaneRenameCmd {
|
|
327
267
|
(0, _defineProperty2().default)(this, "private", true);
|
328
268
|
(0, _defineProperty2().default)(this, "migration", true);
|
329
269
|
}
|
330
|
-
|
331
270
|
async report([currentName, newName]) {
|
332
271
|
const {
|
333
272
|
exported,
|
@@ -336,11 +275,8 @@ class LaneRenameCmd {
|
|
336
275
|
const exportedStr = exported ? `and have been exported successfully to the remote` : `however if failed to export the renamed lane to the remote, due to an error: ${(exportErr === null || exportErr === void 0 ? void 0 : exportErr.message) || 'unknown'}`;
|
337
276
|
return `the lane ${_chalk().default.bold(currentName)} has been changed to ${_chalk().default.bold(newName)}, ${exportedStr}`;
|
338
277
|
}
|
339
|
-
|
340
278
|
}
|
341
|
-
|
342
279
|
exports.LaneRenameCmd = LaneRenameCmd;
|
343
|
-
|
344
280
|
class LaneRemoveCmd {
|
345
281
|
constructor(lanes) {
|
346
282
|
this.lanes = lanes;
|
@@ -356,31 +292,26 @@ class LaneRemoveCmd {
|
|
356
292
|
(0, _defineProperty2().default)(this, "private", true);
|
357
293
|
(0, _defineProperty2().default)(this, "migration", true);
|
358
294
|
}
|
359
|
-
|
360
295
|
async report([names], {
|
361
296
|
remote = false,
|
362
297
|
force = false,
|
363
298
|
silent = false
|
364
299
|
}) {
|
365
300
|
if (!silent) {
|
366
|
-
const removePromptResult = await (0, _prompts().approveOperation)();
|
367
|
-
|
301
|
+
const removePromptResult = await (0, _prompts().approveOperation)();
|
302
|
+
// @ts-ignore
|
368
303
|
if (!(0, _yn().default)(removePromptResult.shouldProceed)) {
|
369
304
|
throw new (_bitError().BitError)('the operation has been canceled');
|
370
305
|
}
|
371
306
|
}
|
372
|
-
|
373
307
|
const laneResults = await this.lanes.removeLanes(names, {
|
374
308
|
remote,
|
375
309
|
force
|
376
310
|
});
|
377
311
|
return _chalk().default.green(`successfully removed the following lane(s): ${_chalk().default.bold(laneResults.join(', '))}`);
|
378
312
|
}
|
379
|
-
|
380
313
|
}
|
381
|
-
|
382
314
|
exports.LaneRemoveCmd = LaneRemoveCmd;
|
383
|
-
|
384
315
|
class LaneImportCmd {
|
385
316
|
constructor(switchCmd) {
|
386
317
|
this.switchCmd = switchCmd;
|
@@ -396,7 +327,6 @@ class LaneImportCmd {
|
|
396
327
|
(0, _defineProperty2().default)(this, "private", true);
|
397
328
|
(0, _defineProperty2().default)(this, "migration", true);
|
398
329
|
}
|
399
|
-
|
400
330
|
async report([lane], {
|
401
331
|
skipDependencyInstallation = false
|
402
332
|
}) {
|
@@ -405,11 +335,8 @@ class LaneImportCmd {
|
|
405
335
|
skipDependencyInstallation
|
406
336
|
});
|
407
337
|
}
|
408
|
-
|
409
338
|
}
|
410
|
-
|
411
339
|
exports.LaneImportCmd = LaneImportCmd;
|
412
|
-
|
413
340
|
class LaneCmd {
|
414
341
|
constructor(lanes, workspace, scope, docsDomain) {
|
415
342
|
this.lanes = lanes;
|
@@ -428,15 +355,11 @@ class LaneCmd {
|
|
428
355
|
this.description = `show lanes details
|
429
356
|
https://${docsDomain}/components/lanes`;
|
430
357
|
}
|
431
|
-
|
432
358
|
async report([name], laneOptions) {
|
433
359
|
return new LaneListCmd(this.lanes, this.workspace, this.scope).report([name], laneOptions);
|
434
360
|
}
|
435
|
-
|
436
361
|
}
|
437
|
-
|
438
362
|
exports.LaneCmd = LaneCmd;
|
439
|
-
|
440
363
|
class LaneRemoveReadmeCmd {
|
441
364
|
constructor(lanes) {
|
442
365
|
this.lanes = lanes;
|
@@ -447,24 +370,18 @@ class LaneRemoveReadmeCmd {
|
|
447
370
|
(0, _defineProperty2().default)(this, "private", true);
|
448
371
|
(0, _defineProperty2().default)(this, "skipWorkspace", false);
|
449
372
|
}
|
450
|
-
|
451
373
|
async report([laneName]) {
|
452
374
|
const {
|
453
375
|
result,
|
454
376
|
message
|
455
377
|
} = await this.lanes.removeLaneReadme(laneName);
|
456
|
-
|
457
378
|
if (result) {
|
458
379
|
return _chalk().default.green(`the readme component has been successfully removed from the lane ${laneName || this.lanes.getCurrentLaneName()}`);
|
459
380
|
}
|
460
|
-
|
461
381
|
return _chalk().default.red(`${message}\n`);
|
462
382
|
}
|
463
|
-
|
464
383
|
}
|
465
|
-
|
466
384
|
exports.LaneRemoveReadmeCmd = LaneRemoveReadmeCmd;
|
467
|
-
|
468
385
|
class LaneAddReadmeCmd {
|
469
386
|
constructor(lanes) {
|
470
387
|
this.lanes = lanes;
|
@@ -482,7 +399,6 @@ class LaneAddReadmeCmd {
|
|
482
399
|
(0, _defineProperty2().default)(this, "private", true);
|
483
400
|
(0, _defineProperty2().default)(this, "skipWorkspace", false);
|
484
401
|
}
|
485
|
-
|
486
402
|
async report([componentId, laneName]) {
|
487
403
|
const {
|
488
404
|
result,
|
@@ -491,17 +407,13 @@ class LaneAddReadmeCmd {
|
|
491
407
|
if (result) return _chalk().default.green(`the component ${componentId} has been successfully added as the readme component for the lane ${laneName || this.lanes.getCurrentLaneName()}`);
|
492
408
|
return _chalk().default.red(`${message || ''}\nthe component ${componentId} could not be added as a readme component for the lane ${laneName || this.lanes.getCurrentLaneName()}`);
|
493
409
|
}
|
494
|
-
|
495
410
|
}
|
496
|
-
|
497
411
|
exports.LaneAddReadmeCmd = LaneAddReadmeCmd;
|
498
|
-
|
499
412
|
function outputComponents(components) {
|
500
413
|
const componentsTitle = `\t${_chalk().default.bold(`components (${components.length})`)}\n`;
|
501
414
|
const componentsStr = components.map(c => `\t ${c.id.toString()} - ${c.head}`).join('\n');
|
502
415
|
return componentsTitle + componentsStr;
|
503
416
|
}
|
504
|
-
|
505
417
|
function outputReadmeComponent(component) {
|
506
418
|
if (!component) return '';
|
507
419
|
return `\n\t${`${_chalk().default.yellow('readme component')}\n\t ${component.id} - ${component.head || `(unsnapped)\n\t("use bit snap ${component.id.name}" to snap the readme component on the lane before exporting)`}`}\n`;
|