eitri-cli 1.12.0-beta.2 → 1.12.0-beta.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/bitbucket-pipelines.yml +1 -0
- package/eitri-cli-v2/Cargo.toml +1 -0
- 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.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 -0
- package/eitri-cli-v2/index.js +2 -1
- package/index.js +4 -1
- package/package.json +1 -1
- package/src/cmd/start.js +22 -20
- package/src/cmd/validate.js +3 -3
- package/src/modules/app/AppCommand.js +15 -0
package/bitbucket-pipelines.yml
CHANGED
package/eitri-cli-v2/Cargo.toml
CHANGED
|
@@ -45,6 +45,7 @@ url = "https://api.eitri.tech/miniapp-manager-api"
|
|
|
45
45
|
url = "https://api.eitri.tech/eitri-manager-api"
|
|
46
46
|
revision_path = "/v2/revisions"
|
|
47
47
|
publish_path = "/revisions/:eitriAppId/publish"
|
|
48
|
+
application_by_id_path = "/applications/:applicationId"
|
|
48
49
|
|
|
49
50
|
[eitri_analytics]
|
|
50
51
|
url = "https://api.eitri.tech/analytics/event"
|
|
@@ -45,6 +45,7 @@ url = "https://api.eitri.tech/miniapp-manager-api"
|
|
|
45
45
|
url = "https://api.eitri.tech/eitri-manager-api"
|
|
46
46
|
revision_path = "/v2/revisions"
|
|
47
47
|
publish_path = "/revisions/:eitriAppId/publish"
|
|
48
|
+
application_by_id_path = "/applications/:applicationId"
|
|
48
49
|
|
|
49
50
|
[eitri_analytics]
|
|
50
51
|
url = "https://api.eitri.tech/analytics/event"
|
|
@@ -40,6 +40,7 @@ path = "/mini-log/socket.io"
|
|
|
40
40
|
url = "https://api.eitri.tech/eitri-manager-api"
|
|
41
41
|
revision_path = "/v2/revisions"
|
|
42
42
|
publish_path = "/revisions/:eitriAppId/publish"
|
|
43
|
+
application_by_id_path = "/applications/:applicationId"
|
|
43
44
|
|
|
44
45
|
[eitri_analytics]
|
|
45
46
|
url = "https://api.eitri.tech/analytics/event"
|
|
@@ -45,6 +45,7 @@ url = "https://api.eitri.tech/miniapp-manager-api"
|
|
|
45
45
|
url = "https://api.eitri.tech/eitri-manager-api"
|
|
46
46
|
revision_path = "/v2/revisions"
|
|
47
47
|
publish_path = "/revisions/:eitriAppId/publish"
|
|
48
|
+
application_by_id_path = "/applications/:applicationId"
|
|
48
49
|
|
|
49
50
|
[eitri_analytics]
|
|
50
51
|
url = "https://api.eitri.tech/analytics/event"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/eitri-cli-v2/index.d.ts
CHANGED
|
@@ -11,3 +11,6 @@ export function publish(environment: string, message: string): Promise<void>
|
|
|
11
11
|
export function runTest(userJwt: string, userWorkspaceId: string, testPath: string): Promise<void>
|
|
12
12
|
export function eitriLibs(eitriLibsArgs: EitriLibsArguments): Promise<void>
|
|
13
13
|
export function doctor(): Promise<void>
|
|
14
|
+
export namespace app {
|
|
15
|
+
export function start(): Promise<void>
|
|
16
|
+
}
|
package/eitri-cli-v2/index.js
CHANGED
|
@@ -295,9 +295,10 @@ if (!nativeBinding) {
|
|
|
295
295
|
throw new Error(`Failed to load native binding`)
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
const { publish, runTest, eitriLibs, doctor } = nativeBinding
|
|
298
|
+
const { publish, runTest, eitriLibs, doctor, app } = nativeBinding
|
|
299
299
|
|
|
300
300
|
module.exports.publish = publish
|
|
301
301
|
module.exports.runTest = runTest
|
|
302
302
|
module.exports.eitriLibs = eitriLibs
|
|
303
303
|
module.exports.doctor = doctor
|
|
304
|
+
module.exports.app = app
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const path = require("path");
|
|
|
7
7
|
const { workspace } = require("./src/service/Workspace");
|
|
8
8
|
const configService = require("./src/service/ConfigService");
|
|
9
9
|
const VegvisirCommand = require("./src/modules/vegvisir/VegvisirCommand");
|
|
10
|
+
const AppCommand = require("./src/modules/app/AppCommand");
|
|
10
11
|
const debug = require('debug')('eitri:run')
|
|
11
12
|
|
|
12
13
|
|
|
@@ -66,6 +67,7 @@ const run = async () => {
|
|
|
66
67
|
.option("-v, --verbose", "Exibe mais logs")
|
|
67
68
|
.option("-f, --force", "Força o start")
|
|
68
69
|
.option("-S, --show-deeplink", "Exibe o deep link do workspace")
|
|
70
|
+
.option("-sm, --skip-mini-log", "Skipa conexão com o mini-log")
|
|
69
71
|
.option(
|
|
70
72
|
"-P, --qr-printer <qrPrinter>",
|
|
71
73
|
"Indica qual programa imprimirá o QR Code. Se omitido, exibe o QrCode no terminal. Valores válidos: terminal|chrome|msedge|firefox"
|
|
@@ -141,7 +143,7 @@ const run = async () => {
|
|
|
141
143
|
.command("doctor")
|
|
142
144
|
.description("Valida as dependências externas para execução da CLI do Eitri")
|
|
143
145
|
.action(async (cmdObj) => {
|
|
144
|
-
if(NEW_CLI_VERSION){
|
|
146
|
+
if (NEW_CLI_VERSION) {
|
|
145
147
|
console.log("doctor (v2)")
|
|
146
148
|
const eitriCLIV2 = require('./eitri-cli-v2/index.js')
|
|
147
149
|
return await eitriCLIV2.doctor()
|
|
@@ -175,6 +177,7 @@ const run = async () => {
|
|
|
175
177
|
.action(async (cmdObj) => { return require("./src/cmd/runTests")(cmdObj) });
|
|
176
178
|
|
|
177
179
|
program.addCommand(VegvisirCommand());
|
|
180
|
+
program.addCommand(AppCommand());
|
|
178
181
|
|
|
179
182
|
if (
|
|
180
183
|
process.argv.length > 2 &&
|
package/package.json
CHANGED
package/src/cmd/start.js
CHANGED
|
@@ -10,7 +10,7 @@ const handleStartServer = require('../service/StarterService')
|
|
|
10
10
|
const TrackingEitriAnalytics = require('../service/TrackingEitriAnalytics')
|
|
11
11
|
const VegvisirService = require('../modules/vegvisir/VegvisirService')
|
|
12
12
|
const PrerequisitesValidator = require('../service/PrerequisitesValidator')
|
|
13
|
-
const {LogVerbose} = require('../util/LogUtil')
|
|
13
|
+
const { LogVerbose } = require('../util/LogUtil')
|
|
14
14
|
|
|
15
15
|
const blindGuardian = workspace.blindGuardian
|
|
16
16
|
const hashFolder = workspace.hashFolder
|
|
@@ -25,7 +25,7 @@ module.exports = async function start(args) {
|
|
|
25
25
|
const miniConf = workspace.getMiniConf()
|
|
26
26
|
|
|
27
27
|
await vegvisirService.isCurrentWorkspaceOwnedByUser(miniConf.slug)
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
const separator = '======================================================================='
|
|
30
30
|
let displayFriendlyErrorAtEnd = ""
|
|
31
31
|
|
|
@@ -45,11 +45,11 @@ module.exports = async function start(args) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
await vegvisirService.check(miniConf.slug)
|
|
48
|
-
debug("Fim da busca e validação do EitriAppConf", {miniConf})
|
|
49
|
-
|
|
48
|
+
debug("Fim da busca e validação do EitriAppConf", { miniConf })
|
|
49
|
+
|
|
50
50
|
const url = config.get('workspace').url
|
|
51
51
|
const setupResult = await workspace.setup()
|
|
52
|
-
debug("Informações do setupResult do workspace", {setupResult})
|
|
52
|
+
debug("Informações do setupResult do workspace", { setupResult })
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
const target = setupResult.target.name
|
|
@@ -64,23 +64,25 @@ module.exports = async function start(args) {
|
|
|
64
64
|
workspace.setServerUrl(url)
|
|
65
65
|
workspace.setQrCodeUrl(qrCodeUrl)
|
|
66
66
|
|
|
67
|
-
debug("Iniciando workspace", {workspace})
|
|
67
|
+
debug("Iniciando workspace", { workspace })
|
|
68
68
|
await workspace.init()
|
|
69
|
-
debug("Workspace iniciado", {workspace})
|
|
69
|
+
debug("Workspace iniciado", { workspace })
|
|
70
70
|
|
|
71
71
|
const silentOnConnect = args.verbose ? false : true
|
|
72
72
|
const userWorkspace = await vegvisirService.getWorkspace()
|
|
73
73
|
console.log(`Construindo para o Workspace [${userWorkspace.id}]`)
|
|
74
|
-
|
|
74
|
+
if (!args.skipMiniLog) {
|
|
75
|
+
await miniLog.connect(userWorkspace.id, silentOnConnect)
|
|
76
|
+
}
|
|
75
77
|
|
|
76
78
|
LogVerbose(args.verbose, "Construindo...");
|
|
77
79
|
const isDevMode = true
|
|
78
80
|
try {
|
|
79
|
-
debug("Iniciando workspace.uploadZip", {isDevMode, workspace})
|
|
81
|
+
debug("Iniciando workspace.uploadZip", { isDevMode, workspace })
|
|
80
82
|
await workspace.uploadZip(isDevMode);
|
|
81
83
|
} catch (error) {
|
|
82
|
-
debug("Erro no workspace.uploadZip", {isDevMode, workspace, error})
|
|
83
|
-
if(args.verbose){
|
|
84
|
+
debug("Erro no workspace.uploadZip", { isDevMode, workspace, error })
|
|
85
|
+
if (args.verbose) {
|
|
84
86
|
console.error("::uploadZip::", error?.message)
|
|
85
87
|
console.error(":::uploadZip::: ", error)
|
|
86
88
|
}
|
|
@@ -90,29 +92,29 @@ module.exports = async function start(args) {
|
|
|
90
92
|
const friendlyMessage3 = "Se o problema persistir, por favor, entre em contato com o suporte técnico do Eitri."
|
|
91
93
|
const friendlyMessage4 = "Você pode continuar o desenvolvimento localmente, mesmo que a sincronização não esteja disponível no momento."
|
|
92
94
|
displayFriendlyErrorAtEnd = `\x1b[1m\x1b[31m\n${friendlyMessage1}\n${friendlyMessage2} \x1b[0m` + "\n" + `\n${friendlyMessage3}\n${friendlyMessage4}\n\x1b[0m`
|
|
93
|
-
|
|
95
|
+
|
|
94
96
|
const errorData = error.response.data
|
|
95
97
|
const commonStartErrors = ['CodeCompileError', 'TagNotFound']
|
|
96
|
-
if(commonStartErrors.includes(errorData.name)) {
|
|
98
|
+
if (commonStartErrors.includes(errorData.name)) {
|
|
97
99
|
displayFriendlyErrorAtEnd += `\n\x1b[1m\x1b[31mMotivo: ${errorData.friendlyMessage}\x1b[0m\n`;
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
console.log("Pronto!\n");
|
|
101
103
|
|
|
102
104
|
const loadedTarget = await workspace.getTarget()
|
|
103
|
-
debug("Target carregado do workspace", {loadedTarget})
|
|
105
|
+
debug("Target carregado do workspace", { loadedTarget })
|
|
104
106
|
|
|
105
107
|
const platform = loadedTarget.platform
|
|
106
108
|
const argsWithDeeplinks = {
|
|
107
109
|
...args,
|
|
108
110
|
deepLinks: loadedTarget?.deepLinks || []
|
|
109
111
|
}
|
|
110
|
-
debug("Iniciando servidor", {argsWithDeeplinks, trackingService, watcher, workspace, target, setupResult, platform})
|
|
112
|
+
debug("Iniciando servidor", { argsWithDeeplinks, trackingService, watcher, workspace, target, setupResult, platform })
|
|
111
113
|
await handleStartServer(argsWithDeeplinks, trackingService, watcher, workspace, target, setupResult, platform)
|
|
112
|
-
debug("Servidor iniciado", {loadedTarget})
|
|
114
|
+
debug("Servidor iniciado", { loadedTarget })
|
|
113
115
|
|
|
114
116
|
TrackingEitriAnalytics.sendEvent({
|
|
115
|
-
eventName:"start",
|
|
117
|
+
eventName: "start",
|
|
116
118
|
userId: workspace?.userEmail,
|
|
117
119
|
data: {
|
|
118
120
|
workspaceId: userWorkspace.id,
|
|
@@ -121,7 +123,7 @@ module.exports = async function start(args) {
|
|
|
121
123
|
}
|
|
122
124
|
})
|
|
123
125
|
} catch (e) {
|
|
124
|
-
debug("Erro no processo de start", {message: e?.message, error: e})
|
|
126
|
+
debug("Erro no processo de start", { message: e?.message, error: e })
|
|
125
127
|
TrackingEitriAnalytics.sendEvent({
|
|
126
128
|
eventName: "start.error",
|
|
127
129
|
userId: workspace?.userEmail,
|
|
@@ -149,8 +151,8 @@ module.exports = async function start(args) {
|
|
|
149
151
|
await trackingService.sendError(e)
|
|
150
152
|
|
|
151
153
|
process.exit(1)
|
|
152
|
-
} finally{
|
|
153
|
-
if(displayFriendlyErrorAtEnd){
|
|
154
|
+
} finally {
|
|
155
|
+
if (displayFriendlyErrorAtEnd) {
|
|
154
156
|
const folderHash = workspace.getFolderHashPath()
|
|
155
157
|
await workspace.transpile([folderHash])
|
|
156
158
|
console.log("\n\n" + separator + "\n" + displayFriendlyErrorAtEnd + "\n" + separator + "\n\n")
|
package/src/cmd/validate.js
CHANGED
|
@@ -9,10 +9,10 @@ module.exports.SLUG_REGEX = SLUG_REGEX
|
|
|
9
9
|
|
|
10
10
|
module.exports.assertCommandNotRunning = function (commandName) {
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
12
|
-
ps.lookup({command: 'node'}, (err, processes) => {
|
|
12
|
+
ps.lookup({ command: 'node' }, (err, processes) => {
|
|
13
13
|
if (err) throw new Error('erro ao executar comando')
|
|
14
14
|
|
|
15
|
-
console.log('\x1b[1m\x1b[
|
|
15
|
+
console.log('\x1b[1m\x1b[34mIniciando Eitri builder\x1b[0m');
|
|
16
16
|
|
|
17
17
|
const runningProcesses = processes.filter((process) => {
|
|
18
18
|
let isAmeToolsRunning = false
|
|
@@ -34,7 +34,7 @@ module.exports.assertCommandNotRunning = function (commandName) {
|
|
|
34
34
|
// reject()
|
|
35
35
|
// process.exit(1)
|
|
36
36
|
// } else {
|
|
37
|
-
|
|
37
|
+
resolve()
|
|
38
38
|
// }
|
|
39
39
|
})
|
|
40
40
|
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const commander = require("commander");
|
|
2
|
+
module.exports = function AppCommand() {
|
|
3
|
+
const app = commander.command("app")
|
|
4
|
+
.description("Gerencia os workspaces do desenvolvedor, para mais informações execute 'eitri workspace --help'")
|
|
5
|
+
|
|
6
|
+
app
|
|
7
|
+
.command("start")
|
|
8
|
+
.description("Lista os workspaces do usuário")
|
|
9
|
+
.action(async (cmdObj) => {
|
|
10
|
+
const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
|
|
11
|
+
await eitriCLIV2.app.start(cmdObj)
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return app;
|
|
15
|
+
};
|