eitri-cli 1.16.1 → 1.17.0-beta.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 +1 -0
- package/eitri-cli-v2/config/config.loc.toml +1 -0
- package/eitri-cli-v2/config/config.prod.toml +1 -0
- package/eitri-cli-v2/config/config.runes-foundry.toml +1 -0
- package/eitri-cli-v2/config/config.test.toml +1 -0
- 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 +3 -1
- package/index.js +4 -0
- package/package.json +1 -1
- package/src/cmd/runTests.js +1 -1
- package/src/cmd/start.js +4 -1
- package/src/modules/app/AppCommand.js +14 -2
- package/src/service/Emulator/AndroidEmulatorService.js +2 -2
- package/src/service/Emulator/IOSEmulatorService.js +2 -2
- package/src/service/EmulatorService.js +2 -5
- package/src/service/QRCodeFactory.js +20 -7
- package/src/service/Workspace.js +10 -1
- package/src/service/WorkspaceManager.js +1 -1
- package/src/service/factories/QRCodeStarterFactory.js +17 -33
- 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,6 +6,7 @@
|
|
|
6
6
|
export interface StartArguments {
|
|
7
7
|
shared?: boolean
|
|
8
8
|
verbose?: boolean
|
|
9
|
+
playground?: boolean
|
|
9
10
|
}
|
|
10
11
|
export interface EitriLibsArguments {
|
|
11
12
|
bifrost?: boolean
|
|
@@ -17,8 +18,9 @@ export function eitriLibs(eitriLibsArgs: EitriLibsArguments): Promise<void>
|
|
|
17
18
|
export function doctor(): Promise<void>
|
|
18
19
|
export function start(args: StartArguments): Promise<void>
|
|
19
20
|
export namespace app {
|
|
20
|
-
export function start(): Promise<void>
|
|
21
|
+
export function start(args: StartArguments): Promise<void>
|
|
21
22
|
export function appLogs(): Promise<void>
|
|
23
|
+
export function clean(): Promise<void>
|
|
22
24
|
}
|
|
23
25
|
export namespace workspace {
|
|
24
26
|
export function clean(): Promise<void>
|
package/index.js
CHANGED
|
@@ -72,6 +72,10 @@ 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
|
+
)
|
|
75
79
|
.option(
|
|
76
80
|
"-P, --qr-printer <qrPrinter>",
|
|
77
81
|
"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(args)
|
|
74
74
|
debug("Informações do setupResult do workspace", { setupResult })
|
|
75
75
|
|
|
76
76
|
blindGuardian.readConf()
|
package/src/cmd/start.js
CHANGED
|
@@ -54,7 +54,10 @@ module.exports = async function start(args) {
|
|
|
54
54
|
const applicationName = setupResult?.application?.name
|
|
55
55
|
|
|
56
56
|
blindGuardian.readConf()
|
|
57
|
-
|
|
57
|
+
let qrCodeUrl = setupResult?.eitriAppBootstrapURL
|
|
58
|
+
if(args.playground){
|
|
59
|
+
qrCodeUrl = config.get('qrCode').url
|
|
60
|
+
}
|
|
58
61
|
if (args.verbose) {
|
|
59
62
|
blindGuardian.verbose = true
|
|
60
63
|
miniLog.verbose = true
|
|
@@ -3,11 +3,17 @@ 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
|
+
|
|
6
8
|
app
|
|
7
9
|
.command("start")
|
|
8
10
|
.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
|
+
)
|
|
9
16
|
.action(async (cmdObj) => {
|
|
10
|
-
const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
|
|
11
17
|
await eitriCLIV2.app.start(cmdObj)
|
|
12
18
|
});
|
|
13
19
|
|
|
@@ -15,9 +21,15 @@ module.exports = function AppCommand() {
|
|
|
15
21
|
.command("logs")
|
|
16
22
|
.description("Exibe os logs dos Eitri-Apps em execução do comando 'eitri app start'")
|
|
17
23
|
.action(async () => {
|
|
18
|
-
const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
|
|
19
24
|
await eitriCLIV2.app.appLogs();
|
|
20
25
|
});
|
|
21
26
|
|
|
27
|
+
app
|
|
28
|
+
.command("clean")
|
|
29
|
+
.description("Realiza a limpeza do workspace remoto")
|
|
30
|
+
.action(async () => {
|
|
31
|
+
await eitriCLIV2.app.clean();
|
|
32
|
+
});
|
|
33
|
+
|
|
22
34
|
return app;
|
|
23
35
|
};
|
|
@@ -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) {
|
|
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}`
|
|
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) {
|
|
8
8
|
await this.checkHasInstalledXcode()
|
|
9
9
|
|
|
10
|
-
const cmd = `xcrun simctl openurl booted ${deepLink}
|
|
10
|
+
const cmd = `xcrun simctl openurl booted ${deepLink}`
|
|
11
11
|
const opened = await this.openDeepLink(cmd)
|
|
12
12
|
if (opened) return;
|
|
13
13
|
|
|
@@ -3,13 +3,10 @@ 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, deeplink) {
|
|
7
7
|
try {
|
|
8
8
|
const emulatorService = emulator === "ios" ? IOSEmulatorService : AndroidEmulatorService;
|
|
9
|
-
|
|
10
|
-
for (const deepLink of deepLinks) {
|
|
11
|
-
await emulatorService.open(deepLink, shareId)
|
|
12
|
-
}
|
|
9
|
+
await emulatorService.open(deeplink)
|
|
13
10
|
} catch (error) {
|
|
14
11
|
throw {message: error.message}
|
|
15
12
|
}
|
|
@@ -18,15 +18,11 @@ class QRCodeFactory {
|
|
|
18
18
|
})
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async create(data, eitriAppSlug = "",
|
|
22
|
-
|
|
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('==================================================')
|
|
21
|
+
async create(data, eitriAppSlug = "", args = {}) {
|
|
22
|
+
this.displayQrCodeInstruction(args?.playground)
|
|
27
23
|
|
|
28
24
|
let qrCodeTempPath = `${eitriAppSlug}::${new Date().getTime()}`
|
|
29
|
-
if(
|
|
25
|
+
if(args?.qrPrinter){
|
|
30
26
|
qrCodeTempPath = await this.tempFile(eitriAppSlug)
|
|
31
27
|
await this.createQRCodeImage(qrCodeTempPath, data)
|
|
32
28
|
}
|
|
@@ -63,6 +59,23 @@ class QRCodeFactory {
|
|
|
63
59
|
)
|
|
64
60
|
})
|
|
65
61
|
}
|
|
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
|
+
}
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
module.exports = QRCodeFactory
|
package/src/service/Workspace.js
CHANGED
|
@@ -35,6 +35,7 @@ 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')
|
|
38
39
|
|
|
39
40
|
class Workspace {
|
|
40
41
|
|
|
@@ -194,13 +195,20 @@ class Workspace {
|
|
|
194
195
|
const headers = {
|
|
195
196
|
accept: this.config.libs.updateLibsEndpointVersion,
|
|
196
197
|
};
|
|
198
|
+
|
|
199
|
+
let runAppMode = "CLIENT_APP"
|
|
200
|
+
if(args?.playground) runAppMode = "PLAYGROUND"
|
|
201
|
+
|
|
202
|
+
debug("RUN_APP_MODE", runAppMode)
|
|
203
|
+
|
|
197
204
|
try {
|
|
198
205
|
const appConfig = await this.getAppConfig()
|
|
199
206
|
const setupResponse = await this.http.post(
|
|
200
207
|
`${this.serverUrl}/${this.basePath}/v2/workspace/setup`,
|
|
201
208
|
{
|
|
202
209
|
eitriConf,
|
|
203
|
-
appConfig
|
|
210
|
+
appConfig,
|
|
211
|
+
runAppMode
|
|
204
212
|
},
|
|
205
213
|
headers
|
|
206
214
|
); // somente para garantir que a pasta do usuario existe
|
|
@@ -430,6 +438,7 @@ class Workspace {
|
|
|
430
438
|
title: miniAppConf["title"],
|
|
431
439
|
permissions: miniAppConf["permissions"],
|
|
432
440
|
miniAppBootstrapUrl: this.getBootstrapURL(setupConfig.eitriAppBootstrapURL),
|
|
441
|
+
developmentDeeplink: setupConfig.developmentDeeplink,
|
|
433
442
|
initializationParams,
|
|
434
443
|
orderId,
|
|
435
444
|
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, "", args)
|
|
44
44
|
const sanitizedQrCodePath = qrCodePath.replace('/~', '')
|
|
45
45
|
if(args) {
|
|
46
46
|
Server.startServer({ qrCodePath: sanitizedQrCodePath, qrPrinter: args.qrPrinter })
|
|
@@ -21,13 +21,14 @@ 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
|
-
|
|
24
|
+
this.args,
|
|
25
|
+
this.setupConfig,
|
|
26
|
+
eitriAppConf
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const fullQrCodeUrl = workspaceURLConfig.miniAppConf.developmentDeeplink;
|
|
29
30
|
if (this.args.verbose) {
|
|
30
|
-
console.log(`QrCodeUrl: ${
|
|
31
|
+
console.log(`QrCodeUrl: ${fullQrCodeUrl}`);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
this.watcher.start();
|
|
@@ -35,47 +36,35 @@ function QRCodeStarter(
|
|
|
35
36
|
console.log("######################################");
|
|
36
37
|
console.log("########### Deep Link URL ############");
|
|
37
38
|
console.log("######################################");
|
|
38
|
-
console.log(`${
|
|
39
|
+
console.log(`${fullQrCodeUrl}`);
|
|
39
40
|
console.log("######################################");
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const _QRCodeFactory = new QRCodeFactory();
|
|
43
44
|
|
|
44
45
|
const eitriAppSlug = this.workspace?._miniConf?.slug ?? "";
|
|
45
|
-
const qrCodePath = await _QRCodeFactory.create(
|
|
46
|
+
const qrCodePath = await _QRCodeFactory.create(fullQrCodeUrl, eitriAppSlug, this.args);
|
|
46
47
|
|
|
47
48
|
if (this.args.verbose) {
|
|
48
49
|
console.log(`QrCode Path: ${qrCodePath}`);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
_QRCodeFactory.generate({ ...this.args, qrCodePath, fullUrl });
|
|
52
|
+
_QRCodeFactory.generate({ ...this.args, qrCodePath, fullUrl: fullQrCodeUrl });
|
|
52
53
|
|
|
53
54
|
if (this.args.emulator) {
|
|
54
|
-
await tryOpenEmulator(
|
|
55
|
+
await tryOpenEmulator(fullQrCodeUrl, args);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
await listenerKeyPressToShowQrCode(
|
|
58
|
-
await listenerKeyPressToOpenEmulator(
|
|
58
|
+
await listenerKeyPressToShowQrCode(fullQrCodeUrl);
|
|
59
|
+
await listenerKeyPressToOpenEmulator(fullQrCodeUrl);
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
async function tryOpenEmulator(fullUrl, args) {
|
|
63
|
-
|
|
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)
|
|
64
|
+
await EmulatorService.openSimulator(args.emulator, fullUrl)
|
|
75
65
|
}
|
|
76
66
|
|
|
77
|
-
async function listenerKeyPressToOpenEmulator(url
|
|
78
|
-
if(!deepLinks || deepLinks?.length < 1) return;
|
|
67
|
+
async function listenerKeyPressToOpenEmulator(url) {
|
|
79
68
|
const enterText = chalk.blue.bold("Enter");
|
|
80
69
|
console.log("================================================");
|
|
81
70
|
console.log(`\t${chalk.blue.bold("Abertura de Eitri-App automática")}`);
|
|
@@ -99,12 +88,12 @@ async function listenerKeyPressToOpenEmulator(url, deepLinks) {
|
|
|
99
88
|
if (key && key.name == "a") {
|
|
100
89
|
const emulator = "android";
|
|
101
90
|
console.log(`Abrindo Eitri-App no ${chalk.blue.bold("Android")}`);
|
|
102
|
-
await tryOpenEmulator(url, {emulator
|
|
91
|
+
await tryOpenEmulator(url, {emulator});
|
|
103
92
|
}
|
|
104
93
|
if (os.platform() === "darwin" && key && key.name == "i") {
|
|
105
94
|
const emulator = "ios";
|
|
106
95
|
console.log(`Abrindo Eitri-App no ${chalk.blue.bold("iOS")}`);
|
|
107
|
-
await tryOpenEmulator(url, {emulator
|
|
96
|
+
await tryOpenEmulator(url, {emulator});
|
|
108
97
|
}
|
|
109
98
|
} catch (error) {
|
|
110
99
|
console.log(error);
|
|
@@ -144,11 +133,6 @@ async function listenerKeyPressToShowQrCode(url) {
|
|
|
144
133
|
});
|
|
145
134
|
}
|
|
146
135
|
|
|
147
|
-
function extractShareId(url) {
|
|
148
|
-
const [, shareId] = url.split("/share/");
|
|
149
|
-
return shareId;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
136
|
function QRCodeContentFactory() {
|
|
153
137
|
this.create = function (
|
|
154
138
|
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.developmentDeeplink, slug, http: this.workspace.getHttp() })
|
|
54
54
|
return
|
|
55
55
|
}
|
|
56
56
|
|