eitri-cli 1.10.0-beta.7 → 1.10.0-beta.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eitri-cli",
3
- "version": "1.10.0-beta.7",
3
+ "version": "1.10.0-beta.8",
4
4
  "description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -18,11 +18,30 @@ module.exports = class AndroidEmulatorService {
18
18
  try {
19
19
  console.log("Verificando instalação do ABD",)
20
20
  const command = "adb --version"
21
- const { stdout } = await exec(command)
22
- console.log("ADB Instalado. Continuando...")
23
- debug('checkHasInstalledAdb:', stdout)
21
+ const {stdout} = await exec(command)
22
+ console.log("ADB Instalado. Continuando...\n");
23
+
24
+ debug('checkHasInstalledAdb (adb --version):', stdout)
24
25
  } catch (error) {
25
- console.error("checkHasInstalledAdb:", { message: error?.message || "", error })
26
+ console.error("checkHasInstalledAdb: Comando 'adb --version' não executado. Iniciando fallback. \n")
27
+ await this.checkHasInstalledAdbFallback(error)
28
+ }
29
+ }
30
+
31
+ static async checkHasInstalledAdbFallback(firstError = {}) {
32
+ try {
33
+ console.log("Verificação novamente instalação do ADB...");
34
+
35
+ const command = "adb devices"
36
+ const {stdout} = await exec(command)
37
+ console.log("ADB Instalado. Continuando...\n");
38
+
39
+ debug('checkHasInstalledAdb (adb devices):', stdout)
40
+ } catch (fallbackError) {
41
+ console.error("checkHasInstalledAdb: Comando 'adb devices' não executado. \n")
42
+ console.error("\n\ncheckHasInstalledAdb error: 'adb --version': \n", {message: firstError?.message || "", error: firstError})
43
+ console.error("\n\ncheckHasInstalledAdb error: 'adb devices': \n", {message: fallbackError?.message || "", error: fallbackError})
44
+
26
45
  throw new Error('"adb" não instalado. Saiba mais em https://developer.android.com/tools/adb')
27
46
  }
28
47
  }