@teambit/bvm.commands.link 1.0.6 → 1.1.0
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/link.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.command = exports.LinkCmd = void 0;
|
|
16
16
|
const chalk_1 = __importDefault(require("chalk"));
|
|
17
17
|
const bvm_link_1 = require("@teambit/bvm.link");
|
|
18
|
+
const bvm_error_1 = require("@teambit/bvm.error");
|
|
18
19
|
const bvm_reporter_1 = require("@teambit/bvm.reporter");
|
|
19
20
|
class LinkCmd {
|
|
20
21
|
constructor() {
|
|
@@ -28,6 +29,14 @@ class LinkCmd {
|
|
|
28
29
|
yargs.positional('name', {
|
|
29
30
|
describe: 'name of the link',
|
|
30
31
|
type: 'string'
|
|
32
|
+
})
|
|
33
|
+
.option({
|
|
34
|
+
next: {
|
|
35
|
+
alias: ['bitx'],
|
|
36
|
+
describe: 'link bitx (the next Bit CLI) instead of bit. without a name, relinks only the bitx links',
|
|
37
|
+
default: false,
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
},
|
|
31
40
|
})
|
|
32
41
|
.option({
|
|
33
42
|
'skip-update-path': {
|
|
@@ -49,17 +58,39 @@ class LinkCmd {
|
|
|
49
58
|
implies: ['name']
|
|
50
59
|
})
|
|
51
60
|
.example('$0 link', 'link all names to versions')
|
|
52
|
-
.example('$0 link bit175 1.7.5', 'link bit175 to version 1.7.5 of bit')
|
|
61
|
+
.example('$0 link bit175 1.7.5', 'link bit175 to version 1.7.5 of bit')
|
|
62
|
+
.example('$0 link --next bitx-alpha1 0.1.0-alpha.1', 'link bitx-alpha1 to version 0.1.0-alpha.1 of bitx (the next Bit CLI)');
|
|
53
63
|
return yargs;
|
|
54
64
|
}
|
|
55
65
|
handler(args) {
|
|
56
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
67
|
let results;
|
|
68
|
+
const linkOpts = {
|
|
69
|
+
addToPathIfMissing: !args.skipUpdatePath,
|
|
70
|
+
useSystemNode: args.useSystemNode,
|
|
71
|
+
};
|
|
72
|
+
if (args.next) {
|
|
73
|
+
if (!args.name) {
|
|
74
|
+
results = yield (0, bvm_link_1.linkAllBitx)(linkOpts);
|
|
75
|
+
}
|
|
76
|
+
else if (!args.bitVersion) {
|
|
77
|
+
throw new bvm_error_1.BvmError('a bitx version is required when linking bitx with a name');
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
results = [yield (0, bvm_link_1.linkBitx)(args.name, args.bitVersion, Object.assign({ addToConfig: true }, linkOpts))];
|
|
81
|
+
}
|
|
82
|
+
printOutput(results, args.verbose);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
58
85
|
if (!args.name) {
|
|
59
|
-
results = yield (0, bvm_link_1.linkAll)(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
86
|
+
results = yield (0, bvm_link_1.linkAll)(linkOpts);
|
|
87
|
+
// bitx links are relinked too, but a broken bitx installation must not fail relinking bit
|
|
88
|
+
try {
|
|
89
|
+
results.push(...(yield (0, bvm_link_1.linkAllBitx)(linkOpts)));
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
console.log(chalk_1.default.yellow(`failed to relink bitx: ${err === null || err === void 0 ? void 0 : err.message}`));
|
|
93
|
+
}
|
|
63
94
|
}
|
|
64
95
|
else {
|
|
65
96
|
results = [yield (0, bvm_link_1.linkOne)(args.name, args.bitVersion, {
|
package/dist/link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"","sources":["../link.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../link.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA0B;AAC1B,gDAAsF;AACtF,kDAA8C;AAC9C,wDAAiE;A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,WAAW,CAAC,WAAyB,EAAE,OAAO,GAAG,KAAK;IAC7D,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,MAAM,CAAC;AAChB,CAAC;AAEY,QAAA,OAAO,GAAI,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/runner/Library/Caches/Bit/capsules/22984e0a6/teambit.bvm_commands_link@1.0
|
|
2
|
+
import * as overview_0 from '/home/runner/Library/Caches/Bit/capsules/22984e0a6/teambit.bvm_commands_link@1.1.0/dist/link.docs.md';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
package/link.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {CommandModule, Argv} from 'yargs';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import {linkAll, linkOne, LinkResult} from '@teambit/bvm.link';
|
|
3
|
+
import {linkAll, linkAllBitx, linkBitx, linkOne, LinkResult} from '@teambit/bvm.link';
|
|
4
|
+
import { BvmError } from '@teambit/bvm.error';
|
|
4
5
|
import { renderPathExtenderReport } from '@teambit/bvm.reporter';
|
|
5
6
|
|
|
6
7
|
export class LinkCmd implements CommandModule {
|
|
@@ -14,6 +15,14 @@ export class LinkCmd implements CommandModule {
|
|
|
14
15
|
describe: 'name of the link',
|
|
15
16
|
type: 'string'
|
|
16
17
|
})
|
|
18
|
+
.option({
|
|
19
|
+
next: {
|
|
20
|
+
alias: ['bitx'],
|
|
21
|
+
describe: 'link bitx (the next Bit CLI) instead of bit. without a name, relinks only the bitx links',
|
|
22
|
+
default: false,
|
|
23
|
+
type: 'boolean',
|
|
24
|
+
},
|
|
25
|
+
})
|
|
17
26
|
.option({
|
|
18
27
|
'skip-update-path': {
|
|
19
28
|
describe: "don't add the bvm directory to the system PATH",
|
|
@@ -35,15 +44,34 @@ export class LinkCmd implements CommandModule {
|
|
|
35
44
|
})
|
|
36
45
|
.example('$0 link', 'link all names to versions')
|
|
37
46
|
.example('$0 link bit175 1.7.5', 'link bit175 to version 1.7.5 of bit')
|
|
47
|
+
.example('$0 link --next bitx-alpha1 0.1.0-alpha.1', 'link bitx-alpha1 to version 0.1.0-alpha.1 of bitx (the next Bit CLI)')
|
|
38
48
|
return yargs;
|
|
39
49
|
}
|
|
40
50
|
async handler(args) {
|
|
41
51
|
let results;
|
|
52
|
+
const linkOpts = {
|
|
53
|
+
addToPathIfMissing: !args.skipUpdatePath,
|
|
54
|
+
useSystemNode: args.useSystemNode,
|
|
55
|
+
};
|
|
56
|
+
if (args.next) {
|
|
57
|
+
if (!args.name) {
|
|
58
|
+
results = await linkAllBitx(linkOpts);
|
|
59
|
+
} else if (!args.bitVersion) {
|
|
60
|
+
throw new BvmError('a bitx version is required when linking bitx with a name');
|
|
61
|
+
} else {
|
|
62
|
+
results = [await linkBitx(args.name, args.bitVersion, { addToConfig: true, ...linkOpts })];
|
|
63
|
+
}
|
|
64
|
+
printOutput(results, args.verbose);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
42
67
|
if (!args.name){
|
|
43
|
-
results = await linkAll(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
68
|
+
results = await linkAll(linkOpts);
|
|
69
|
+
// bitx links are relinked too, but a broken bitx installation must not fail relinking bit
|
|
70
|
+
try {
|
|
71
|
+
results.push(...(await linkAllBitx(linkOpts)));
|
|
72
|
+
} catch (err: any) {
|
|
73
|
+
console.log(chalk.yellow(`failed to relink bitx: ${err?.message}`));
|
|
74
|
+
}
|
|
47
75
|
} else {
|
|
48
76
|
results = [await linkOne(args.name, args.bitVersion, {
|
|
49
77
|
addToConfig: true,
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/bvm.commands.link",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/bvm/commands/link",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.bvm",
|
|
8
8
|
"name": "commands/link",
|
|
9
|
-
"version": "1.0
|
|
9
|
+
"version": "1.1.0"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.0",
|
|
13
13
|
"yargs": "17.0.1",
|
|
14
|
+
"@teambit/bvm.error": "1.0.0",
|
|
14
15
|
"@teambit/bvm.reporter": "1.1.0",
|
|
15
|
-
"@teambit/bvm.link": "1.
|
|
16
|
+
"@teambit/bvm.link": "1.2.0"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"@types/chalk": "0.4.31",
|