@teambit/lanes 0.0.296 → 0.0.299

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.
@@ -0,0 +1,4 @@
1
+ import { Consumer } from '@teambit/legacy/dist/consumer';
2
+ import Lane from '@teambit/legacy/dist/scope/models/lane';
3
+ export declare function createLane(consumer: Consumer, laneName: string, scopeName: string, remoteLane?: Lane): Promise<Lane>;
4
+ export declare function throwForInvalidLaneName(laneName: string): void;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ require("core-js/modules/es.promise.js");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.createLane = createLane;
11
+ exports.throwForInvalidLaneName = throwForInvalidLaneName;
12
+
13
+ function _bitError() {
14
+ const data = require("@teambit/bit-error");
15
+
16
+ _bitError = function () {
17
+ return data;
18
+ };
19
+
20
+ return data;
21
+ }
22
+
23
+ function _bitId() {
24
+ const data = require("@teambit/legacy/dist/bit-id");
25
+
26
+ _bitId = function () {
27
+ return data;
28
+ };
29
+
30
+ return data;
31
+ }
32
+
33
+ function _lane() {
34
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/models/lane"));
35
+
36
+ _lane = function () {
37
+ return data;
38
+ };
39
+
40
+ return data;
41
+ }
42
+
43
+ function _workspaceLane() {
44
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/bit-map/workspace-lane"));
45
+
46
+ _workspaceLane = function () {
47
+ return data;
48
+ };
49
+
50
+ return data;
51
+ }
52
+
53
+ async function createLane(consumer, laneName, scopeName, remoteLane) {
54
+ const lanes = await consumer.scope.listLanes();
55
+
56
+ if (lanes.find(lane => lane.name === laneName)) {
57
+ throw new (_bitError().BitError)(`lane "${laneName}" already exists, to switch to this lane, please use "bit switch" command`);
58
+ }
59
+
60
+ throwForInvalidLaneName(laneName);
61
+
62
+ const getDataToPopulateLaneObjectIfNeeded = async () => {
63
+ if (remoteLane) return remoteLane.components; // when branching from one lane to another, copy components from the origin lane
64
+ // when branching from main, no need to copy anything
65
+
66
+ const currentLaneObject = await consumer.getCurrentLaneObject();
67
+ return currentLaneObject ? currentLaneObject.components : [];
68
+ };
69
+
70
+ const getDataToPopulateWorkspaceLaneIfNeeded = () => {
71
+ if (remoteLane) return new (_bitId().BitIds)(); // if remoteLane, this got created when importing a remote lane
72
+ // when branching from one lane to another, copy components from the origin workspace-lane
73
+ // when branching from main, no need to copy anything
74
+
75
+ const currentWorkspaceLane = consumer.bitMap.workspaceLane;
76
+ return currentWorkspaceLane ? currentWorkspaceLane.ids : new (_bitId().BitIds)();
77
+ };
78
+
79
+ const newLane = remoteLane ? _lane().default.from({
80
+ name: laneName,
81
+ hash: remoteLane.hash().toString(),
82
+ log: remoteLane.log,
83
+ scope: remoteLane.scope
84
+ }) : _lane().default.create(laneName, scopeName);
85
+ const dataToPopulate = await getDataToPopulateLaneObjectIfNeeded();
86
+ newLane.setLaneComponents(dataToPopulate);
87
+ await consumer.scope.lanes.saveLane(newLane);
88
+
89
+ const workspaceConfig = _workspaceLane().default.load(laneName, consumer.scope.getPath());
90
+
91
+ workspaceConfig.ids = getDataToPopulateWorkspaceLaneIfNeeded();
92
+ await workspaceConfig.write();
93
+ return newLane;
94
+ }
95
+
96
+ function throwForInvalidLaneName(laneName) {
97
+ if (!isValidLaneName(laneName)) {
98
+ throw new (_bitError().BitError)(`lane "${laneName}" has invalid characters. lane name can only contain alphanumeric, lowercase characters, and the following ["-", "_", "$", "!"]`);
99
+ }
100
+ }
101
+
102
+ function isValidLaneName(val) {
103
+ if (typeof val !== 'string') return false; // @todo: should we allow slash? if so, we should probably replace the lane-delimiter with something else. (maybe ":")
104
+
105
+ return /^[$\-_!a-z0-9]+$/.test(val);
106
+ }
107
+
108
+ //# sourceMappingURL=create-lane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["create-lane.ts"],"names":["createLane","consumer","laneName","scopeName","remoteLane","lanes","scope","listLanes","find","lane","name","BitError","throwForInvalidLaneName","getDataToPopulateLaneObjectIfNeeded","components","currentLaneObject","getCurrentLaneObject","getDataToPopulateWorkspaceLaneIfNeeded","BitIds","currentWorkspaceLane","bitMap","workspaceLane","ids","newLane","Lane","from","hash","toString","log","create","dataToPopulate","setLaneComponents","saveLane","workspaceConfig","WorkspaceLane","load","getPath","write","isValidLaneName","val","test"],"mappings":";;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,eAAeA,UAAf,CACLC,QADK,EAELC,QAFK,EAGLC,SAHK,EAILC,UAJK,EAKU;AACf,QAAMC,KAAK,GAAG,MAAMJ,QAAQ,CAACK,KAAT,CAAeC,SAAf,EAApB;;AACA,MAAIF,KAAK,CAACG,IAAN,CAAYC,IAAD,IAAUA,IAAI,CAACC,IAAL,KAAcR,QAAnC,CAAJ,EAAkD;AAChD,UAAM,KAAIS,oBAAJ,EAAc,SAAQT,QAAS,2EAA/B,CAAN;AACD;;AACDU,EAAAA,uBAAuB,CAACV,QAAD,CAAvB;;AACA,QAAMW,mCAAmC,GAAG,YAAsC;AAChF,QAAIT,UAAJ,EAAgB,OAAOA,UAAU,CAACU,UAAlB,CADgE,CAEhF;AACA;;AACA,UAAMC,iBAAiB,GAAG,MAAMd,QAAQ,CAACe,oBAAT,EAAhC;AACA,WAAOD,iBAAiB,GAAGA,iBAAiB,CAACD,UAArB,GAAkC,EAA1D;AACD,GAND;;AAOA,QAAMG,sCAAsC,GAAG,MAAc;AAC3D,QAAIb,UAAJ,EAAgB,OAAO,KAAIc,eAAJ,GAAP,CAD2C,CACtB;AACrC;AACA;;AACA,UAAMC,oBAAoB,GAAGlB,QAAQ,CAACmB,M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bit-error';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport Lane, { LaneComponent } from '@teambit/legacy/dist/scope/models/lane';\nimport WorkspaceLane from '@teambit/legacy/dist/consumer/bit-map/workspace-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 const getDataToPopulateWorkspaceLaneIfNeeded = (): BitIds => {\n if (remoteLane) return new BitIds(); // if remoteLane, this got created when importing a remote lane\n // when branching from one lane to another, copy components from the origin workspace-lane\n // when branching from main, no need to copy anything\n const currentWorkspaceLane = consumer.bitMap.workspaceLane;\n return currentWorkspaceLane ? currentWorkspaceLane.ids : new BitIds();\n };\n const newLane = remoteLane\n ? Lane.from({ name: laneName, hash: remoteLane.hash().toString(), log: remoteLane.log, scope: remoteLane.scope })\n : Lane.create(laneName, scopeName);\n const dataToPopulate = await getDataToPopulateLaneObjectIfNeeded();\n newLane.setLaneComponents(dataToPopulate);\n\n await consumer.scope.lanes.saveLane(newLane);\n\n const workspaceConfig = WorkspaceLane.load(laneName, consumer.scope.getPath());\n workspaceConfig.ids = getDataToPopulateWorkspaceLaneIfNeeded();\n await workspaceConfig.write();\n\n return newLane;\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"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LanesAspect } from './lanes.aspect';
2
- export type { LanesMain } from './lanes.main.runtime';
2
+ export type { LanesMain, Lane } from './lanes.main.runtime';
3
3
  export type { LanesUI } from './lanes.ui.runtime';
4
4
  export default LanesAspect;
5
5
  export { LanesAspect };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["LanesAspect"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;eAIeA,oB","sourcesContent":["import { LanesAspect } from './lanes.aspect';\n\nexport type { LanesMain } from './lanes.main.runtime';\nexport type { LanesUI } from './lanes.ui.runtime';\nexport default LanesAspect;\nexport { LanesAspect };\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["LanesAspect"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;eAIeA,oB","sourcesContent":["import { LanesAspect } from './lanes.aspect';\n\nexport type { LanesMain, Lane } from './lanes.main.runtime';\nexport type { LanesUI } from './lanes.ui.runtime';\nexport default LanesAspect;\nexport { LanesAspect };\n"]}
@@ -52,6 +52,7 @@ export declare class LaneCreateCmd implements Command {
52
52
  private lanes;
53
53
  name: string;
54
54
  description: string;
55
+ extendedDescription: string;
55
56
  alias: string;
56
57
  options: CommandOptions;
57
58
  loader: boolean;
@@ -60,17 +61,42 @@ export declare class LaneCreateCmd implements Command {
60
61
  constructor(lanes: LanesMain);
61
62
  report([name]: [string], createLaneOptions: CreateLaneOptions): Promise<string>;
62
63
  }
63
- export declare class LaneTrackCmd implements Command {
64
+ export declare class LaneAliasCmd implements Command {
64
65
  private lanes;
65
66
  name: string;
66
67
  description: string;
68
+ extendedDescription: string;
67
69
  alias: string;
68
70
  options: CommandOptions;
69
71
  loader: boolean;
70
72
  private: boolean;
71
73
  migration: boolean;
72
74
  constructor(lanes: LanesMain);
73
- report([localName, remoteScope, remoteName]: [string, string, string]): Promise<string>;
75
+ report([laneName, alias]: [string, string, string]): Promise<string>;
76
+ }
77
+ export declare class LaneChangeScopeCmd implements Command {
78
+ private lanes;
79
+ name: string;
80
+ description: string;
81
+ alias: string;
82
+ options: CommandOptions;
83
+ loader: boolean;
84
+ private: boolean;
85
+ migration: boolean;
86
+ constructor(lanes: LanesMain);
87
+ report([localName, remoteScope]: [string, string]): Promise<string>;
88
+ }
89
+ export declare class LaneRenameCmd implements Command {
90
+ private lanes;
91
+ name: string;
92
+ description: string;
93
+ alias: string;
94
+ options: CommandOptions;
95
+ loader: boolean;
96
+ private: boolean;
97
+ migration: boolean;
98
+ constructor(lanes: LanesMain);
99
+ report([currentName, newName]: [string, string]): Promise<string>;
74
100
  }
75
101
  export declare class LaneMergeCmd implements Command {
76
102
  private lanes;
package/dist/lane.cmd.js CHANGED
@@ -11,7 +11,7 @@ require("core-js/modules/es.promise.js");
11
11
  Object.defineProperty(exports, "__esModule", {
12
12
  value: true
13
13
  });
14
- exports.LaneTrackCmd = exports.LaneShowCmd = exports.LaneRemoveReadmeCmd = exports.LaneRemoveCmd = exports.LaneMergeCmd = exports.LaneListCmd = exports.LaneImportCmd = exports.LaneCreateCmd = exports.LaneCmd = exports.LaneAddReadmeCmd = void 0;
14
+ exports.LaneShowCmd = exports.LaneRenameCmd = exports.LaneRemoveReadmeCmd = exports.LaneRemoveCmd = exports.LaneMergeCmd = exports.LaneListCmd = exports.LaneImportCmd = exports.LaneCreateCmd = exports.LaneCmd = exports.LaneChangeScopeCmd = exports.LaneAliasCmd = exports.LaneAddReadmeCmd = void 0;
15
15
 
16
16
  function _defineProperty2() {
17
17
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -239,6 +239,8 @@ class LaneShowCmd {
239
239
  }
240
240
 
241
241
  async report([name], laneOptions) {
242
+ var _onlyLane$log, _onlyLane$log2, _onlyLane$log3;
243
+
242
244
  const {
243
245
  remote
244
246
  } = laneOptions;
@@ -248,7 +250,9 @@ class LaneShowCmd {
248
250
  });
249
251
  const onlyLane = lanes[0];
250
252
  const title = `showing information for ${_chalk().default.bold(name)}${outputRemoteLane(onlyLane.remote)}\n`;
251
- return title + outputComponents(onlyLane.components);
253
+ const author = `author: ${((_onlyLane$log = onlyLane.log) === null || _onlyLane$log === void 0 ? void 0 : _onlyLane$log.username) || 'N/A'} <${((_onlyLane$log2 = onlyLane.log) === null || _onlyLane$log2 === void 0 ? void 0 : _onlyLane$log2.email) || 'N/A'}>\n`;
254
+ const date = (_onlyLane$log3 = onlyLane.log) !== null && _onlyLane$log3 !== void 0 && _onlyLane$log3.date ? `${new Date(parseInt(onlyLane.log.date)).toLocaleString()}\n` : undefined;
255
+ return title + author + date + outputComponents(onlyLane.components);
252
256
  }
253
257
 
254
258
  async json([name], laneOptions) {
@@ -271,8 +275,10 @@ class LaneCreateCmd {
271
275
  this.lanes = lanes;
272
276
  (0, _defineProperty2().default)(this, "name", 'create <name>');
273
277
  (0, _defineProperty2().default)(this, "description", `create and switch to a new lane`);
278
+ (0, _defineProperty2().default)(this, "extendedDescription", `a lane created from main (default-lane) is empty until components are snapped.
279
+ a lane created from another lane has all the components of the original lane.`);
274
280
  (0, _defineProperty2().default)(this, "alias", '');
275
- (0, _defineProperty2().default)(this, "options", [['', 'remote-scope <string>', 'remote scope where this lane will be exported to (can be changed later with "bit lane track")'], ['', 'remote-name <string>', 'lane name on the remote, default to the local name (can be changed later with "bit lane track")']]);
281
+ (0, _defineProperty2().default)(this, "options", [['', 'remote-scope <string>', 'remote scope where this lane will be exported to, default to the defaultScope (can be changed later with "bit lane change-scope")'], ['', 'alias <string>', 'a local alias to refer to this lane, default to the <name> (can be added later with "bit lane alias")']]);
276
282
  (0, _defineProperty2().default)(this, "loader", true);
277
283
  (0, _defineProperty2().default)(this, "private", true);
278
284
  (0, _defineProperty2().default)(this, "migration", true);
@@ -292,11 +298,59 @@ class LaneCreateCmd {
292
298
 
293
299
  exports.LaneCreateCmd = LaneCreateCmd;
294
300
 
295
- class LaneTrackCmd {
301
+ class LaneAliasCmd {
302
+ constructor(lanes) {
303
+ this.lanes = lanes;
304
+ (0, _defineProperty2().default)(this, "name", 'alias <lane-name> <alias>');
305
+ (0, _defineProperty2().default)(this, "description", 'add an alias to a lane');
306
+ (0, _defineProperty2().default)(this, "extendedDescription", `an alias is a name that can be used to refer to a lane. it is saved locally and never reach the remote.
307
+ it is useful when having multiple lanes with the same name, but with different remote scopes.`);
308
+ (0, _defineProperty2().default)(this, "alias", '');
309
+ (0, _defineProperty2().default)(this, "options", []);
310
+ (0, _defineProperty2().default)(this, "loader", true);
311
+ (0, _defineProperty2().default)(this, "private", true);
312
+ (0, _defineProperty2().default)(this, "migration", true);
313
+ }
314
+
315
+ async report([laneName, alias]) {
316
+ const {
317
+ laneId
318
+ } = await this.lanes.aliasLane(laneName, alias);
319
+ return `successfully added the alias ${_chalk().default.bold(alias)} to the lane ${_chalk().default.bold(laneId.toString())}`;
320
+ }
321
+
322
+ }
323
+
324
+ exports.LaneAliasCmd = LaneAliasCmd;
325
+
326
+ class LaneChangeScopeCmd {
327
+ constructor(lanes) {
328
+ this.lanes = lanes;
329
+ (0, _defineProperty2().default)(this, "name", 'change-scope <lane-name> <remote-scope>');
330
+ (0, _defineProperty2().default)(this, "description", `change the remote scope of a lane`);
331
+ (0, _defineProperty2().default)(this, "alias", '');
332
+ (0, _defineProperty2().default)(this, "options", []);
333
+ (0, _defineProperty2().default)(this, "loader", true);
334
+ (0, _defineProperty2().default)(this, "private", true);
335
+ (0, _defineProperty2().default)(this, "migration", true);
336
+ }
337
+
338
+ async report([localName, remoteScope]) {
339
+ const {
340
+ remoteScopeBefore
341
+ } = await this.lanes.changeScope(localName, remoteScope);
342
+ return `the remote-scope of ${_chalk().default.bold(localName)} has been changed from ${_chalk().default.bold(remoteScopeBefore)} to ${_chalk().default.bold(remoteScope)}`;
343
+ }
344
+
345
+ }
346
+
347
+ exports.LaneChangeScopeCmd = LaneChangeScopeCmd;
348
+
349
+ class LaneRenameCmd {
296
350
  constructor(lanes) {
297
351
  this.lanes = lanes;
298
- (0, _defineProperty2().default)(this, "name", 'track <local-name> <remote-scope> [remote-name]');
299
- (0, _defineProperty2().default)(this, "description", `change the remote scope or remote lane of the local lane`);
352
+ (0, _defineProperty2().default)(this, "name", 'rename <current-name> <new-name>');
353
+ (0, _defineProperty2().default)(this, "description", `EXPERIMENTAL. change the lane-name locally and on the remote (if exported)`);
300
354
  (0, _defineProperty2().default)(this, "alias", '');
301
355
  (0, _defineProperty2().default)(this, "options", []);
302
356
  (0, _defineProperty2().default)(this, "loader", true);
@@ -304,19 +358,18 @@ class LaneTrackCmd {
304
358
  (0, _defineProperty2().default)(this, "migration", true);
305
359
  }
306
360
 
307
- async report([localName, remoteScope, remoteName]) {
361
+ async report([currentName, newName]) {
308
362
  const {
309
- beforeTrackData,
310
- afterTrackData
311
- } = await this.lanes.trackLane(localName, remoteScope, remoteName);
312
- const remoteScopeChanges = afterTrackData.remoteScope === (beforeTrackData === null || beforeTrackData === void 0 ? void 0 : beforeTrackData.remoteScope) ? `the remote-scope has not been changed` : `the remote-scope has been changed from ${_chalk().default.bold((beforeTrackData === null || beforeTrackData === void 0 ? void 0 : beforeTrackData.remoteScope) || '<n/a>')} to ${_chalk().default.bold(afterTrackData.remoteScope)}`;
313
- const remoteNameChanges = afterTrackData.remoteLane === (beforeTrackData === null || beforeTrackData === void 0 ? void 0 : beforeTrackData.remoteLane) ? `the remote-name has not been changed` : `the remote-name has been changed from ${_chalk().default.bold((beforeTrackData === null || beforeTrackData === void 0 ? void 0 : beforeTrackData.remoteLane) || '<n/a>')} to ${_chalk().default.bold(afterTrackData.remoteLane)}`;
314
- return `${remoteScopeChanges}\n${remoteNameChanges}`;
363
+ exported,
364
+ exportErr
365
+ } = await this.lanes.rename(currentName, newName);
366
+ 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'}`;
367
+ return `the lane ${_chalk().default.bold(currentName)} has been changed to ${_chalk().default.bold(newName)}, ${exportedStr}`;
315
368
  }
316
369
 
317
370
  }
318
371
 
319
- exports.LaneTrackCmd = LaneTrackCmd;
372
+ exports.LaneRenameCmd = LaneRenameCmd;
320
373
 
321
374
  class LaneMergeCmd {
322
375
  constructor(lanes) {
@@ -388,7 +441,7 @@ class LaneRemoveCmd {
388
441
  if (!silent) {
389
442
  const removePromptResult = await (0, _prompts().approveOperation)(); // @ts-ignore
390
443
 
391
- if (!(0, _yn().default)(removePromptResult.shouldRemove)) {
444
+ if (!(0, _yn().default)(removePromptResult.shouldProceed)) {
392
445
  throw new (_bitError().BitError)('the operation has been canceled');
393
446
  }
394
447
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["lane.cmd.ts"],"names":["LaneListCmd","constructor","lanes","workspace","scope","report","args","laneOptions","details","remote","merged","notMerged","getLanes","showDefaultLane","mergedLanes","filter","l","isMerged","length","chalk","green","map","m","name","join","unmergedLanes","currentLane","getCurrentLane","laneDataOfCurrentLane","find","undefined","currentLaneReadmeComponentStr","outputReadmeComponent","readmeComponent","currentLaneStr","remoteOfCurrentLane","currentLaneComponents","outputComponents","components","outputRemoteLane","availableLanes","laneData","readmeComponentStr","laneTitle","bold","concat","outputFooter","footer","outputCurrentLane","outputAvailableLanes","json","LaneShowCmd","onlyLane","title","LaneCreateCmd","createLaneOptions","result","createLane","remoteScopeOrDefaultScope","remoteScope","localLane","remoteScopeOutput","LaneTrackCmd","localName","remoteName","beforeTrackData","afterTrackData","trackLane","remoteScopeChanges","remoteNameChanges","remoteLane","LaneMergeCmd","ours","theirs","manual","build","existing","existingOnWorkspaceOnly","noSnap","message","snapMessage","keepReadme","BUILD_ON_CI","Boolean","mergeStrategy","BitError","mergeResults","deleteResults","mergeLane","mergeResult","deleteResult","localResult","remoteResult","item","readmeResult","yellow","LaneRemoveCmd","names","force","silent","removePromptResult","shouldRemove","laneResults","removeLanes","LaneImportCmd","switchCmd","lane","skipDependencyInstallation","getAll","LaneCmd","docsDomain","description","LaneRemoveReadmeCmd","laneName","removeLaneReadme","red","LaneAddReadmeCmd","componentId","addLaneReadme","componentsTitle","componentsStr","c","id","toString","head","component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAZA;AAwBO,MAAMA,WAAN,CAAqC;AAiB1CC,EAAAA,WAAW,CAASC,KAAT,EAAmCC,SAAnC,EAAiEC,KAAjE,EAAmF;AAAA,SAA1EF,KAA0E,GAA1EA,KAA0E;AAAA,SAAhDC,SAAgD,GAAhDA,SAAgD;AAAA,SAAlBC,KAAkB,GAAlBA,KAAkB;AAAA,kDAhBvF,MAgBuF;AAAA,yDAf/E,YAe+E;AAAA,mDAdtF,EAcsF;AAAA,qDAbpF,CACR,CAAC,GAAD,EAAM,SAAN,EAAiB,+DAAjB,CADQ,EAER,CAAC,GAAD,EAAM,MAAN,EAAc,mCAAd,CAFQ,EAGR,CAAC,GAAD,EAAM,iBAAN,EAAyB,mBAAzB,CAHQ,EAIR,CAAC,EAAD,EAAK,QAAL,EAAe,mBAAf,CAJQ,EAKR,CA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B,EAAsE;AACpE,QAAMiF,eAAe,GAAI,KAAIpG,iBAAMyB,IAAN,CAAY,eAAcN,UAAU,CAACpB,MAAO,GAA5C,CAAgD,IAA7E;AACA,QAAMsG,aAAa,GAAGlF,UAAU,CAACjB,GAAX,CAAgBoG,CAAD,IAAQ,OAAMA,CAAC,CAACC,EAAF,CAAKC,QAAL,EAAgB,MAAKF,CAAC,CAACG,IAAK,EAAzD,EAA4DpG,IAA5D,CAAiE,IAAjE,CAAtB;AACA,SAAO+F,eAAe,GAAGC,aAAzB;AACD;;AAED,SAASxF,qBAAT,CAA+B6F,SAA/B,EAA+E;AAC7E,MAAI,CAACA,SAAL,EAAgB,OAAO,EAAP;AAChB,SAAQ,OAAO,GAAE1G,iBAAM4E,MAAN,CAAa,kBAAb,CAAiC,SAAQ8B,SAAS,CAACH,EAAG,MACrEG,SAAS,CAACD,IAAV,IACC,iCAAgCC,SAAS,CAACH,EAAV,CAAanG,IAAK,8DACpD,EAAE,IAHH;AAID;;AAED,SAASgB,gBAAT,CAA0B+B,UAA1B,EAAyE;AACvE,MAAI,CAACA,UAAL,EAAiB,OAAO,EAAP;AACjB,SAAQ,qBAAoBA,UAAW,GAAvC;AACD","sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport chalk from 'chalk';\nimport yn from 'yn';\nimport { ScopeMain } from '@teambit/scope';\nimport { Workspace } from '@teambit/workspace';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { LaneData } from '@teambit/legacy/dist/scope/lanes/lanes';\nimport { getMergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { mergeReport } from '@teambit/merging';\nimport { BUILD_ON_CI, isFeatureEnabled } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { BitError } from '@teambit/bit-error';\nimport { approveOperation } from '@teambit/legacy/dist/prompts';\nimport paintRemoved from '@teambit/legacy/dist/cli/templates/remove-template';\nimport { CreateLaneOptions, LanesMain } from './lanes.main.runtime';\nimport { SwitchCmd } from './switch.cmd';\n\ntype LaneOptions = {\n details?: boolean;\n remote?: string;\n merged?: boolean;\n notMerged?: boolean;\n json?: boolean;\n};\n\nexport class LaneListCmd implements Command {\n name = 'list';\n description = `list lanes`;\n alias = '';\n options = [\n ['d', 'details', 'show more details on the state of each component in each lane'],\n ['j', 'json', 'show lanes details in json format'],\n ['r', 'remote <string>', 'show remote lanes'],\n ['', 'merged', 'show merged lanes'],\n ['', 'not-merged', 'show not merged lanes'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n remoteOp = true;\n skipWorkspace = true;\n\n constructor(private lanes: LanesMain, private workspace: Workspace, private scope: ScopeMain) {}\n\n async report(args, laneOptions: LaneOptions): Promise<string> {\n const { details, remote, merged, notMerged } = laneOptions;\n\n const lanes = await this.lanes.getLanes({\n remote,\n merged,\n notMerged,\n showDefaultLane: true,\n });\n if (merged) {\n const mergedLanes = lanes.filter((l) => l.isMerged);\n if (!mergedLanes.length) return chalk.green('None of the lanes is merged');\n return chalk.green(mergedLanes.map((m) => m.name).join('\\n'));\n }\n if (notMerged) {\n const unmergedLanes = lanes.filter((l) => !l.isMerged);\n if (!unmergedLanes.length) return chalk.green('All lanes are merged');\n return chalk.green(unmergedLanes.map((m) => m.name).join('\\n'));\n }\n const currentLane = this.lanes.getCurrentLane();\n const laneDataOfCurrentLane = currentLane ? lanes.find((l) => l.name === currentLane) : undefined;\n const currentLaneReadmeComponentStr = outputReadmeComponent(laneDataOfCurrentLane?.readmeComponent);\n let currentLaneStr = currentLane ? `current lane - ${chalk.green.green(currentLane as string)}` : '';\n currentLaneStr += currentLaneReadmeComponentStr;\n\n if (details) {\n const remoteOfCurrentLane = laneDataOfCurrentLane ? laneDataOfCurrentLane.remote : null;\n const currentLaneComponents = laneDataOfCurrentLane ? outputComponents(laneDataOfCurrentLane.components) : '';\n if (currentLaneStr) {\n currentLaneStr += `${outputRemoteLane(remoteOfCurrentLane)}\\n${currentLaneComponents}`;\n }\n }\n\n const availableLanes = lanes\n .filter((l) => l.name !== currentLane)\n // @ts-ignore\n .map((laneData) => {\n const readmeComponentStr = outputReadmeComponent(laneData.readmeComponent);\n if (details) {\n const laneTitle = `> ${chalk.bold(laneData.name)}${outputRemoteLane(laneData.remote)}\\n`;\n const components = outputComponents(laneData.components);\n return laneTitle + readmeComponentStr.concat('\\n') + components;\n }\n return ` > ${chalk.green(laneData.name)} (${laneData.components.length} components)${readmeComponentStr}`;\n })\n .join('\\n');\n\n const outputFooter = () => {\n let footer = '\\n';\n if (details) {\n footer += 'You can use --merged and --not-merged to see which of the lanes is fully merged.';\n } else {\n footer +=\n \"to get more info on all lanes in workspace use 'bit lane list --details' or 'bit lane show <lane-name>' for a specific lane.\";\n }\n if (!remote && this.workspace) footer += `\\nswitch lanes using 'bit switch <name>'.`;\n\n return footer;\n };\n\n return outputCurrentLane() + outputAvailableLanes() + outputFooter();\n\n function outputCurrentLane() {\n return currentLaneStr ? `${currentLaneStr}\\n` : '';\n }\n\n function outputAvailableLanes() {\n if (!availableLanes) return '';\n return remote ? `${availableLanes}\\n` : `\\nAvailable lanes:\\n${availableLanes}\\n`;\n }\n }\n async json(args, laneOptions: LaneOptions) {\n const { remote, merged = false, notMerged = false } = laneOptions;\n\n const lanes = await this.lanes.getLanes({\n remote,\n showDefaultLane: true,\n merged,\n notMerged,\n });\n const currentLane = this.lanes.getCurrentLane();\n return { lanes, currentLane };\n }\n}\n\nexport class LaneShowCmd implements Command {\n name = 'show <name>';\n description = `show lane details`;\n alias = '';\n options = [\n ['j', 'json', 'show the lane details in json format'],\n ['r', 'remote <string>', 'show remote lanes'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n remoteOp = true;\n skipWorkspace = true;\n\n constructor(private lanes: LanesMain, private workspace: Workspace, private scope: ScopeMain) {}\n\n async report([name]: [string], laneOptions: LaneOptions): Promise<string> {\n const { remote } = laneOptions;\n\n const lanes = await this.lanes.getLanes({\n name,\n remote,\n });\n\n const onlyLane = lanes[0];\n const title = `showing information for ${chalk.bold(name)}${outputRemoteLane(onlyLane.remote)}\\n`;\n return title + outputComponents(onlyLane.components);\n }\n\n async json([name]: [string], laneOptions: LaneOptions) {\n const { remote } = laneOptions;\n\n const lanes = await this.lanes.getLanes({\n name,\n remote,\n });\n return lanes[0];\n }\n}\n\nexport class LaneCreateCmd implements Command {\n name = 'create <name>';\n description = `create and switch to a new lane`;\n alias = '';\n options = [\n [\n '',\n 'remote-scope <string>',\n 'remote scope where this lane will be exported to (can be changed later with \"bit lane track\")',\n ],\n [\n '',\n 'remote-name <string>',\n 'lane name on the remote, default to the local name (can be changed later with \"bit lane track\")',\n ],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report([name]: [string], createLaneOptions: CreateLaneOptions): Promise<string> {\n const result = await this.lanes.createLane(name, createLaneOptions);\n const remoteScopeOrDefaultScope = createLaneOptions.remoteScope\n ? `the remote scope ${chalk.bold(createLaneOptions.remoteScope)}`\n : `the default-scope ${chalk.bold(result.remoteScope)}. to change it, please run \"bit lane track\" command`;\n const title = chalk.green(`successfully added and checked out to a new lane ${chalk.bold(result.localLane)}`);\n const remoteScopeOutput = `this lane will be exported to ${remoteScopeOrDefaultScope}`;\n return `${title}\\n${remoteScopeOutput}`;\n }\n}\n\nexport class LaneTrackCmd implements Command {\n name = 'track <local-name> <remote-scope> [remote-name]';\n description = `change the remote scope or remote lane of the local lane`;\n alias = '';\n options = [] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report([localName, remoteScope, remoteName]: [string, string, string]): Promise<string> {\n const { beforeTrackData, afterTrackData } = await this.lanes.trackLane(localName, remoteScope, remoteName);\n const remoteScopeChanges =\n afterTrackData.remoteScope === beforeTrackData?.remoteScope\n ? `the remote-scope has not been changed`\n : `the remote-scope has been changed from ${chalk.bold(\n beforeTrackData?.remoteScope || '<n/a>'\n )} to ${chalk.bold(afterTrackData.remoteScope)}`;\n const remoteNameChanges =\n afterTrackData.remoteLane === beforeTrackData?.remoteLane\n ? `the remote-name has not been changed`\n : `the remote-name has been changed from ${chalk.bold(beforeTrackData?.remoteLane || '<n/a>')} to ${chalk.bold(\n afterTrackData.remoteLane\n )}`;\n\n return `${remoteScopeChanges}\\n${remoteNameChanges}`;\n }\n}\n\nexport class LaneMergeCmd implements Command {\n name = 'merge <lane>';\n description = `merge a local or a remote lane`;\n alias = '';\n options = [\n ['', 'remote <name>', 'remote scope name'],\n ['', 'ours', 'in case of a conflict, override the used version with the current modification'],\n ['', 'theirs', 'in case of a conflict, override the current modification with the specified version'],\n ['', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'],\n ['', 'existing', 'checkout only components in a lane that exist in the workspace'],\n ['', 'no-snap', 'do not auto snap in case the merge completed without conflicts'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['m', 'message <message>', 'override the default message for the auto snap'],\n ['', 'keep-readme', 'skip deleting the lane readme component after merging'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n remoteOp = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report(\n [name]: [string],\n {\n ours = false,\n theirs = false,\n manual = false,\n remote: remoteName,\n build,\n existing: existingOnWorkspaceOnly = false,\n noSnap = false,\n message: snapMessage = '',\n keepReadme = false,\n }: {\n ours: boolean;\n theirs: boolean;\n manual: boolean;\n remote?: string;\n existing?: boolean;\n build?: boolean;\n noSnap: boolean;\n message: string;\n keepReadme?: boolean;\n }\n ): Promise<string> {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const mergeStrategy = getMergeStrategy(ours, theirs, manual);\n if (noSnap && snapMessage) throw new BitError('unable to use \"noSnap\" and \"message\" flags together');\n\n const { mergeResults, deleteResults } = await this.lanes.mergeLane(name, {\n // @ts-ignore\n remoteName,\n build,\n // @ts-ignore\n mergeStrategy,\n existingOnWorkspaceOnly,\n noSnap,\n snapMessage,\n keepReadme,\n });\n\n const mergeResult = `${mergeReport(mergeResults)}`;\n const deleteResult = `${deleteResults.localResult ? paintRemoved(deleteResults.localResult, false) : ''}${(\n deleteResults.remoteResult || []\n ).map((item) => paintRemoved(item, true))}${\n (deleteResults.readmeResult && chalk.yellow(deleteResults.readmeResult)) || ''\n }\\n`;\n return mergeResult + deleteResult;\n }\n}\n\nexport class LaneRemoveCmd implements Command {\n name = 'remove <lane...>';\n description = `remove lanes`;\n alias = '';\n options = [\n ['r', 'remote', 'remove a remote lane (in the lane arg, use remote/lane-id syntax)'],\n [\n 'f',\n 'force',\n 'removes the component from the scope, even if used as a dependency. WARNING: components that depend on this component will corrupt',\n ],\n ['s', 'silent', 'skip confirmation'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report(\n [names]: [string[]],\n {\n remote = false,\n force = false,\n silent = false,\n }: {\n remote: boolean;\n force: boolean;\n silent: boolean;\n }\n ): Promise<string> {\n if (!silent) {\n const removePromptResult = await approveOperation();\n // @ts-ignore\n if (!yn(removePromptResult.shouldRemove)) {\n throw new BitError('the operation has been canceled');\n }\n }\n const laneResults = await this.lanes.removeLanes(names, { remote, force });\n return chalk.green(`successfully removed the following lane(s): ${chalk.bold(laneResults.join(', '))}`);\n }\n}\n\nexport class LaneImportCmd implements Command {\n name = 'import <lane>';\n description = `import a remote lane to your workspace`;\n alias = '';\n options = [\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private switchCmd: SwitchCmd) {}\n\n async report(\n [lane]: [string],\n { skipDependencyInstallation = false }: { skipDependencyInstallation: boolean }\n ): Promise<string> {\n return this.switchCmd.report([lane], { getAll: true, skipDependencyInstallation });\n }\n}\n\nexport class LaneCmd implements Command {\n name = 'lane [name]';\n shortDescription = 'show lanes details';\n description: string;\n alias = '';\n options = [\n ['d', 'details', 'show more details on the state of each component in each lane'],\n ['j', 'json', 'show lanes details in json format'],\n ['r', 'remote <string>', 'show remote lanes'],\n ['', 'merged', 'show merged lanes'],\n ['', 'not-merged', 'show not merged lanes'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n remoteOp = true;\n skipWorkspace = true;\n commands: Command[] = [];\n\n constructor(private lanes: LanesMain, private workspace: Workspace, private scope: ScopeMain, docsDomain: string) {\n this.description = `show lanes details\nhttps://${docsDomain}/components/lanes`;\n }\n\n async report([name]: [string], laneOptions: LaneOptions): Promise<string> {\n return new LaneListCmd(this.lanes, this.workspace, this.scope).report([name], laneOptions);\n }\n}\n\nexport class LaneRemoveReadmeCmd implements Command {\n name = 'remove-readme [laneName]';\n description = 'EXPERIMENTAL. remove lane readme component';\n options = [] as CommandOptions;\n loader = true;\n private = true;\n skipWorkspace = false;\n\n constructor(private lanes: LanesMain) {}\n\n async report([laneName]: [string]): Promise<string> {\n const { result, message } = await this.lanes.removeLaneReadme(laneName);\n\n if (result) {\n return chalk.green(\n `the readme component has been successfully removed from the lane ${laneName || this.lanes.getCurrentLane()}`\n );\n }\n\n return chalk.red(`${message}\\n`);\n }\n}\n\nexport class LaneAddReadmeCmd implements Command {\n name = 'add-readme <componentId> [laneName]';\n description = 'EXPERIMENTAL. add lane readme component';\n options = [] as CommandOptions;\n loader = true;\n private = true;\n skipWorkspace = false;\n\n constructor(private lanes: LanesMain) {}\n\n async report([componentId, laneName]: [string, string]): Promise<string> {\n const { result, message } = await this.lanes.addLaneReadme(componentId, laneName);\n\n if (result)\n return chalk.green(\n `the component ${componentId} has been successfully added as the readme component for the lane ${\n laneName || this.lanes.getCurrentLane()\n }`\n );\n\n return chalk.red(\n `${message || ''}\\nthe component ${componentId} could not be added as a readme component for the lane ${\n laneName || this.lanes.getCurrentLane()\n }`\n );\n }\n}\n\nfunction outputComponents(components: LaneData['components']): string {\n const componentsTitle = `\\t${chalk.bold(`components (${components.length})`)}\\n`;\n const componentsStr = components.map((c) => `\\t ${c.id.toString()} - ${c.head}`).join('\\n');\n return componentsTitle + componentsStr;\n}\n\nfunction outputReadmeComponent(component: LaneData['readmeComponent']): string {\n if (!component) return '';\n return `\\n\\t${`${chalk.yellow('readme component')}\\n\\t ${component.id} - ${\n component.head ||\n `(unsnapped)\\n\\t(\"use bit snap ${component.id.name}\" to snap the readme component on the lane before exporting)`\n }`}\\n`;\n}\n\nfunction outputRemoteLane(remoteLane: string | null | undefined): string {\n if (!remoteLane) return '';\n return ` - (remote lane - ${remoteLane})`;\n}\n"]}
1
+ {"version":3,"sources":["lane.cmd.ts"],"names":["LaneListCmd","constructor","lanes","workspace","scope","report","args","laneOptions","details","remote","merged","notMerged","getLanes","showDefaultLane","mergedLanes","filter","l","isMerged","length","chalk","green","map","m","name","join","unmergedLanes","currentLane","getCurrentLane","laneDataOfCurrentLane","find","undefined","currentLaneReadmeComponentStr","outputReadmeComponent","readmeComponent","currentLaneStr","remoteOfCurrentLane","currentLaneComponents","outputComponents","components","outputRemoteLane","availableLanes","laneData","readmeComponentStr","laneTitle","bold","concat","outputFooter","footer","outputCurrentLane","outputAvailableLanes","json","LaneShowCmd","onlyLane","title","author","log","username","email","date","Date","parseInt","toLocaleString","LaneCreateCmd","createLaneOptions","result","createLane","remoteScopeOrDefaultScope","remoteScope","localLane","remoteScopeOutput","LaneAliasCmd","laneName","alias","laneId","aliasLane","toString","LaneChangeScopeCmd","localName","remoteScopeBefore","changeScope","LaneRenameCmd","currentName","newName","exported","exportErr","rename","exportedStr","message","LaneMergeCmd","ours","theirs","manual","remoteName","build","existing","existingOnWorkspaceOnly","noSnap","snapMessage","keepReadme","BUILD_ON_CI","Boolean","mergeStrategy","BitError","mergeResults","deleteResults","mergeLane","mergeResult","deleteResult","localResult","remoteResult","item","readmeResult","yellow","LaneRemoveCmd","names","force","silent","removePromptResult","shouldProceed","laneResults","removeLanes","LaneImportCmd","switchCmd","lane","skipDependencyInstallation","getAll","LaneCmd","docsDomain","description","LaneRemoveReadmeCmd","removeLaneReadme","red","LaneAddReadmeCmd","componentId","addLaneRead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A5D,CAAiE,IAAjE,CAAtB;AACA,SAAO+G,eAAe,GAAGC,aAAzB;AACD;;AAED,SAASxG,qBAAT,CAA+B4G,SAA/B,EAA+E;AAC7E,MAAI,CAACA,SAAL,EAAgB,OAAO,EAAP;AAChB,SAAQ,OAAO,GAAEzH,iBAAM6F,MAAN,CAAa,kBAAb,CAAiC,SAAQ4B,SAAS,CAACF,EAAG,MACrEE,SAAS,CAACD,IAAV,IACC,iCAAgCC,SAAS,CAACF,EAAV,CAAanH,IAAK,8DACpD,EAAE,IAHH;AAID;;AAED,SAASgB,gBAAT,CAA0BsG,UAA1B,EAAyE;AACvE,MAAI,CAACA,UAAL,EAAiB,OAAO,EAAP;AACjB,SAAQ,qBAAoBA,UAAW,GAAvC;AACD","sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport chalk from 'chalk';\nimport yn from 'yn';\nimport { ScopeMain } from '@teambit/scope';\nimport { Workspace } from '@teambit/workspace';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { LaneData } from '@teambit/legacy/dist/scope/lanes/lanes';\nimport { getMergeStrategy } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';\nimport { mergeReport } from '@teambit/merging';\nimport { BUILD_ON_CI, isFeatureEnabled } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle';\nimport { BitError } from '@teambit/bit-error';\nimport { approveOperation } from '@teambit/legacy/dist/prompts';\nimport paintRemoved from '@teambit/legacy/dist/cli/templates/remove-template';\nimport { CreateLaneOptions, LanesMain } from './lanes.main.runtime';\nimport { SwitchCmd } from './switch.cmd';\n\ntype LaneOptions = {\n details?: boolean;\n remote?: string;\n merged?: boolean;\n notMerged?: boolean;\n json?: boolean;\n};\n\nexport class LaneListCmd implements Command {\n name = 'list';\n description = `list lanes`;\n alias = '';\n options = [\n ['d', 'details', 'show more details on the state of each component in each lane'],\n ['j', 'json', 'show lanes details in json format'],\n ['r', 'remote <string>', 'show remote lanes'],\n ['', 'merged', 'show merged lanes'],\n ['', 'not-merged', 'show not merged lanes'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n remoteOp = true;\n skipWorkspace = true;\n\n constructor(private lanes: LanesMain, private workspace: Workspace, private scope: ScopeMain) {}\n\n async report(args, laneOptions: LaneOptions): Promise<string> {\n const { details, remote, merged, notMerged } = laneOptions;\n\n const lanes = await this.lanes.getLanes({\n remote,\n merged,\n notMerged,\n showDefaultLane: true,\n });\n if (merged) {\n const mergedLanes = lanes.filter((l) => l.isMerged);\n if (!mergedLanes.length) return chalk.green('None of the lanes is merged');\n return chalk.green(mergedLanes.map((m) => m.name).join('\\n'));\n }\n if (notMerged) {\n const unmergedLanes = lanes.filter((l) => !l.isMerged);\n if (!unmergedLanes.length) return chalk.green('All lanes are merged');\n return chalk.green(unmergedLanes.map((m) => m.name).join('\\n'));\n }\n const currentLane = this.lanes.getCurrentLane();\n const laneDataOfCurrentLane = currentLane ? lanes.find((l) => l.name === currentLane) : undefined;\n const currentLaneReadmeComponentStr = outputReadmeComponent(laneDataOfCurrentLane?.readmeComponent);\n let currentLaneStr = currentLane ? `current lane - ${chalk.green.green(currentLane as string)}` : '';\n currentLaneStr += currentLaneReadmeComponentStr;\n\n if (details) {\n const remoteOfCurrentLane = laneDataOfCurrentLane ? laneDataOfCurrentLane.remote : null;\n const currentLaneComponents = laneDataOfCurrentLane ? outputComponents(laneDataOfCurrentLane.components) : '';\n if (currentLaneStr) {\n currentLaneStr += `${outputRemoteLane(remoteOfCurrentLane)}\\n${currentLaneComponents}`;\n }\n }\n\n const availableLanes = lanes\n .filter((l) => l.name !== currentLane)\n // @ts-ignore\n .map((laneData) => {\n const readmeComponentStr = outputReadmeComponent(laneData.readmeComponent);\n if (details) {\n const laneTitle = `> ${chalk.bold(laneData.name)}${outputRemoteLane(laneData.remote)}\\n`;\n const components = outputComponents(laneData.components);\n return laneTitle + readmeComponentStr.concat('\\n') + components;\n }\n return ` > ${chalk.green(laneData.name)} (${laneData.components.length} components)${readmeComponentStr}`;\n })\n .join('\\n');\n\n const outputFooter = () => {\n let footer = '\\n';\n if (details) {\n footer += 'You can use --merged and --not-merged to see which of the lanes is fully merged.';\n } else {\n footer +=\n \"to get more info on all lanes in workspace use 'bit lane list --details' or 'bit lane show <lane-name>' for a specific lane.\";\n }\n if (!remote && this.workspace) footer += `\\nswitch lanes using 'bit switch <name>'.`;\n\n return footer;\n };\n\n return outputCurrentLane() + outputAvailableLanes() + outputFooter();\n\n function outputCurrentLane() {\n return currentLaneStr ? `${currentLaneStr}\\n` : '';\n }\n\n function outputAvailableLanes() {\n if (!availableLanes) return '';\n return remote ? `${availableLanes}\\n` : `\\nAvailable lanes:\\n${availableLanes}\\n`;\n }\n }\n async json(args, laneOptions: LaneOptions) {\n const { remote, merged = false, notMerged = false } = laneOptions;\n\n const lanes = await this.lanes.getLanes({\n remote,\n showDefaultLane: true,\n merged,\n notMerged,\n });\n const currentLane = this.lanes.getCurrentLane();\n return { lanes, currentLane };\n }\n}\n\nexport class LaneShowCmd implements Command {\n name = 'show <name>';\n description = `show lane details`;\n alias = '';\n options = [\n ['j', 'json', 'show the lane details in json format'],\n ['r', 'remote <string>', 'show remote lanes'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n remoteOp = true;\n skipWorkspace = true;\n\n constructor(private lanes: LanesMain, private workspace: Workspace, private scope: ScopeMain) {}\n\n async report([name]: [string], laneOptions: LaneOptions): Promise<string> {\n const { remote } = laneOptions;\n\n const lanes = await this.lanes.getLanes({\n name,\n remote,\n });\n\n const onlyLane = lanes[0];\n const title = `showing information for ${chalk.bold(name)}${outputRemoteLane(onlyLane.remote)}\\n`;\n const author = `author: ${onlyLane.log?.username || 'N/A'} <${onlyLane.log?.email || 'N/A'}>\\n`;\n const date = onlyLane.log?.date ? `${new Date(parseInt(onlyLane.log.date)).toLocaleString()}\\n` : undefined;\n return title + author + date + outputComponents(onlyLane.components);\n }\n\n async json([name]: [string], laneOptions: LaneOptions) {\n const { remote } = laneOptions;\n\n const lanes = await this.lanes.getLanes({\n name,\n remote,\n });\n return lanes[0];\n }\n}\n\nexport class LaneCreateCmd implements Command {\n name = 'create <name>';\n description = `create and switch to a new lane`;\n extendedDescription = `a lane created from main (default-lane) is empty until components are snapped.\na lane created from another lane has all the components of the original lane.`;\n alias = '';\n options = [\n [\n '',\n 'remote-scope <string>',\n 'remote scope where this lane will be exported to, default to the defaultScope (can be changed later with \"bit lane change-scope\")',\n ],\n [\n '',\n 'alias <string>',\n 'a local alias to refer to this lane, default to the <name> (can be added later with \"bit lane alias\")',\n ],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report([name]: [string], createLaneOptions: CreateLaneOptions): Promise<string> {\n const result = await this.lanes.createLane(name, createLaneOptions);\n const remoteScopeOrDefaultScope = createLaneOptions.remoteScope\n ? `the remote scope ${chalk.bold(createLaneOptions.remoteScope)}`\n : `the default-scope ${chalk.bold(result.remoteScope)}. to change it, please run \"bit lane track\" command`;\n const title = chalk.green(`successfully added and checked out to a new lane ${chalk.bold(result.localLane)}`);\n const remoteScopeOutput = `this lane will be exported to ${remoteScopeOrDefaultScope}`;\n return `${title}\\n${remoteScopeOutput}`;\n }\n}\n\nexport class LaneAliasCmd implements Command {\n name = 'alias <lane-name> <alias>';\n description = 'add an alias to a lane';\n extendedDescription = `an alias is a name that can be used to refer to a lane. it is saved locally and never reach the remote.\nit is useful when having multiple lanes with the same name, but with different remote scopes.`;\n alias = '';\n options = [] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report([laneName, alias]: [string, string, string]): Promise<string> {\n const { laneId } = await this.lanes.aliasLane(laneName, alias);\n return `successfully added the alias ${chalk.bold(alias)} to the lane ${chalk.bold(laneId.toString())}`;\n }\n}\n\nexport class LaneChangeScopeCmd implements Command {\n name = 'change-scope <lane-name> <remote-scope>';\n description = `change the remote scope of a lane`;\n alias = '';\n options = [] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report([localName, remoteScope]: [string, string]): Promise<string> {\n const { remoteScopeBefore } = await this.lanes.changeScope(localName, remoteScope);\n return `the remote-scope of ${chalk.bold(localName)} has been changed from ${chalk.bold(\n remoteScopeBefore\n )} to ${chalk.bold(remoteScope)}`;\n }\n}\n\nexport class LaneRenameCmd implements Command {\n name = 'rename <current-name> <new-name>';\n description = `EXPERIMENTAL. change the lane-name locally and on the remote (if exported)`;\n alias = '';\n options = [] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report([currentName, newName]: [string, string]): Promise<string> {\n const { exported, exportErr } = await this.lanes.rename(currentName, newName);\n const exportedStr = exported\n ? `and have been exported successfully to the remote`\n : `however if failed to export the renamed lane to the remote, due to an error: ${\n exportErr?.message || 'unknown'\n }`;\n return `the lane ${chalk.bold(currentName)} has been changed to ${chalk.bold(newName)}, ${exportedStr}`;\n }\n}\n\nexport class LaneMergeCmd implements Command {\n name = 'merge <lane>';\n description = `merge a local or a remote lane`;\n alias = '';\n options = [\n ['', 'remote <name>', 'remote scope name'],\n ['', 'ours', 'in case of a conflict, override the used version with the current modification'],\n ['', 'theirs', 'in case of a conflict, override the current modification with the specified version'],\n ['', 'manual', 'in case of a conflict, leave the files with a conflict state to resolve them manually later'],\n ['', 'existing', 'checkout only components in a lane that exist in the workspace'],\n ['', 'no-snap', 'do not auto snap in case the merge completed without conflicts'],\n ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'],\n ['m', 'message <message>', 'override the default message for the auto snap'],\n ['', 'keep-readme', 'skip deleting the lane readme component after merging'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n remoteOp = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report(\n [name]: [string],\n {\n ours = false,\n theirs = false,\n manual = false,\n remote: remoteName,\n build,\n existing: existingOnWorkspaceOnly = false,\n noSnap = false,\n message: snapMessage = '',\n keepReadme = false,\n }: {\n ours: boolean;\n theirs: boolean;\n manual: boolean;\n remote?: string;\n existing?: boolean;\n build?: boolean;\n noSnap: boolean;\n message: string;\n keepReadme?: boolean;\n }\n ): Promise<string> {\n build = isFeatureEnabled(BUILD_ON_CI) ? Boolean(build) : true;\n const mergeStrategy = getMergeStrategy(ours, theirs, manual);\n if (noSnap && snapMessage) throw new BitError('unable to use \"noSnap\" and \"message\" flags together');\n\n const { mergeResults, deleteResults } = await this.lanes.mergeLane(name, {\n // @ts-ignore\n remoteName,\n build,\n // @ts-ignore\n mergeStrategy,\n existingOnWorkspaceOnly,\n noSnap,\n snapMessage,\n keepReadme,\n });\n\n const mergeResult = `${mergeReport(mergeResults)}`;\n const deleteResult = `${deleteResults.localResult ? paintRemoved(deleteResults.localResult, false) : ''}${(\n deleteResults.remoteResult || []\n ).map((item) => paintRemoved(item, true))}${\n (deleteResults.readmeResult && chalk.yellow(deleteResults.readmeResult)) || ''\n }\\n`;\n return mergeResult + deleteResult;\n }\n}\n\nexport class LaneRemoveCmd implements Command {\n name = 'remove <lane...>';\n description = `remove lanes`;\n alias = '';\n options = [\n ['r', 'remote', 'remove a remote lane (in the lane arg, use remote/lane-id syntax)'],\n [\n 'f',\n 'force',\n 'removes the component from the scope, even if used as a dependency. WARNING: components that depend on this component will corrupt',\n ],\n ['s', 'silent', 'skip confirmation'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private lanes: LanesMain) {}\n\n async report(\n [names]: [string[]],\n {\n remote = false,\n force = false,\n silent = false,\n }: {\n remote: boolean;\n force: boolean;\n silent: boolean;\n }\n ): Promise<string> {\n if (!silent) {\n const removePromptResult = await approveOperation();\n // @ts-ignore\n if (!yn(removePromptResult.shouldProceed)) {\n throw new BitError('the operation has been canceled');\n }\n }\n const laneResults = await this.lanes.removeLanes(names, { remote, force });\n return chalk.green(`successfully removed the following lane(s): ${chalk.bold(laneResults.join(', '))}`);\n }\n}\n\nexport class LaneImportCmd implements Command {\n name = 'import <lane>';\n description = `import a remote lane to your workspace`;\n alias = '';\n options = [\n ['', 'skip-dependency-installation', 'do not install packages of the imported components'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n\n constructor(private switchCmd: SwitchCmd) {}\n\n async report(\n [lane]: [string],\n { skipDependencyInstallation = false }: { skipDependencyInstallation: boolean }\n ): Promise<string> {\n return this.switchCmd.report([lane], { getAll: true, skipDependencyInstallation });\n }\n}\n\nexport class LaneCmd implements Command {\n name = 'lane [name]';\n shortDescription = 'show lanes details';\n description: string;\n alias = '';\n options = [\n ['d', 'details', 'show more details on the state of each component in each lane'],\n ['j', 'json', 'show lanes details in json format'],\n ['r', 'remote <string>', 'show remote lanes'],\n ['', 'merged', 'show merged lanes'],\n ['', 'not-merged', 'show not merged lanes'],\n ] as CommandOptions;\n loader = true;\n private = true;\n migration = true;\n remoteOp = true;\n skipWorkspace = true;\n commands: Command[] = [];\n\n constructor(private lanes: LanesMain, private workspace: Workspace, private scope: ScopeMain, docsDomain: string) {\n this.description = `show lanes details\nhttps://${docsDomain}/components/lanes`;\n }\n\n async report([name]: [string], laneOptions: LaneOptions): Promise<string> {\n return new LaneListCmd(this.lanes, this.workspace, this.scope).report([name], laneOptions);\n }\n}\n\nexport class LaneRemoveReadmeCmd implements Command {\n name = 'remove-readme [laneName]';\n description = 'EXPERIMENTAL. remove lane readme component';\n options = [] as CommandOptions;\n loader = true;\n private = true;\n skipWorkspace = false;\n\n constructor(private lanes: LanesMain) {}\n\n async report([laneName]: [string]): Promise<string> {\n const { result, message } = await this.lanes.removeLaneReadme(laneName);\n\n if (result) {\n return chalk.green(\n `the readme component has been successfully removed from the lane ${laneName || this.lanes.getCurrentLane()}`\n );\n }\n\n return chalk.red(`${message}\\n`);\n }\n}\n\nexport class LaneAddReadmeCmd implements Command {\n name = 'add-readme <componentId> [laneName]';\n description = 'EXPERIMENTAL. add lane readme component';\n options = [] as CommandOptions;\n loader = true;\n private = true;\n skipWorkspace = false;\n\n constructor(private lanes: LanesMain) {}\n\n async report([componentId, laneName]: [string, string]): Promise<string> {\n const { result, message } = await this.lanes.addLaneReadme(componentId, laneName);\n\n if (result)\n return chalk.green(\n `the component ${componentId} has been successfully added as the readme component for the lane ${\n laneName || this.lanes.getCurrentLane()\n }`\n );\n\n return chalk.red(\n `${message || ''}\\nthe component ${componentId} could not be added as a readme component for the lane ${\n laneName || this.lanes.getCurrentLane()\n }`\n );\n }\n}\n\nfunction outputComponents(components: LaneData['components']): string {\n const componentsTitle = `\\t${chalk.bold(`components (${components.length})`)}\\n`;\n const componentsStr = components.map((c) => `\\t ${c.id.toString()} - ${c.head}`).join('\\n');\n return componentsTitle + componentsStr;\n}\n\nfunction outputReadmeComponent(component: LaneData['readmeComponent']): string {\n if (!component) return '';\n return `\\n\\t${`${chalk.yellow('readme component')}\\n\\t ${component.id} - ${\n component.head ||\n `(unsnapped)\\n\\t(\"use bit snap ${component.id.name}\" to snap the readme component on the lane before exporting)`\n }`}\\n`;\n}\n\nfunction outputRemoteLane(remoteLane: string | null | undefined): string {\n if (!remoteLane) return '';\n return ` - (remote lane - ${remoteLane})`;\n}\n"]}
@@ -11,16 +11,16 @@ The following describes the final implementation, which differs from the specifi
11
11
 
12
12
  ```
13
13
  - create a snap: `bit snap` (synopsis similar to the `bit tag`)
14
- - create a new lane: `bit lane create <name> --test`
14
+ - create a new lane: `bit lane create <name>`
15
15
  - list lanes: `bit lane list`
16
16
  - switch between lanes: `bit switch <name>`
17
17
  - merge lanes: `bit lane merge`
18
18
  - show lane details: `bit lane show <name>`
19
19
  - diff between lanes: `bit lane diff <values>`
20
20
  - track local lane to a remote lane: `bit switch --as`
21
- - remove a lane `bit lane remove <name>`.
21
+ - remove a lane: `bit lane remove <name>`.
22
22
  - fetch lane objects (without the components): `bit fetch --lanes`
23
- - import a lane: `bit switch <name> --remote`
23
+ - import a lane: `bit lane import`
24
24
  - export current lane: `bit export`
25
25
  - (internal) cat lane object: `bit cat-lane <name>`
26
26
  ```
@@ -31,12 +31,17 @@ The following describes the final implementation, which differs from the specifi
31
31
  - [ ] Bit import with no args. When bitmap has a remote lane, should import the lane.
32
32
  - [ ] Tag dependencies to include them in a lane.
33
33
  - [ ] Test bit-fetch components
34
- - [ ] Rename lanes.
34
+ - [ ] Rename lanes: enable importing a lane after rename.
35
35
  - [ ] Fix performance issue. Now it fetches all parents every time. It doesn't make sense.
36
36
  - [ ] Fix performance issue. Now it traverses all parents to see if a hash in there.
37
37
 
38
38
  ## Important points
39
39
 
40
+ ### Lane ID
41
+
42
+ The Lane id consists of the lane name and the scope. If this is a new lane, the scope is the defaultScope.
43
+ The `LaneId` _always_ has these two props.
44
+
40
45
  ### Performance consideration
41
46
 
42
47
  Currently, if it imports with no-deps, it doesn't ask for parents, if it imports with deps it imports with all parents. It is originated from src/api/scope/lib/fetch.ts: `const collectParents = !noDependencies;`. We need to make a decision here.
@@ -51,6 +56,7 @@ Currently, if it imports with no-deps, it doesn't ask for parents, if it imports
51
56
  - Snap's hash is generated by a UUID and then converted into sha1. `sha1(v4())`.
52
57
  - Lane's hash is generated by a UUID and then converted into sha1. `sha1(v4())`.
53
58
  - Tag's hash stays the same. Generated by the `Version.id()`.
59
+ - Lane's hash doesn't get changed even if the lane has been renamed or its scope changed.
54
60
 
55
61
  ### Lane Data
56
62
 
@@ -85,3 +91,9 @@ Summary of when/what lanes data is saved per command:
85
91
  ### Useful APIs
86
92
 
87
93
  - bit-map `getAllIdsAvailableOnLane()` filters the currently checked out lane.
94
+
95
+ ### Remove component from a lane
96
+
97
+ Locally, to remove a component from a lane, use `bit remove` command. It will remove the component from the local lane-object.
98
+ This change won't affect the remote scope, even after exporting the lane. This is becuase on the remote, the merge-lane process doesn't remove anything, only adds/changes components to the lane object.
99
+ Remember that by default when importing a lane, only the components on the workspace are part of the lane, so the same lane-object, locally can have less components than the remote and obviously in this case we don't want to remove them from the remote on export.
@@ -3,13 +3,16 @@ import { ScopeMain } from '@teambit/scope';
3
3
  import { GraphqlMain } from '@teambit/graphql';
4
4
  import { Workspace } from '@teambit/workspace';
5
5
  import { LaneData } from '@teambit/legacy/dist/scope/lanes/lanes';
6
+ import { LaneId } from '@teambit/lane-id';
6
7
  import { Logger, LoggerMain } from '@teambit/logger';
7
8
  import { DiffOptions } from '@teambit/legacy/dist/consumer/component-ops/components-diff';
8
9
  import { MergeStrategy, ApplyVersionResults } from '@teambit/legacy/dist/consumer/versions-ops/merge-version';
9
10
  import { TrackLane } from '@teambit/legacy/dist/scope/scope-json';
10
11
  import type { CommunityMain } from '@teambit/community';
11
12
  import { Component, ComponentMain } from '@teambit/component';
13
+ import { Lane } from '@teambit/legacy/dist/scope/models';
12
14
  import { MergingMain } from '@teambit/merging';
15
+ export { Lane };
13
16
  export declare type LaneResults = {
14
17
  lanes: LaneData[];
15
18
  currentLane?: string | null;
@@ -25,10 +28,10 @@ export declare type MergeLaneOptions = {
25
28
  };
26
29
  export declare type CreateLaneOptions = {
27
30
  remoteScope?: string;
28
- remoteName?: string;
31
+ alias?: string;
29
32
  };
30
33
  export declare type SwitchLaneOptions = {
31
- newLaneName?: string;
34
+ alias?: string;
32
35
  merge?: MergeStrategy;
33
36
  getAll?: boolean;
34
37
  skipDependencyInstallation?: boolean;
@@ -50,11 +53,26 @@ export declare class LanesMain {
50
53
  notMerged?: boolean;
51
54
  }): Promise<LaneData[]>;
52
55
  getCurrentLane(): string | null;
53
- createLane(name: string, { remoteScope, remoteName }?: CreateLaneOptions): Promise<TrackLane>;
56
+ getCurrentLaneId(): LaneId | null;
57
+ createLane(name: string, { remoteScope, alias }?: CreateLaneOptions): Promise<TrackLane>;
54
58
  trackLane(localName: string, remoteScope: string, remoteName?: string): Promise<{
55
59
  beforeTrackData?: TrackLane;
56
60
  afterTrackData: TrackLane;
57
61
  }>;
62
+ aliasLane(laneName: string, alias: string): Promise<{
63
+ laneId: LaneId;
64
+ }>;
65
+ changeScope(laneName: string, remoteScope: string): Promise<{
66
+ remoteScopeBefore: string;
67
+ }>;
68
+ /**
69
+ * change a lane-name and if possible, export the lane to the remote
70
+ */
71
+ rename(currentName: string, newName: string): Promise<{
72
+ exported: boolean;
73
+ exportErr?: Error;
74
+ }>;
75
+ exportLane(lane: Lane): Promise<void>;
58
76
  removeLanes(laneNames: string[], { remote, force }: {
59
77
  remote: boolean;
60
78
  force: boolean;
@@ -69,7 +87,7 @@ export declare class LanesMain {
69
87
  * by default, only the components existing on the workspace will be imported from that lane, unless the "getAll"
70
88
  * flag is true.
71
89
  */
72
- switchLanes(laneName: string, { newLaneName, merge, getAll, skipDependencyInstallation }: SwitchLaneOptions): Promise<ApplyVersionResults>;
90
+ switchLanes(laneName: string, { alias, merge, getAll, skipDependencyInstallation }: SwitchLaneOptions): Promise<ApplyVersionResults>;
73
91
  /**
74
92
  * the values array may include zero to two values and will be processed as following:
75
93
  * [] => diff between the current lane and default lane. (only inside workspace).