@teambit/bvm.commands.upgrade 0.1.0 → 0.1.2
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/upgrade.d.ts +1 -1
- package/dist/upgrade.js +37 -19
- package/dist/upgrade.js.map +1 -1
- package/package-tar/teambit-bvm.commands.upgrade-0.1.2.tgz +0 -0
- package/package.json +5 -5
- package/{preview-1664709039579.js → preview-1667134219517.js} +1 -1
- package/upgrade.ts +73 -39
- package/package-tar/teambit-bvm.commands.upgrade-0.1.0.tgz +0 -0
package/dist/upgrade.d.ts
CHANGED
package/dist/upgrade.js
CHANGED
|
@@ -18,36 +18,46 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
18
18
|
const bvm_version_1 = require("@teambit/bvm.version");
|
|
19
19
|
class UpgradeCmd {
|
|
20
20
|
constructor() {
|
|
21
|
-
this.aliases = [
|
|
22
|
-
this.describe =
|
|
23
|
-
this.command = [
|
|
24
|
-
'upgrade'
|
|
25
|
-
];
|
|
21
|
+
this.aliases = ["u", "upgrade"];
|
|
22
|
+
this.describe = "install latest bit version from the server, update the current version, and delete the previous installed version";
|
|
23
|
+
this.command = ["upgrade"];
|
|
26
24
|
}
|
|
27
25
|
builder(yargs) {
|
|
28
26
|
yargs
|
|
29
27
|
.option({
|
|
30
|
-
|
|
28
|
+
"skip-update-path": {
|
|
31
29
|
describe: "don't add the bvm directory to the system PATH",
|
|
32
30
|
default: false,
|
|
33
|
-
type:
|
|
34
|
-
}
|
|
31
|
+
type: "boolean",
|
|
32
|
+
},
|
|
35
33
|
})
|
|
36
34
|
.option({
|
|
37
|
-
|
|
35
|
+
"use-system-node": {
|
|
38
36
|
describe: "use the Node.js installed on the system to run Bit CLI",
|
|
39
37
|
default: false,
|
|
40
|
-
type:
|
|
41
|
-
}
|
|
38
|
+
type: "boolean",
|
|
39
|
+
},
|
|
42
40
|
})
|
|
43
41
|
.option({
|
|
44
|
-
|
|
42
|
+
"skip-update-check": {
|
|
45
43
|
describe: "skip checking for a newer version of BVM",
|
|
46
44
|
default: false,
|
|
47
|
-
type:
|
|
48
|
-
}
|
|
45
|
+
type: "boolean",
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
.option({
|
|
49
|
+
os: {
|
|
50
|
+
describe: "override the os type",
|
|
51
|
+
type: "string",
|
|
52
|
+
choices: ["linux", "darwin", "win"],
|
|
53
|
+
},
|
|
54
|
+
arch: {
|
|
55
|
+
describe: "override the arch type",
|
|
56
|
+
type: "string",
|
|
57
|
+
choices: ["x64", "arm64"],
|
|
58
|
+
},
|
|
49
59
|
})
|
|
50
|
-
.example(
|
|
60
|
+
.example("$0 upgrade", "install latest bit version from the server, update the current version, and delete the previous installed version");
|
|
51
61
|
return yargs;
|
|
52
62
|
}
|
|
53
63
|
handler(args) {
|
|
@@ -60,18 +70,26 @@ class UpgradeCmd {
|
|
|
60
70
|
console.log(chalk_1.default.yellow(upgradeBvmMsg));
|
|
61
71
|
}
|
|
62
72
|
}
|
|
63
|
-
const upgradeResults = yield (0, bvm_install_1.installVersion)(
|
|
73
|
+
const upgradeResults = yield (0, bvm_install_1.installVersion)("latest", {
|
|
74
|
+
override: false,
|
|
75
|
+
replace: true,
|
|
76
|
+
useSystemNode: args.useSystemNode,
|
|
77
|
+
addToPathIfMissing: !args.skipUpdatePath,
|
|
78
|
+
os: args.os,
|
|
79
|
+
arch: args.arch,
|
|
80
|
+
});
|
|
64
81
|
return printOutput(upgradeResults);
|
|
65
82
|
});
|
|
66
83
|
}
|
|
67
|
-
;
|
|
68
84
|
}
|
|
69
85
|
exports.UpgradeCmd = UpgradeCmd;
|
|
70
86
|
exports.command = new UpgradeCmd();
|
|
71
87
|
function formatOutput(upgradeResults) {
|
|
72
|
-
const replacedText = upgradeResults.previousCurrentVersion
|
|
88
|
+
const replacedText = upgradeResults.previousCurrentVersion
|
|
89
|
+
? `upgraded from version ${chalk_1.default.green(upgradeResults.previousCurrentVersion)}`
|
|
90
|
+
: undefined;
|
|
73
91
|
const currentText = `current is now linked to version ${chalk_1.default.green(upgradeResults.installedVersion)} in path ${chalk_1.default.green(upgradeResults.versionPath)}`;
|
|
74
|
-
return [replacedText, currentText].filter(msg => msg).join(
|
|
92
|
+
return [replacedText, currentText].filter((msg) => msg).join("\n");
|
|
75
93
|
}
|
|
76
94
|
function printOutput(upgradeResults) {
|
|
77
95
|
const output = formatOutput(upgradeResults);
|
package/dist/upgrade.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../upgrade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../upgrade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,sDAAsE;AACtE,kDAA0B;AAC1B,sDAI8B;AAE9B,MAAa,UAAU;IAAvB;QACE,YAAO,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC3B,aAAQ,GACN,mHAAmH,CAAC;QACtH,YAAO,GAAG,CAAC,SAAS,CAAC,CAAC;IAgExB,CAAC;IA/DC,OAAO,CAAC,KAAW;QACjB,KAAK;aACF,MAAM,CAAC;YACN,kBAAkB,EAAE;gBAClB,QAAQ,EAAE,gDAAgD;gBAC1D,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,SAAS;aAChB;SACF,CAAC;aACD,MAAM,CAAC;YACN,iBAAiB,EAAE;gBACjB,QAAQ,EAAE,wDAAwD;gBAClE,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,SAAS;aAChB;SACF,CAAC;aACD,MAAM,CAAC;YACN,mBAAmB,EAAE;gBACnB,QAAQ,EAAE,0CAA0C;gBACpD,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,SAAS;aAChB;SACF,CAAC;aACD,MAAM,CAAC;YACN,EAAE,EAAE;gBACF,QAAQ,EAAE,sBAAsB;gBAChC,IAAI,EAAE,QAAQ;gBACd,O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AAE;QACL,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,WAAW,GAAG,oCAAoC,eAAK,CAAC,KAAK,CACjE,cAAc,CAAC,gBAAgB,CAChC,YAAY,eAAK,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;IAEvD,OAAO,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,WAAW,CAAC,cAA8B;IACjD,MAAM,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/bvm.commands.upgrade",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/bvm/commands/upgrade",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.bvm",
|
|
8
8
|
"name": "commands/upgrade",
|
|
9
|
-
"version": "0.1.
|
|
9
|
+
"version": "0.1.2"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.0",
|
|
13
13
|
"yargs": "17.0.1",
|
|
14
|
-
"@teambit/bvm.install": "0.1.
|
|
15
|
-
"@teambit/bvm.version": "0.1.
|
|
14
|
+
"@teambit/bvm.install": "0.1.11",
|
|
15
|
+
"@teambit/bvm.version": "0.1.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/chalk": "0.4.31",
|
|
19
19
|
"@types/yargs": "17.0.0",
|
|
20
|
-
"@babel/runtime": "7.
|
|
20
|
+
"@babel/runtime": "7.20.0",
|
|
21
21
|
"@types/node": "12.20.4",
|
|
22
22
|
"@types/jest": "26.0.20"
|
|
23
23
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/Users/giladshoham/Library/Caches/Bit/capsules/f3900c88552f465f36e94e9f684555a848de0105/teambit.bvm_commands_upgrade@0.1.
|
|
2
|
+
import * as overview_0 from '/Users/giladshoham/Library/Caches/Bit/capsules/f3900c88552f465f36e94e9f684555a848de0105/teambit.bvm_commands_upgrade@0.1.2/dist/upgrade.docs.md';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
package/upgrade.ts
CHANGED
|
@@ -1,61 +1,95 @@
|
|
|
1
|
-
import type {CommandModule, Argv} from
|
|
2
|
-
import {installVersion, InstallResults} from
|
|
3
|
-
import chalk from
|
|
4
|
-
import {
|
|
1
|
+
import type { CommandModule, Argv } from "yargs";
|
|
2
|
+
import { installVersion, InstallResults } from "@teambit/bvm.install";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import {
|
|
5
|
+
getBvmLocalVersion,
|
|
6
|
+
getBvmRemoteVersion,
|
|
7
|
+
getNewerBvmAvailableOutput,
|
|
8
|
+
} from "@teambit/bvm.version";
|
|
5
9
|
|
|
6
10
|
export class UpgradeCmd implements CommandModule {
|
|
7
|
-
aliases = [
|
|
8
|
-
describe =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
];
|
|
11
|
+
aliases = ["u", "upgrade"];
|
|
12
|
+
describe =
|
|
13
|
+
"install latest bit version from the server, update the current version, and delete the previous installed version";
|
|
14
|
+
command = ["upgrade"];
|
|
12
15
|
builder(yargs: Argv) {
|
|
13
16
|
yargs
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
.option({
|
|
18
|
+
"skip-update-path": {
|
|
19
|
+
describe: "don't add the bvm directory to the system PATH",
|
|
20
|
+
default: false,
|
|
21
|
+
type: "boolean",
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
.option({
|
|
25
|
+
"use-system-node": {
|
|
26
|
+
describe: "use the Node.js installed on the system to run Bit CLI",
|
|
27
|
+
default: false,
|
|
28
|
+
type: "boolean",
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
.option({
|
|
32
|
+
"skip-update-check": {
|
|
33
|
+
describe: "skip checking for a newer version of BVM",
|
|
34
|
+
default: false,
|
|
35
|
+
type: "boolean",
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
.option({
|
|
39
|
+
os: {
|
|
40
|
+
describe: "override the os type",
|
|
41
|
+
type: "string",
|
|
42
|
+
choices: ["linux", "darwin", "win"],
|
|
43
|
+
},
|
|
44
|
+
arch: {
|
|
45
|
+
describe: "override the arch type",
|
|
46
|
+
type: "string",
|
|
47
|
+
choices: ["x64", "arm64"],
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
.example(
|
|
51
|
+
"$0 upgrade",
|
|
52
|
+
"install latest bit version from the server, update the current version, and delete the previous installed version"
|
|
53
|
+
);
|
|
36
54
|
return yargs;
|
|
37
55
|
}
|
|
38
56
|
async handler(args) {
|
|
39
57
|
if (!args.skipUpdateCheck) {
|
|
40
58
|
const currentBvmVersion = await getBvmLocalVersion();
|
|
41
59
|
const latestBvmRemoteVersion = await getBvmRemoteVersion();
|
|
42
|
-
const upgradeBvmMsg = getNewerBvmAvailableOutput(
|
|
43
|
-
|
|
60
|
+
const upgradeBvmMsg = getNewerBvmAvailableOutput(
|
|
61
|
+
currentBvmVersion,
|
|
62
|
+
latestBvmRemoteVersion
|
|
63
|
+
);
|
|
64
|
+
if (upgradeBvmMsg) {
|
|
44
65
|
console.log(chalk.yellow(upgradeBvmMsg));
|
|
45
66
|
}
|
|
46
67
|
}
|
|
47
|
-
const upgradeResults = await installVersion(
|
|
68
|
+
const upgradeResults = await installVersion("latest", {
|
|
69
|
+
override: false,
|
|
70
|
+
replace: true,
|
|
71
|
+
useSystemNode: args.useSystemNode,
|
|
72
|
+
addToPathIfMissing: !args.skipUpdatePath,
|
|
73
|
+
os: args.os,
|
|
74
|
+
arch: args.arch,
|
|
75
|
+
});
|
|
48
76
|
return printOutput(upgradeResults);
|
|
49
|
-
}
|
|
77
|
+
}
|
|
50
78
|
}
|
|
51
79
|
|
|
52
|
-
export const command =
|
|
80
|
+
export const command = new UpgradeCmd();
|
|
53
81
|
|
|
54
82
|
function formatOutput(upgradeResults: InstallResults): string {
|
|
55
|
-
const replacedText = upgradeResults.previousCurrentVersion
|
|
56
|
-
|
|
83
|
+
const replacedText = upgradeResults.previousCurrentVersion
|
|
84
|
+
? `upgraded from version ${chalk.green(
|
|
85
|
+
upgradeResults.previousCurrentVersion
|
|
86
|
+
)}`
|
|
87
|
+
: undefined;
|
|
88
|
+
const currentText = `current is now linked to version ${chalk.green(
|
|
89
|
+
upgradeResults.installedVersion
|
|
90
|
+
)} in path ${chalk.green(upgradeResults.versionPath)}`;
|
|
57
91
|
|
|
58
|
-
return [replacedText, currentText].filter(msg => msg).join(
|
|
92
|
+
return [replacedText, currentText].filter((msg) => msg).join("\n");
|
|
59
93
|
}
|
|
60
94
|
|
|
61
95
|
function printOutput(upgradeResults: InstallResults): string {
|
|
Binary file
|