eitri-cli 1.13.0-beta.4 → 1.13.0-beta.6

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.
@@ -17,4 +17,5 @@ export namespace app {
17
17
  }
18
18
  export namespace workspace {
19
19
  export function clean(): Promise<void>
20
+ export function current(): Promise<void>
20
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eitri-cli",
3
- "version": "1.13.0-beta.4",
3
+ "version": "1.13.0-beta.6",
4
4
  "description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,6 +1,8 @@
1
1
  const commander = require("commander");
2
2
 
3
3
  module.exports = function VegvisirCommand() {
4
+ const NEW_CLI_VERSION = process.env.CLI_VERSION === "v2";
5
+
4
6
  const workspaceCommand = commander
5
7
  .command("workspace")
6
8
  .description(
@@ -41,7 +43,12 @@ module.exports = function VegvisirCommand() {
41
43
  .description(
42
44
  "Exibe o workspace atual, obedecendo a prioridade Local > Global."
43
45
  )
44
- .action((cmdObj) => {
46
+ .action(async (cmdObj) => {
47
+ if (NEW_CLI_VERSION) {
48
+ const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
49
+ return await eitriCLIV2.workspace.current();
50
+ }
51
+
45
52
  require("./cmd/current")(cmdObj);
46
53
  });
47
54
 
@@ -3,6 +3,7 @@ const readline = require("readline");
3
3
  const chalk = require("chalk");
4
4
  const os = require("os");
5
5
  const EmulatorService = require("../EmulatorService");
6
+ const qrcode = require('qrcode')
6
7
 
7
8
  function QRCodeStarter(
8
9
  args,
@@ -51,6 +52,7 @@ function QRCodeStarter(
51
52
  await tryOpenEmulator(fullUrl, args);
52
53
  }
53
54
 
55
+ await listenerKeyPressToShowQrCode(fullUrl);
54
56
  await listenerKeyPressToOpenEmulator(fullUrl, args.deepLinks);
55
57
  };
56
58
  }
@@ -74,8 +76,7 @@ async function listenerKeyPressToOpenEmulator(url, deepLinks) {
74
76
  if(!deepLinks || deepLinks?.length < 1) return;
75
77
  const enterText = chalk.blue.bold("Enter");
76
78
  console.log("================================================");
77
- console.log(`\t${chalk.green.bold("Abertura de Eitri-App automática")}`);
78
- console.log("================================================");
79
+ console.log(`\t${chalk.blue.bold("Abertura de Eitri-App automática")}`);
79
80
  console.log(
80
81
  `Digite ${chalk.blue.bold(
81
82
  "a"
@@ -110,6 +111,37 @@ async function listenerKeyPressToOpenEmulator(url, deepLinks) {
110
111
  });
111
112
  }
112
113
 
114
+ async function listenerKeyPressToShowQrCode(url) {
115
+ const enterText = chalk.green.bold("Enter");
116
+
117
+ console.log("================================================");
118
+ console.log(
119
+ `Digite ${chalk.green.bold(
120
+ "q"
121
+ )} e pressione ${enterText} no terminal para exibir o QrCode`
122
+ );
123
+
124
+ console.log("================================================");
125
+ readline.emitKeypressEvents(process.stdin);
126
+
127
+ process.stdin.on("keypress", async (_, key) => {
128
+ try {
129
+ if(key){
130
+ if (key.name == "q" || key.name == "Q") {
131
+ qrcode.toString(url, {type:"terminal", small: true}, function(_, qrCode) {
132
+ console.log(qrCode)
133
+ })
134
+ }
135
+ }
136
+
137
+ } catch (error) {
138
+ console.error("Não foi possível exibir o QR Code. Não se preocupe, seu desenvolvimento não foi interrompido.")
139
+ console.log(error);
140
+ process.exit(0);
141
+ }
142
+ });
143
+ }
144
+
113
145
  function extractShareId(url) {
114
146
  const [, shareId] = url.split("/share/");
115
147
  return shareId;