eitri-cli 1.16.0-beta.3 → 1.16.1
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/eitri-cli-v2/config/config.dev.toml +0 -1
- package/eitri-cli-v2/config/config.loc.toml +0 -1
- package/eitri-cli-v2/config/config.prod.toml +0 -1
- package/eitri-cli-v2/config/config.runes-foundry.toml +0 -1
- package/eitri-cli-v2/config/config.test.toml +0 -1
- package/eitri-cli-v2/eitri-cli-v2.darwin-arm64.node +0 -0
- package/eitri-cli-v2/eitri-cli-v2.darwin-x64.node +0 -0
- package/eitri-cli-v2/eitri-cli-v2.linux-x64-gnu.node +0 -0
- package/eitri-cli-v2/eitri-cli-v2.win32-x64-msvc.node +0 -0
- package/eitri-cli-v2/index.d.ts +1 -3
- package/index.js +0 -4
- package/package.json +1 -1
- package/src/cmd/runTests.js +1 -1
- package/src/cmd/start.js +1 -4
- package/src/modules/app/AppCommand.js +2 -14
- package/src/service/Emulator/AndroidEmulatorService.js +2 -2
- package/src/service/Emulator/IOSEmulatorService.js +2 -2
- package/src/service/EmulatorService.js +5 -2
- package/src/service/QRCodeFactory.js +7 -20
- package/src/service/Workspace.js +1 -10
- package/src/service/WorkspaceManager.js +1 -1
- package/src/service/factories/QRCodeStarterFactory.js +33 -17
- package/src/service/factories/WebStarterFactory.js +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/eitri-cli-v2/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
export interface StartArguments {
|
|
7
7
|
shared?: boolean
|
|
8
8
|
verbose?: boolean
|
|
9
|
-
playground?: boolean
|
|
10
9
|
}
|
|
11
10
|
export interface EitriLibsArguments {
|
|
12
11
|
bifrost?: boolean
|
|
@@ -18,9 +17,8 @@ export function eitriLibs(eitriLibsArgs: EitriLibsArguments): Promise<void>
|
|
|
18
17
|
export function doctor(): Promise<void>
|
|
19
18
|
export function start(args: StartArguments): Promise<void>
|
|
20
19
|
export namespace app {
|
|
21
|
-
export function start(
|
|
20
|
+
export function start(): Promise<void>
|
|
22
21
|
export function appLogs(): Promise<void>
|
|
23
|
-
export function clean(): Promise<void>
|
|
24
22
|
}
|
|
25
23
|
export namespace workspace {
|
|
26
24
|
export function clean(): Promise<void>
|
package/index.js
CHANGED
|
@@ -72,10 +72,6 @@ const run = async () => {
|
|
|
72
72
|
.option("-f, --force", "Força o start")
|
|
73
73
|
.option("-S, --show-deeplink", "Exibe o deep link do workspace")
|
|
74
74
|
.option("-sm, --skip-mini-log", "Skipa conexão com o mini-log")
|
|
75
|
-
.option(
|
|
76
|
-
"-p, --playground",
|
|
77
|
-
"Gera um QR code com a URL de abertura do Eitri Playground"
|
|
78
|
-
)
|
|
79
75
|
.option(
|
|
80
76
|
"-P, --qr-printer <qrPrinter>",
|
|
81
77
|
"Indica qual programa imprimirá o QR Code. Se omitido, exibe o QrCode no terminal. Valores válidos: terminal|chrome|msedge|firefox"
|
package/package.json
CHANGED
package/src/cmd/runTests.js
CHANGED
|
@@ -70,7 +70,7 @@ module.exports = async function runTests(args) {
|
|
|
70
70
|
debug("Fim da busca e validação do EitriAppConf", { miniConf })
|
|
71
71
|
|
|
72
72
|
const url = config.get('workspace').url
|
|
73
|
-
const setupResult = await workspace.setup(
|
|
73
|
+
const setupResult = await workspace.setup()
|
|
74
74
|
debug("Informações do setupResult do workspace", { setupResult })
|
|
75
75
|
|
|
76
76
|
blindGuardian.readConf()
|
package/src/cmd/start.js
CHANGED
|
@@ -54,10 +54,7 @@ module.exports = async function start(args) {
|
|
|
54
54
|
const applicationName = setupResult?.application?.name
|
|
55
55
|
|
|
56
56
|
blindGuardian.readConf()
|
|
57
|
-
|
|
58
|
-
if(args.playground){
|
|
59
|
-
qrCodeUrl = config.get('qrCode').url
|
|
60
|
-
}
|
|
57
|
+
const qrCodeUrl = config.get('qrCode').url
|
|
61
58
|
if (args.verbose) {
|
|
62
59
|
blindGuardian.verbose = true
|
|
63
60
|
miniLog.verbose = true
|
|
@@ -3,17 +3,11 @@ module.exports = function AppCommand() {
|
|
|
3
3
|
const app = commander.command("app")
|
|
4
4
|
.description("Gerencia a execução de Eitri-Apps do Aplicativo declarado no app-config.yaml 'eitri app --help'")
|
|
5
5
|
|
|
6
|
-
const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
|
|
7
|
-
|
|
8
6
|
app
|
|
9
7
|
.command("start")
|
|
10
8
|
.description("Inicializa todos os Eitri-Apps do arquivo de configuração app-config.yaml")
|
|
11
|
-
.option("-v, --verbose", "Exibe mais logs")
|
|
12
|
-
.option(
|
|
13
|
-
"-p, --playground",
|
|
14
|
-
"Gera um QR code com a URL de abertura do Eitri Playground"
|
|
15
|
-
)
|
|
16
9
|
.action(async (cmdObj) => {
|
|
10
|
+
const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
|
|
17
11
|
await eitriCLIV2.app.start(cmdObj)
|
|
18
12
|
});
|
|
19
13
|
|
|
@@ -21,15 +15,9 @@ module.exports = function AppCommand() {
|
|
|
21
15
|
.command("logs")
|
|
22
16
|
.description("Exibe os logs dos Eitri-Apps em execução do comando 'eitri app start'")
|
|
23
17
|
.action(async () => {
|
|
18
|
+
const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
|
|
24
19
|
await eitriCLIV2.app.appLogs();
|
|
25
20
|
});
|
|
26
21
|
|
|
27
|
-
app
|
|
28
|
-
.command("clean")
|
|
29
|
-
.description("Realiza a limpeza do workspace remoto")
|
|
30
|
-
.action(async () => {
|
|
31
|
-
await eitriCLIV2.app.clean();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
22
|
return app;
|
|
35
23
|
};
|
|
@@ -6,10 +6,10 @@ const debug = require('debug')('eitri:AndroidEmulatorService')
|
|
|
6
6
|
|
|
7
7
|
module.exports = class AndroidEmulatorService {
|
|
8
8
|
|
|
9
|
-
static async open(deepLink) {
|
|
9
|
+
static async open(deepLink, shareId) {
|
|
10
10
|
await this.checkHasInstalledAdb()
|
|
11
11
|
const serialNumber = await this.selectDevice()
|
|
12
|
-
const cmd = `adb -s ${serialNumber} shell am start -a android.intent.action.VIEW -d ${deepLink}`
|
|
12
|
+
const cmd = `adb -s ${serialNumber} shell am start -a android.intent.action.VIEW -d ${deepLink}/${shareId}`
|
|
13
13
|
const opened = await this.openDeepLink(cmd)
|
|
14
14
|
if (opened) return;
|
|
15
15
|
}
|
|
@@ -4,10 +4,10 @@ const inquirer = require("inquirer");
|
|
|
4
4
|
|
|
5
5
|
module.exports = class IOSEmulatorService {
|
|
6
6
|
|
|
7
|
-
static async open(deepLink) {
|
|
7
|
+
static async open(deepLink, shareId) {
|
|
8
8
|
await this.checkHasInstalledXcode()
|
|
9
9
|
|
|
10
|
-
const cmd = `xcrun simctl openurl booted ${deepLink}`
|
|
10
|
+
const cmd = `xcrun simctl openurl booted ${deepLink}/${shareId}`
|
|
11
11
|
const opened = await this.openDeepLink(cmd)
|
|
12
12
|
if (opened) return;
|
|
13
13
|
|
|
@@ -3,10 +3,13 @@ const IOSEmulatorService = require('./Emulator/IOSEmulatorService');
|
|
|
3
3
|
|
|
4
4
|
module.exports = class EmulatorService {
|
|
5
5
|
|
|
6
|
-
static async openSimulator(emulator,
|
|
6
|
+
static async openSimulator(emulator, shareId, deepLinks) {
|
|
7
7
|
try {
|
|
8
8
|
const emulatorService = emulator === "ios" ? IOSEmulatorService : AndroidEmulatorService;
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
for (const deepLink of deepLinks) {
|
|
11
|
+
await emulatorService.open(deepLink, shareId)
|
|
12
|
+
}
|
|
10
13
|
} catch (error) {
|
|
11
14
|
throw {message: error.message}
|
|
12
15
|
}
|
|
@@ -18,11 +18,15 @@ class QRCodeFactory {
|
|
|
18
18
|
})
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async create(data, eitriAppSlug = "",
|
|
22
|
-
|
|
21
|
+
async create(data, eitriAppSlug = "", displayOutsideTerminal = false) {
|
|
22
|
+
console.log('\n==================================================')
|
|
23
|
+
console.log('Utilize o QR-Code para iniciar o seu Eitri-App')
|
|
24
|
+
console.log('É importante utilizar o leitor de QR-Code do')
|
|
25
|
+
console.log('aplicativo à qual destina-se o seu Eitri-App')
|
|
26
|
+
console.log('==================================================')
|
|
23
27
|
|
|
24
28
|
let qrCodeTempPath = `${eitriAppSlug}::${new Date().getTime()}`
|
|
25
|
-
if(
|
|
29
|
+
if(displayOutsideTerminal){
|
|
26
30
|
qrCodeTempPath = await this.tempFile(eitriAppSlug)
|
|
27
31
|
await this.createQRCodeImage(qrCodeTempPath, data)
|
|
28
32
|
}
|
|
@@ -59,23 +63,6 @@ class QRCodeFactory {
|
|
|
59
63
|
)
|
|
60
64
|
})
|
|
61
65
|
}
|
|
62
|
-
|
|
63
|
-
displayQrCodeInstruction(playGroundMode = false) {
|
|
64
|
-
const separator = "=================================================="
|
|
65
|
-
console.log("\n" + separator)
|
|
66
|
-
|
|
67
|
-
if (playGroundMode) {
|
|
68
|
-
console.log('Para iniciar seu Eitri-App, escaneie o QR Code')
|
|
69
|
-
console.log('exibido usando o Eitri Playground')
|
|
70
|
-
console.log(separator)
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
console.log("Para iniciar seu Eitri-App, escaneie o QR Code exibido.")
|
|
75
|
-
console.log('Certifique-se de usar o leitor de QR Code')
|
|
76
|
-
console.log('do aplicativo destinado ao seu Eitri-App.')
|
|
77
|
-
console.log(separator)
|
|
78
|
-
}
|
|
79
66
|
}
|
|
80
67
|
|
|
81
68
|
module.exports = QRCodeFactory
|
package/src/service/Workspace.js
CHANGED
|
@@ -35,7 +35,6 @@ const YAML = require('yaml');
|
|
|
35
35
|
const { readFile } = require("fs/promises");
|
|
36
36
|
const convertKeysToCamelCase = require("../util/convertKeysToCamelCase");
|
|
37
37
|
const { exit } = require("process");
|
|
38
|
-
const debug = require('debug')('eitri:Workspace')
|
|
39
38
|
|
|
40
39
|
class Workspace {
|
|
41
40
|
|
|
@@ -195,20 +194,13 @@ class Workspace {
|
|
|
195
194
|
const headers = {
|
|
196
195
|
accept: this.config.libs.updateLibsEndpointVersion,
|
|
197
196
|
};
|
|
198
|
-
|
|
199
|
-
let runAppMode = "CLIENT_APP"
|
|
200
|
-
if(args?.playground) runAppMode = "PLAYGROUND"
|
|
201
|
-
|
|
202
|
-
debug("RUN_APP_MODE", runAppMode)
|
|
203
|
-
|
|
204
197
|
try {
|
|
205
198
|
const appConfig = await this.getAppConfig()
|
|
206
199
|
const setupResponse = await this.http.post(
|
|
207
200
|
`${this.serverUrl}/${this.basePath}/v2/workspace/setup`,
|
|
208
201
|
{
|
|
209
202
|
eitriConf,
|
|
210
|
-
appConfig
|
|
211
|
-
runAppMode
|
|
203
|
+
appConfig
|
|
212
204
|
},
|
|
213
205
|
headers
|
|
214
206
|
); // somente para garantir que a pasta do usuario existe
|
|
@@ -438,7 +430,6 @@ class Workspace {
|
|
|
438
430
|
title: miniAppConf["title"],
|
|
439
431
|
permissions: miniAppConf["permissions"],
|
|
440
432
|
miniAppBootstrapUrl: this.getBootstrapURL(setupConfig.eitriAppBootstrapURL),
|
|
441
|
-
developmentDeeplink: setupConfig.developmentDeeplink,
|
|
442
433
|
initializationParams,
|
|
443
434
|
orderId,
|
|
444
435
|
view,
|
|
@@ -40,7 +40,7 @@ class WorkspaceManager {
|
|
|
40
40
|
console.log(qrCode)
|
|
41
41
|
})
|
|
42
42
|
} else {
|
|
43
|
-
const qrCodePath = await new QRCodeFactory().create(fullUrl
|
|
43
|
+
const qrCodePath = await new QRCodeFactory().create(fullUrl)
|
|
44
44
|
const sanitizedQrCodePath = qrCodePath.replace('/~', '')
|
|
45
45
|
if(args) {
|
|
46
46
|
Server.startServer({ qrCodePath: sanitizedQrCodePath, qrPrinter: args.qrPrinter })
|
|
@@ -21,14 +21,13 @@ function QRCodeStarter(
|
|
|
21
21
|
this.startServer = async function () {
|
|
22
22
|
const eitriAppConf = this.workspace._miniConf;
|
|
23
23
|
const workspaceURLConfig = await this.workspace.getNewWorkspaceURL(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const fullQrCodeUrl = workspaceURLConfig.miniAppConf.developmentDeeplink;
|
|
24
|
+
this.args,
|
|
25
|
+
this.setupConfig,
|
|
26
|
+
eitriAppConf
|
|
27
|
+
);
|
|
28
|
+
const fullUrl = workspaceURLConfig.miniAppUrl
|
|
30
29
|
if (this.args.verbose) {
|
|
31
|
-
console.log(`QrCodeUrl: ${
|
|
30
|
+
console.log(`QrCodeUrl: ${fullUrl}`);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
this.watcher.start();
|
|
@@ -36,35 +35,47 @@ function QRCodeStarter(
|
|
|
36
35
|
console.log("######################################");
|
|
37
36
|
console.log("########### Deep Link URL ############");
|
|
38
37
|
console.log("######################################");
|
|
39
|
-
console.log(`${
|
|
38
|
+
console.log(`${fullUrl}`);
|
|
40
39
|
console.log("######################################");
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
const _QRCodeFactory = new QRCodeFactory();
|
|
44
43
|
|
|
45
44
|
const eitriAppSlug = this.workspace?._miniConf?.slug ?? "";
|
|
46
|
-
const qrCodePath = await _QRCodeFactory.create(
|
|
45
|
+
const qrCodePath = await _QRCodeFactory.create(fullUrl, eitriAppSlug, this.args.qrPrinter);
|
|
47
46
|
|
|
48
47
|
if (this.args.verbose) {
|
|
49
48
|
console.log(`QrCode Path: ${qrCodePath}`);
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
_QRCodeFactory.generate({ ...this.args, qrCodePath, fullUrl
|
|
51
|
+
_QRCodeFactory.generate({ ...this.args, qrCodePath, fullUrl });
|
|
53
52
|
|
|
54
53
|
if (this.args.emulator) {
|
|
55
|
-
await tryOpenEmulator(
|
|
54
|
+
await tryOpenEmulator(fullUrl, args);
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
await listenerKeyPressToShowQrCode(
|
|
59
|
-
await listenerKeyPressToOpenEmulator(
|
|
57
|
+
await listenerKeyPressToShowQrCode(fullUrl);
|
|
58
|
+
await listenerKeyPressToOpenEmulator(fullUrl, args.deepLinks);
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
async function tryOpenEmulator(fullUrl, args) {
|
|
64
|
-
|
|
63
|
+
const shareId = extractShareId(fullUrl);
|
|
64
|
+
const { emulator, deepLinks } = args;
|
|
65
|
+
if(!deepLinks || deepLinks?.length < 1) {
|
|
66
|
+
const warningMessages = [
|
|
67
|
+
'Observamos que o seu Aplicativo não possui "deep links" configurados no momento.',
|
|
68
|
+
'Para obter assistência na configuração, por favor, entre em contato com o nosso suporte técnico Eitri.',
|
|
69
|
+
'Estamos aqui para ajudar a configurá-los para você.'
|
|
70
|
+
]
|
|
71
|
+
console.log(warningMessages.join("\n"))
|
|
72
|
+
return
|
|
73
|
+
};
|
|
74
|
+
await EmulatorService.openSimulator(emulator, shareId, deepLinks)
|
|
65
75
|
}
|
|
66
76
|
|
|
67
|
-
async function listenerKeyPressToOpenEmulator(url) {
|
|
77
|
+
async function listenerKeyPressToOpenEmulator(url, deepLinks) {
|
|
78
|
+
if(!deepLinks || deepLinks?.length < 1) return;
|
|
68
79
|
const enterText = chalk.blue.bold("Enter");
|
|
69
80
|
console.log("================================================");
|
|
70
81
|
console.log(`\t${chalk.blue.bold("Abertura de Eitri-App automática")}`);
|
|
@@ -88,12 +99,12 @@ async function listenerKeyPressToOpenEmulator(url) {
|
|
|
88
99
|
if (key && key.name == "a") {
|
|
89
100
|
const emulator = "android";
|
|
90
101
|
console.log(`Abrindo Eitri-App no ${chalk.blue.bold("Android")}`);
|
|
91
|
-
await tryOpenEmulator(url, {emulator});
|
|
102
|
+
await tryOpenEmulator(url, {emulator, deepLinks});
|
|
92
103
|
}
|
|
93
104
|
if (os.platform() === "darwin" && key && key.name == "i") {
|
|
94
105
|
const emulator = "ios";
|
|
95
106
|
console.log(`Abrindo Eitri-App no ${chalk.blue.bold("iOS")}`);
|
|
96
|
-
await tryOpenEmulator(url, {emulator});
|
|
107
|
+
await tryOpenEmulator(url, {emulator, deepLinks});
|
|
97
108
|
}
|
|
98
109
|
} catch (error) {
|
|
99
110
|
console.log(error);
|
|
@@ -133,6 +144,11 @@ async function listenerKeyPressToShowQrCode(url) {
|
|
|
133
144
|
});
|
|
134
145
|
}
|
|
135
146
|
|
|
147
|
+
function extractShareId(url) {
|
|
148
|
+
const [, shareId] = url.split("/share/");
|
|
149
|
+
return shareId;
|
|
150
|
+
}
|
|
151
|
+
|
|
136
152
|
function QRCodeContentFactory() {
|
|
137
153
|
this.create = function (
|
|
138
154
|
args,
|
|
@@ -50,7 +50,7 @@ function WebAppStarter(args, trackingService, watcher, workspace, targetConfig )
|
|
|
50
50
|
const { slug } = miniConf
|
|
51
51
|
|
|
52
52
|
if(this.args.emulator){
|
|
53
|
-
Server.startServerEmulator({...this.args, bootstrapUrl: miniAppConf.
|
|
53
|
+
Server.startServerEmulator({...this.args, bootstrapUrl: miniAppConf.miniAppBootstrapUrl, slug, http: this.workspace.getHttp() })
|
|
54
54
|
return
|
|
55
55
|
}
|
|
56
56
|
|