@teambit/lanes.modules.diff 0.0.161 → 0.0.162
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/lane-diff-generator.d.ts +7 -1
- package/dist/lane-diff-generator.js +21 -5
- package/dist/lane-diff-generator.js.map +1 -1
- package/dist/lane-diff.cmd.d.ts +3 -1
- package/dist/lane-diff.cmd.js +9 -4
- package/dist/lane-diff.cmd.js.map +1 -1
- package/lane-diff-generator.ts +24 -7
- package/lane-diff.cmd.ts +14 -4
- package/package-tar/teambit-lanes.modules.diff-0.0.162.tgz +0 -0
- package/package.json +3 -3
- /package/{preview-1658978882481.js → preview-1659065375106.js} +0 -0
- package/package-tar/teambit-lanes.modules.diff-0.0.161.tgz +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ScopeMain } from '@teambit/scope';
|
|
2
2
|
import { Workspace } from '@teambit/workspace';
|
|
3
|
+
import { BitId } from '@teambit/legacy-bit-id';
|
|
3
4
|
import { DiffResults, DiffOptions } from '@teambit/legacy/dist/consumer/component-ops/components-diff';
|
|
4
5
|
export declare class LaneDiffGenerator {
|
|
5
6
|
private workspace;
|
|
@@ -9,6 +10,7 @@ export declare class LaneDiffGenerator {
|
|
|
9
10
|
private compsWithNoChanges;
|
|
10
11
|
private fromLaneData;
|
|
11
12
|
private toLaneData;
|
|
13
|
+
private failures;
|
|
12
14
|
constructor(workspace: Workspace | undefined, scope: ScopeMain);
|
|
13
15
|
/**
|
|
14
16
|
* the values array may include zero to two values and will be processed as following:
|
|
@@ -16,11 +18,15 @@ export declare class LaneDiffGenerator {
|
|
|
16
18
|
* [to] => diff between the current lane (or default-lane when in scope) and "to" lane.
|
|
17
19
|
* [from, to] => diff between "from" lane and "to" lane.
|
|
18
20
|
*/
|
|
19
|
-
generate(values: string[], diffOptions?: DiffOptions): Promise<{
|
|
21
|
+
generate(values: string[], diffOptions?: DiffOptions, pattern?: string): Promise<{
|
|
20
22
|
newComps: string[];
|
|
21
23
|
compsWithDiff: DiffResults[];
|
|
22
24
|
compsWithNoChanges: string[];
|
|
23
25
|
toLaneName: string;
|
|
26
|
+
failures: {
|
|
27
|
+
id: BitId;
|
|
28
|
+
msg: string;
|
|
29
|
+
}[];
|
|
24
30
|
}>;
|
|
25
31
|
private componentDiff;
|
|
26
32
|
private getLaneNames;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.LaneDiffGenerator = void 0;
|
|
13
13
|
const components_diff_1 = require("@teambit/legacy/dist/consumer/component-ops/components-diff");
|
|
14
14
|
const lane_id_1 = require("@teambit/lane-id");
|
|
15
|
+
const bit_id_1 = require("@teambit/legacy/dist/bit-id");
|
|
15
16
|
class LaneDiffGenerator {
|
|
16
17
|
constructor(workspace, scope) {
|
|
17
18
|
this.workspace = workspace;
|
|
@@ -19,6 +20,7 @@ class LaneDiffGenerator {
|
|
|
19
20
|
this.newComps = [];
|
|
20
21
|
this.compsWithDiff = [];
|
|
21
22
|
this.compsWithNoChanges = [];
|
|
23
|
+
this.failures = [];
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* the values array may include zero to two values and will be processed as following:
|
|
@@ -26,7 +28,7 @@ class LaneDiffGenerator {
|
|
|
26
28
|
* [to] => diff between the current lane (or default-lane when in scope) and "to" lane.
|
|
27
29
|
* [from, to] => diff between "from" lane and "to" lane.
|
|
28
30
|
*/
|
|
29
|
-
generate(values, diffOptions = {}) {
|
|
31
|
+
generate(values, diffOptions = {}, pattern) {
|
|
30
32
|
var _a;
|
|
31
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
34
|
const { fromLaneName, toLaneName } = this.getLaneNames(values);
|
|
@@ -62,7 +64,16 @@ class LaneDiffGenerator {
|
|
|
62
64
|
const bitIds = (fromLane === null || fromLane === void 0 ? void 0 : fromLane.components.map((c) => c.id)) || [];
|
|
63
65
|
this.toLaneData = yield this.getDefaultLaneData(bitIds);
|
|
64
66
|
}
|
|
67
|
+
let idsToCheckDiff;
|
|
68
|
+
if (pattern) {
|
|
69
|
+
const allIds = this.toLaneData.components.map((c) => c.id);
|
|
70
|
+
const compIds = yield (this.workspace || this.scope).resolveMultipleComponentIds(allIds);
|
|
71
|
+
idsToCheckDiff = bit_id_1.BitIds.fromArray(this.scope.filterIdsFromPoolIdsByPattern(pattern, compIds).map((c) => c._legacy));
|
|
72
|
+
}
|
|
65
73
|
yield Promise.all(this.toLaneData.components.map(({ id, head }) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
if (idsToCheckDiff && !idsToCheckDiff.hasWithoutVersion(id)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
66
77
|
yield this.componentDiff(id, head, diffOptions);
|
|
67
78
|
})));
|
|
68
79
|
return {
|
|
@@ -70,6 +81,7 @@ class LaneDiffGenerator {
|
|
|
70
81
|
compsWithDiff: this.compsWithDiff,
|
|
71
82
|
compsWithNoChanges: this.compsWithNoChanges.map((id) => id.toString()),
|
|
72
83
|
toLaneName: (_a = this.toLaneData) === null || _a === void 0 ? void 0 : _a.name,
|
|
84
|
+
failures: this.failures,
|
|
73
85
|
};
|
|
74
86
|
});
|
|
75
87
|
}
|
|
@@ -86,7 +98,14 @@ class LaneDiffGenerator {
|
|
|
86
98
|
this.compsWithNoChanges.push(id);
|
|
87
99
|
return;
|
|
88
100
|
}
|
|
89
|
-
|
|
101
|
+
let fromVersion;
|
|
102
|
+
try {
|
|
103
|
+
fromVersion = (yield fromLaneHead.load(this.scope.legacyScope.objects, true));
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
this.failures.push({ id, msg: err.message });
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
90
109
|
const toVersion = yield toLaneHead.load(this.scope.legacyScope.objects);
|
|
91
110
|
const fromLaneStr = this.fromLaneData ? this.fromLaneData.name : lane_id_1.DEFAULT_LANE;
|
|
92
111
|
diffOptions.formatDepsAsTable = false;
|
|
@@ -126,7 +145,6 @@ class LaneDiffGenerator {
|
|
|
126
145
|
name: lane_id_1.DEFAULT_LANE,
|
|
127
146
|
remote: null,
|
|
128
147
|
components: [],
|
|
129
|
-
isMerged: null,
|
|
130
148
|
};
|
|
131
149
|
yield Promise.all(ids.map((id) => __awaiter(this, void 0, void 0, function* () {
|
|
132
150
|
const modelComponent = yield this.scope.legacyScope.getModelComponent(id);
|
|
@@ -143,10 +161,8 @@ class LaneDiffGenerator {
|
|
|
143
161
|
mapToLaneData(lane) {
|
|
144
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
163
|
const { name, components } = lane;
|
|
146
|
-
const isMerged = yield lane.isFullyMerged(this.scope.legacyScope);
|
|
147
164
|
return {
|
|
148
165
|
name,
|
|
149
|
-
isMerged,
|
|
150
166
|
components: components.map((lc) => {
|
|
151
167
|
var _a;
|
|
152
168
|
return ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lane-diff-generator.js","sourceRoot":"","sources":["../lane-diff-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,iGAIqE;AACrE,8CAAgD;
|
|
1
|
+
{"version":3,"file":"lane-diff-generator.js","sourceRoot":"","sources":["../lane-diff-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,iGAIqE;AACrE,8CAAgD;AAChD,wDAAqD;AAUrD,MAAa,iBAAiB;IAO5B,YAAoB,SAAgC,EAAU,KAAgB;QAA1D,cAAS,GAAT,SAAS,CAAuB;QAAU,UAAK,GAAL,KAAK,CAAW;QANtE,aAAQ,GAAY,EAAE,CAAC;QACvB,kBAAa,GAAkB,EAAE,CAAC;QAClC,uBAAkB,GAAY,EAAE,CAAC;QAGjC,aAAQ,GAAiC,EAAE,CAAC;IAC6B,CAAC;IAElF;;;;;OAKG;IACG,QAAQ,CAAC,MAAgB,EAAE,cAA2B,EAAE,EAAE,OAAgB;;;YAC9E,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,YAAY,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E,CAAC,OAAO,0CAAE,QAAQ,EAAE;qBACnC,CAAC,CAAA;iBAAA,CAAC;gBACH,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;aACnC,CAAC;QACJ,CAAC;KAAA;CACF;AAzKD,8CAyKC"}
|
package/dist/lane-diff.cmd.d.ts
CHANGED
|
@@ -15,5 +15,7 @@ export declare class LaneDiffCmd implements Command {
|
|
|
15
15
|
remoteOp: boolean;
|
|
16
16
|
skipWorkspace: boolean;
|
|
17
17
|
constructor(workspace: Workspace, scope: ScopeMain);
|
|
18
|
-
report([values]: [string[]]
|
|
18
|
+
report([values]: [string[]], { pattern }: {
|
|
19
|
+
pattern?: string;
|
|
20
|
+
}): Promise<string>;
|
|
19
21
|
}
|
package/dist/lane-diff.cmd.js
CHANGED
|
@@ -26,22 +26,27 @@ class LaneDiffCmd {
|
|
|
26
26
|
bit lane diff to => diff between the current lane (or default-lane when in scope) and "to" lane.
|
|
27
27
|
bit lane diff from to => diff between "from" lane and "to" lane.`;
|
|
28
28
|
this.alias = '';
|
|
29
|
-
this.options = [
|
|
29
|
+
this.options = [
|
|
30
|
+
['', 'pattern <component-pattern>', 'EXPERIMENTAL. show lane-diff for the specified component-pattern only'],
|
|
31
|
+
];
|
|
30
32
|
this.loader = true;
|
|
31
33
|
this.private = true;
|
|
32
34
|
this.migration = true;
|
|
33
35
|
this.remoteOp = true;
|
|
34
36
|
this.skipWorkspace = true;
|
|
35
37
|
}
|
|
36
|
-
report([values = []]) {
|
|
38
|
+
report([values = []], { pattern }) {
|
|
37
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
40
|
const laneDiffGenerator = new lane_diff_generator_1.LaneDiffGenerator(this.workspace, this.scope);
|
|
39
|
-
const { compsWithDiff, newComps, toLaneName } = yield laneDiffGenerator.generate(values);
|
|
41
|
+
const { compsWithDiff, newComps, toLaneName, failures } = yield laneDiffGenerator.generate(values, undefined, pattern);
|
|
40
42
|
const diffResultsStr = (0, components_diff_1.outputDiffResults)(compsWithDiff);
|
|
41
43
|
const newCompsIdsStr = newComps.map((id) => chalk_1.default.bold(id)).join('\n');
|
|
42
44
|
const newCompsTitle = `The following components were introduced in ${chalk_1.default.bold(toLaneName)} lane`;
|
|
43
45
|
const newCompsStr = newComps.length ? `${chalk_1.default.inverse(newCompsTitle)}\n${newCompsIdsStr}` : '';
|
|
44
|
-
|
|
46
|
+
const failuresTitle = `\n\nDiff failed on the following component(s)`;
|
|
47
|
+
const failuresIds = failures.map((f) => `${f.id.toString()} - ${chalk_1.default.red(f.msg)}`);
|
|
48
|
+
const failuresStr = failures.length ? `${chalk_1.default.inverse(failuresTitle)}\n${failuresIds}` : '';
|
|
49
|
+
return `${diffResultsStr}\n${newCompsStr}${failuresStr}`;
|
|
45
50
|
});
|
|
46
51
|
}
|
|
47
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lane-diff.cmd.js","sourceRoot":"","sources":["../lane-diff.cmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,kDAA0B;AAC1B,iGAAgG;AAChG,+DAA0D;AAE1D,MAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"lane-diff.cmd.js","sourceRoot":"","sources":["../lane-diff.cmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,kDAA0B;AAC1B,iGAAgG;AAChG,+DAA0D;AAE1D,MAAa,WAAW;IAgBtB,YAAoB,SAAoB,EAAU,KAAgB;QAA9C,cAAS,GAAT,SAAS,CAAW;QAAU,UAAK,GAAL,KAAK,CAAW;QAflE,SAAI,GAAG,kBAAkB,CAAC;QAC1B,gBAAW,GAAG,yBAAyB,CAAC;QACxC,wBAAmB,GAAG;;iEAEyC,CAAC;QAChE,UAAK,GAAG,EAAE,CAAC;QACX,YAAO,GAAG;YACR,CAAC,EAAE,EAAE,6BAA6B,EAAE,uEAAuE,CAAC;SAC3F,CAAC;QACpB,WAAM,GAAG,IAAI,CAAC;QACd,YAAO,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AAC,KAAK,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7F,OAAO,GAAG,cAAc,KAAK,WAAW,GAAG,WAAW,EAAE,CAAC;QAC3D,CAAC;KAAA;CACF;AAnCD,kCAmCC"}
|
package/lane-diff-generator.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
DiffOptions,
|
|
10
10
|
} from '@teambit/legacy/dist/consumer/component-ops/components-diff';
|
|
11
11
|
import { DEFAULT_LANE } from '@teambit/lane-id';
|
|
12
|
+
import { BitIds } from '@teambit/legacy/dist/bit-id';
|
|
12
13
|
|
|
13
14
|
type LaneData = {
|
|
14
15
|
name: string;
|
|
@@ -17,7 +18,6 @@ type LaneData = {
|
|
|
17
18
|
head: Ref;
|
|
18
19
|
}>;
|
|
19
20
|
remote: string | null;
|
|
20
|
-
isMerged: boolean | null;
|
|
21
21
|
};
|
|
22
22
|
export class LaneDiffGenerator {
|
|
23
23
|
private newComps: BitId[] = [];
|
|
@@ -25,6 +25,7 @@ export class LaneDiffGenerator {
|
|
|
25
25
|
private compsWithNoChanges: BitId[] = [];
|
|
26
26
|
private fromLaneData: LaneData | null;
|
|
27
27
|
private toLaneData: LaneData;
|
|
28
|
+
private failures: { id: BitId; msg: string }[] = [];
|
|
28
29
|
constructor(private workspace: Workspace | undefined, private scope: ScopeMain) {}
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -33,7 +34,7 @@ export class LaneDiffGenerator {
|
|
|
33
34
|
* [to] => diff between the current lane (or default-lane when in scope) and "to" lane.
|
|
34
35
|
* [from, to] => diff between "from" lane and "to" lane.
|
|
35
36
|
*/
|
|
36
|
-
async generate(values: string[], diffOptions: DiffOptions = {}) {
|
|
37
|
+
async generate(values: string[], diffOptions: DiffOptions = {}, pattern?: string) {
|
|
37
38
|
const { fromLaneName, toLaneName } = this.getLaneNames(values);
|
|
38
39
|
if (fromLaneName === toLaneName) {
|
|
39
40
|
throw new Error(`unable to run diff between "${fromLaneName}" and "${toLaneName}", they're the same lane`);
|
|
@@ -65,8 +66,20 @@ export class LaneDiffGenerator {
|
|
|
65
66
|
this.toLaneData = await this.getDefaultLaneData(bitIds);
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
let idsToCheckDiff: BitIds | undefined;
|
|
70
|
+
if (pattern) {
|
|
71
|
+
const allIds = this.toLaneData.components.map((c) => c.id);
|
|
72
|
+
const compIds = await (this.workspace || this.scope).resolveMultipleComponentIds(allIds);
|
|
73
|
+
idsToCheckDiff = BitIds.fromArray(
|
|
74
|
+
this.scope.filterIdsFromPoolIdsByPattern(pattern, compIds).map((c) => c._legacy)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
await Promise.all(
|
|
69
79
|
this.toLaneData.components.map(async ({ id, head }) => {
|
|
80
|
+
if (idsToCheckDiff && !idsToCheckDiff.hasWithoutVersion(id)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
70
83
|
await this.componentDiff(id, head, diffOptions);
|
|
71
84
|
})
|
|
72
85
|
);
|
|
@@ -76,6 +89,7 @@ export class LaneDiffGenerator {
|
|
|
76
89
|
compsWithDiff: this.compsWithDiff,
|
|
77
90
|
compsWithNoChanges: this.compsWithNoChanges.map((id) => id.toString()),
|
|
78
91
|
toLaneName: this.toLaneData?.name,
|
|
92
|
+
failures: this.failures,
|
|
79
93
|
};
|
|
80
94
|
}
|
|
81
95
|
|
|
@@ -91,13 +105,19 @@ export class LaneDiffGenerator {
|
|
|
91
105
|
this.compsWithNoChanges.push(id);
|
|
92
106
|
return;
|
|
93
107
|
}
|
|
94
|
-
|
|
108
|
+
let fromVersion: Version;
|
|
109
|
+
try {
|
|
110
|
+
fromVersion = (await fromLaneHead.load(this.scope.legacyScope.objects, true)) as Version;
|
|
111
|
+
} catch (err: any) {
|
|
112
|
+
this.failures.push({ id, msg: err.message });
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
95
115
|
const toVersion = await toLaneHead.load(this.scope.legacyScope.objects);
|
|
96
116
|
const fromLaneStr = this.fromLaneData ? this.fromLaneData.name : DEFAULT_LANE;
|
|
97
117
|
diffOptions.formatDepsAsTable = false;
|
|
98
118
|
const diff = await diffBetweenVersionsObjects(
|
|
99
119
|
modelComponent,
|
|
100
|
-
fromVersion
|
|
120
|
+
fromVersion,
|
|
101
121
|
toVersion as Version,
|
|
102
122
|
fromLaneStr,
|
|
103
123
|
this.toLaneData.name,
|
|
@@ -139,7 +159,6 @@ export class LaneDiffGenerator {
|
|
|
139
159
|
name: DEFAULT_LANE,
|
|
140
160
|
remote: null,
|
|
141
161
|
components: [],
|
|
142
|
-
isMerged: null,
|
|
143
162
|
};
|
|
144
163
|
|
|
145
164
|
await Promise.all(
|
|
@@ -159,10 +178,8 @@ export class LaneDiffGenerator {
|
|
|
159
178
|
|
|
160
179
|
private async mapToLaneData(lane: Lane): Promise<LaneData> {
|
|
161
180
|
const { name, components } = lane;
|
|
162
|
-
const isMerged = await lane.isFullyMerged(this.scope.legacyScope);
|
|
163
181
|
return {
|
|
164
182
|
name,
|
|
165
|
-
isMerged,
|
|
166
183
|
components: components.map((lc) => ({
|
|
167
184
|
id: lc.id,
|
|
168
185
|
head: lc.head,
|
package/lane-diff.cmd.ts
CHANGED
|
@@ -12,7 +12,9 @@ export class LaneDiffCmd implements Command {
|
|
|
12
12
|
bit lane diff to => diff between the current lane (or default-lane when in scope) and "to" lane.
|
|
13
13
|
bit lane diff from to => diff between "from" lane and "to" lane.`;
|
|
14
14
|
alias = '';
|
|
15
|
-
options = [
|
|
15
|
+
options = [
|
|
16
|
+
['', 'pattern <component-pattern>', 'EXPERIMENTAL. show lane-diff for the specified component-pattern only'],
|
|
17
|
+
] as CommandOptions;
|
|
16
18
|
loader = true;
|
|
17
19
|
private = true;
|
|
18
20
|
migration = true;
|
|
@@ -21,13 +23,21 @@ bit lane diff from to => diff between "from" lane and "to" lane.`;
|
|
|
21
23
|
|
|
22
24
|
constructor(private workspace: Workspace, private scope: ScopeMain) {}
|
|
23
25
|
|
|
24
|
-
async report([values = []]: [string[]]) {
|
|
26
|
+
async report([values = []]: [string[]], { pattern }: { pattern?: string }) {
|
|
25
27
|
const laneDiffGenerator = new LaneDiffGenerator(this.workspace, this.scope);
|
|
26
|
-
const { compsWithDiff, newComps, toLaneName } = await laneDiffGenerator.generate(
|
|
28
|
+
const { compsWithDiff, newComps, toLaneName, failures } = await laneDiffGenerator.generate(
|
|
29
|
+
values,
|
|
30
|
+
undefined,
|
|
31
|
+
pattern
|
|
32
|
+
);
|
|
33
|
+
|
|
27
34
|
const diffResultsStr = outputDiffResults(compsWithDiff);
|
|
28
35
|
const newCompsIdsStr = newComps.map((id) => chalk.bold(id)).join('\n');
|
|
29
36
|
const newCompsTitle = `The following components were introduced in ${chalk.bold(toLaneName)} lane`;
|
|
30
37
|
const newCompsStr = newComps.length ? `${chalk.inverse(newCompsTitle)}\n${newCompsIdsStr}` : '';
|
|
31
|
-
|
|
38
|
+
const failuresTitle = `\n\nDiff failed on the following component(s)`;
|
|
39
|
+
const failuresIds = failures.map((f) => `${f.id.toString()} - ${chalk.red(f.msg)}`);
|
|
40
|
+
const failuresStr = failures.length ? `${chalk.inverse(failuresTitle)}\n${failuresIds}` : '';
|
|
41
|
+
return `${diffResultsStr}\n${newCompsStr}${failuresStr}`;
|
|
32
42
|
}
|
|
33
43
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/lanes.modules.diff",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.162",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/lanes/modules/diff",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.lanes",
|
|
8
8
|
"name": "modules/diff",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.162"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
13
|
-
"@teambit/lane-id": "0.0.
|
|
13
|
+
"@teambit/lane-id": "0.0.52",
|
|
14
14
|
"@teambit/legacy-bit-id": "0.0.402"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
File without changes
|
|
Binary file
|