@teambit/bvm.commands.upgrade 0.1.1 → 0.1.3

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 CHANGED
@@ -1,4 +1,4 @@
1
- import type { CommandModule, Argv } from 'yargs';
1
+ import type { CommandModule, Argv } from "yargs";
2
2
  export declare class UpgradeCmd implements CommandModule {
3
3
  aliases: string[];
4
4
  describe: string;
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 = ['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 = [
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
- 'skip-update-path': {
28
+ "skip-update-path": {
31
29
  describe: "don't add the bvm directory to the system PATH",
32
30
  default: false,
33
- type: 'boolean',
34
- }
31
+ type: "boolean",
32
+ },
35
33
  })
36
34
  .option({
37
- 'use-system-node': {
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: 'boolean'
41
- }
38
+ type: "boolean",
39
+ },
42
40
  })
43
41
  .option({
44
- 'skip-update-check': {
42
+ "skip-update-check": {
45
43
  describe: "skip checking for a newer version of BVM",
46
44
  default: false,
47
- type: 'boolean'
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('$0 upgrade', 'install latest bit version from the server, update the current version, and delete the previous installed version');
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)('latest', { override: false, replace: true, useSystemNode: args.useSystemNode, addToPathIfMissing: !args.skipUpdatePath });
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 ? `upgraded from version ${chalk_1.default.green(upgradeResults.previousCurrentVersion)}` : undefined;
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('\n');
92
+ return [replacedText, currentText].filter((msg) => msg).join("\n");
75
93
  }
76
94
  function printOutput(upgradeResults) {
77
95
  const output = formatOutput(upgradeResults);
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../upgrade.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,sDAAoE;AACpE,kDAA0B;AAC1B,sDAA2G;AAE3G,MAAa,UAAU;IAAvB;QACE,YAAO,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;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AAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;YACH,OAAO,WAAW,CAAC,cAAc,CAAC,CAAC;QACrC,CAAC;KAAA;CACF;AApED,gCAoEC;AAEY,QAAA,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;AAExC,SAAS,YAAY,CAAC,cAA8B;IAClD,MAAM,YAAY,GAAG,cAAc,CAAC,sBAAsB;QACxD,CAAC,CAAC,yBAAyB,eAAK,CAAC,KAAK,CAClC,cAAc,CAAC,sBAAsB,CACtC,EAAE;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"}
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@teambit/bvm.commands.upgrade",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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.1"
9
+ "version": "0.1.3"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.0",
13
13
  "yargs": "17.0.1",
14
- "@teambit/bvm.install": "0.1.10",
15
- "@teambit/bvm.version": "0.1.0"
14
+ "@teambit/bvm.install": "0.1.12",
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.12.18",
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.1/dist/upgrade.docs.md';
2
+ import * as overview_0 from '/Users/giladshoham/Library/Caches/Bit/capsules/f3900c88552f465f36e94e9f684555a848de0105/teambit.bvm_commands_upgrade@0.1.3/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 'yargs';
2
- import {installVersion, InstallResults} from '@teambit/bvm.install';
3
- import chalk from 'chalk';
4
- import { getBvmLocalVersion, getBvmRemoteVersion, getNewerBvmAvailableOutput } from '@teambit/bvm.version';
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 = ['u', 'upgrade'];
8
- describe = 'install latest bit version from the server, update the current version, and delete the previous installed version';
9
- command = [
10
- 'upgrade'
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
- .option({
15
- 'skip-update-path': {
16
- describe: "don't add the bvm directory to the system PATH",
17
- default: false,
18
- type: 'boolean',
19
- }
20
- })
21
- .option({
22
- 'use-system-node': {
23
- describe: "use the Node.js installed on the system to run Bit CLI",
24
- default: false,
25
- type: 'boolean'
26
- }
27
- })
28
- .option({
29
- 'skip-update-check': {
30
- describe: "skip checking for a newer version of BVM",
31
- default: false,
32
- type: 'boolean'
33
- }
34
- })
35
- .example('$0 upgrade', 'install latest bit version from the server, update the current version, and delete the previous installed version')
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(currentBvmVersion, latestBvmRemoteVersion);
43
- if (upgradeBvmMsg){
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('latest', {override: false, replace: true, useSystemNode: args.useSystemNode, addToPathIfMissing: !args.skipUpdatePath});
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 = new UpgradeCmd();
80
+ export const command = new UpgradeCmd();
53
81
 
54
82
  function formatOutput(upgradeResults: InstallResults): string {
55
- const replacedText = upgradeResults.previousCurrentVersion ? `upgraded from version ${chalk.green(upgradeResults.previousCurrentVersion)}`: undefined;
56
- const currentText = `current is now linked to version ${chalk.green(upgradeResults.installedVersion)} in path ${chalk.green(upgradeResults.versionPath)}`;
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('\n');
92
+ return [replacedText, currentText].filter((msg) => msg).join("\n");
59
93
  }
60
94
 
61
95
  function printOutput(upgradeResults: InstallResults): string {