eitri-cli 1.0.5 → 1.1.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/.vscode/settings.json +5 -0
- package/config/dev.js +13 -3
- package/config/loc-eitri.js +19 -8
- package/config/prod-eitri.js +13 -3
- package/index.js +115 -66
- package/package.json +1 -1
- package/src/cmd/create.js +185 -162
- package/src/cmd/push-version.js +24 -15
- package/src/cmd/start.js +15 -8
- package/src/modules/vegvisir/VegvisirCommand.js +38 -0
- package/src/modules/vegvisir/VegvisirService.js +71 -0
- package/src/modules/vegvisir/cmd/create.js +43 -0
- package/src/modules/vegvisir/cmd/current.js +22 -0
- package/src/modules/vegvisir/cmd/list.js +13 -0
- package/src/modules/vegvisir/cmd/use.js +71 -0
- package/src/service/EitriAppManager.js +32 -0
- package/src/service/Http.js +45 -14
- package/src/service/Server.js +14 -38
- package/src/service/Workspace.js +767 -586
- package/src/service/factories/MiniWebAppFactory.js +4 -3
- package/src/service/factories/WoodCoffeeFactory.js +170 -123
- package/src/util/getCreateFactory.js +2 -2
- package/src/util/getWorkspace.js +38 -0
- package/test/Factory.js +13 -0
- package/test/_fixtures/woodcoffee/miniapp.conf.js +3 -1
- package/test/modules/vegvisir/VegvisirService.test.js +37 -0
- package/test/utils/getWorkspaceId.test.js +16 -0
package/config/dev.js
CHANGED
|
@@ -20,8 +20,8 @@ const config = {
|
|
|
20
20
|
},
|
|
21
21
|
workspace: {
|
|
22
22
|
url: `https://${HOST}`,
|
|
23
|
-
basePath: '
|
|
24
|
-
targetPath: '/
|
|
23
|
+
basePath: 'foundry',
|
|
24
|
+
targetPath: '/foundry/targets',
|
|
25
25
|
target: {
|
|
26
26
|
knownTargets: [
|
|
27
27
|
{
|
|
@@ -85,7 +85,17 @@ const config = {
|
|
|
85
85
|
url: `https://admin.${HOST}`,
|
|
86
86
|
managerCredential: "/settings/manager-credential",
|
|
87
87
|
cliGenerateLoginCredential: "/settings/cli-generate-credential",
|
|
88
|
-
}
|
|
88
|
+
},
|
|
89
|
+
vegvisir: {
|
|
90
|
+
url: `https://${HOST}`,
|
|
91
|
+
basePath: "/eitri-vegvisir-api",
|
|
92
|
+
workspace: "/workspace",
|
|
93
|
+
my: "/workspace/my",
|
|
94
|
+
check: "/workspace/check",
|
|
95
|
+
},
|
|
96
|
+
eitriManager: {
|
|
97
|
+
url: `https://${HOST}/eitri-manager-api`,
|
|
98
|
+
},
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
module.exports = config
|
package/config/loc-eitri.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const ipv4 = require('../src/util/ipv4')
|
|
2
2
|
const HOST = ipv4()[0]
|
|
3
3
|
const packageJson = require('../package.json')
|
|
4
|
-
const PORT = process.env.
|
|
4
|
+
const PORT = process.env.EITRI_APP_TOOLS_PORT || 3333
|
|
5
5
|
const path = require('path')
|
|
6
|
-
const
|
|
6
|
+
const HOST_EITRIAPPS = 'dev.eitri.calindra.com.br'
|
|
7
7
|
|
|
8
8
|
const config = {
|
|
9
9
|
userAgent: packageJson.name,
|
|
@@ -15,14 +15,15 @@ const config = {
|
|
|
15
15
|
createUrl: 'https://developer.eitri.calindra.com.br/#/?id=create'
|
|
16
16
|
},
|
|
17
17
|
blindGuardian: {
|
|
18
|
-
url: `https://${
|
|
18
|
+
url: `https://${HOST_EITRIAPPS}/blind-guardian-api`
|
|
19
19
|
},
|
|
20
20
|
shareApi: {
|
|
21
|
-
url: `https://${
|
|
21
|
+
url: `https://${HOST_EITRIAPPS}/share-api/share`,
|
|
22
22
|
},
|
|
23
23
|
workspace: {
|
|
24
24
|
url: `http://${HOST}:3000`,
|
|
25
|
-
targetPath: '/
|
|
25
|
+
targetPath: '/runes-foundry/targets',
|
|
26
|
+
basePath: 'runes-foundry',
|
|
26
27
|
target: {
|
|
27
28
|
knownTargets: [
|
|
28
29
|
{
|
|
@@ -58,11 +59,11 @@ const config = {
|
|
|
58
59
|
url: 'https://prod.eitri.calindra.com.br/workspace/share',
|
|
59
60
|
},
|
|
60
61
|
miniLog: {
|
|
61
|
-
url: `https://${
|
|
62
|
+
url: `https://${HOST_EITRIAPPS}/mini-log/rooms`,
|
|
62
63
|
path: '/mini-log/socket.io'
|
|
63
64
|
},
|
|
64
65
|
managerApi: {
|
|
65
|
-
url: `https://${
|
|
66
|
+
url: `https://${HOST_EITRIAPPS}/miniapp-manager-api`,
|
|
66
67
|
invites: {
|
|
67
68
|
send: '/p/invites',
|
|
68
69
|
slug: '/p/invites/s/:slug',
|
|
@@ -74,8 +75,11 @@ const config = {
|
|
|
74
75
|
miniAppsPath: '/o/mini-apps',
|
|
75
76
|
}
|
|
76
77
|
},
|
|
78
|
+
eitriManager: {
|
|
79
|
+
url: `https://${HOST_EITRIAPPS}/eitri-manager-api`
|
|
80
|
+
},
|
|
77
81
|
workspaceManager: {
|
|
78
|
-
url: `https://${
|
|
82
|
+
url: `https://${HOST_EITRIAPPS}`,
|
|
79
83
|
path: '/workspace-manager/socket.io',
|
|
80
84
|
contextPath: '/workspace-manager'
|
|
81
85
|
},
|
|
@@ -86,6 +90,13 @@ const config = {
|
|
|
86
90
|
url: `https://admin.${HOST}`,
|
|
87
91
|
managerCredential: "/settings/manager-credential",
|
|
88
92
|
cliGenerateLoginCredential: "/settings/cli-generate-credential",
|
|
93
|
+
},
|
|
94
|
+
vegvisir: {
|
|
95
|
+
url: `https://${HOST_EITRIAPPS}`,
|
|
96
|
+
basePath: "/eitri-vegvisir-api",
|
|
97
|
+
workspace: "/workspace",
|
|
98
|
+
my: "/workspace/my",
|
|
99
|
+
check: "/workspace/check",
|
|
89
100
|
}
|
|
90
101
|
}
|
|
91
102
|
|
package/config/prod-eitri.js
CHANGED
|
@@ -21,8 +21,8 @@ const config = {
|
|
|
21
21
|
},
|
|
22
22
|
workspace: {
|
|
23
23
|
url: `https://${HOST}`,
|
|
24
|
-
basePath: '
|
|
25
|
-
targetPath: '/
|
|
24
|
+
basePath: 'foundry',
|
|
25
|
+
targetPath: '/foundry/targets',
|
|
26
26
|
target: {
|
|
27
27
|
knownTargets: [
|
|
28
28
|
{
|
|
@@ -74,6 +74,9 @@ const config = {
|
|
|
74
74
|
miniAppsPath: '/o/mini-apps',
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
|
+
eitriManager: {
|
|
78
|
+
url: `https://${HOST_MINIAPPS}/eitri-manager-api`
|
|
79
|
+
},
|
|
77
80
|
workspaceManager: {
|
|
78
81
|
url: `https://${HOST_MINIAPPS}`,
|
|
79
82
|
path: '/workspace-manager/socket.io',
|
|
@@ -86,7 +89,14 @@ const config = {
|
|
|
86
89
|
url: `https://admin.eitri.calindra.com.br`,
|
|
87
90
|
managerCredential: "/settings/manager-credential",
|
|
88
91
|
cliGenerateLoginCredential: "/settings/cli-generate-credential",
|
|
89
|
-
}
|
|
92
|
+
},
|
|
93
|
+
vegvisir: {
|
|
94
|
+
url: `https://${HOST}`,
|
|
95
|
+
basePath: "/eitri-vegvisir-api",
|
|
96
|
+
workspace: "/workspace",
|
|
97
|
+
my: "/workspace/my",
|
|
98
|
+
check: "/workspace/check",
|
|
99
|
+
},
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
module.exports = config
|
package/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
require(
|
|
2
|
-
process.env[
|
|
3
|
-
const commander = require(
|
|
4
|
-
const program = new commander.Command()
|
|
5
|
-
const emoji = require(
|
|
6
|
-
const path = require(
|
|
7
|
-
const {workspace} = require(
|
|
8
|
-
const config = require(
|
|
1
|
+
require("./check-version");
|
|
2
|
+
process.env["NODE_CONFIG_DIR"] = __dirname + "/config/";
|
|
3
|
+
const commander = require("commander");
|
|
4
|
+
const program = new commander.Command();
|
|
5
|
+
const emoji = require("emojilib");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const { workspace } = require("./src/service/Workspace");
|
|
8
|
+
const config = require("config");
|
|
9
|
+
const VegvisirCommand = require("./src/modules/vegvisir/VegvisirCommand");
|
|
9
10
|
|
|
10
11
|
const run = async () => {
|
|
11
12
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
workspace.
|
|
15
|
-
workspace.setServerUrl(`${config.get('workspace').url}`)
|
|
13
|
+
const srcFolder2watch = path.join(process.cwd(), "src");
|
|
14
|
+
workspace.setFolder2Watch(srcFolder2watch);
|
|
15
|
+
workspace.setServerUrl(`${config.get("workspace").url}`);
|
|
16
16
|
} catch (e) {
|
|
17
|
-
if (process.env.LOG_LEVEL ===
|
|
18
|
-
console.log(
|
|
17
|
+
if (process.env.LOG_LEVEL === "full") {
|
|
18
|
+
console.log("Current directory listening has failed", e);
|
|
19
19
|
}
|
|
20
20
|
// Continuando como antes...
|
|
21
21
|
}
|
|
@@ -28,55 +28,92 @@ const run = async () => {
|
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
program
|
|
31
|
-
.command(
|
|
32
|
-
.description(
|
|
31
|
+
.command("login")
|
|
32
|
+
.description(
|
|
33
|
+
"Configura suas credenciais de desenvolvedor no dispositivo local"
|
|
34
|
+
)
|
|
33
35
|
.action(async (cmdObj) => {
|
|
34
|
-
require(
|
|
35
|
-
})
|
|
36
|
+
require("./src/cmd/login")(cmdObj);
|
|
37
|
+
});
|
|
36
38
|
|
|
37
39
|
program
|
|
38
|
-
.command(
|
|
39
|
-
.description(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.option(
|
|
43
|
-
|
|
40
|
+
.command("create <project-name>")
|
|
41
|
+
.description(
|
|
42
|
+
`Cria um projeto com um mini app totalmente funcional. Mais detalhes em ${config?.doc?.createUrl}`
|
|
43
|
+
)
|
|
44
|
+
.option(
|
|
45
|
+
"--yes",
|
|
46
|
+
"Aceita os valores default para nome titulo e organizacao"
|
|
47
|
+
)
|
|
48
|
+
.option(
|
|
49
|
+
"--template <template-name>",
|
|
50
|
+
"Define um boilerplate para a criação do projeto"
|
|
51
|
+
)
|
|
52
|
+
.option("--target", "Define a plataforma de execução do Mini App")
|
|
53
|
+
.option("-v, --verbose", "Exibe mais logs")
|
|
44
54
|
.action((projectName, cmdObj) => {
|
|
45
|
-
require(
|
|
46
|
-
})
|
|
55
|
+
require("./src/cmd/create")(projectName, cmdObj);
|
|
56
|
+
});
|
|
47
57
|
|
|
48
58
|
let startProgram = program
|
|
49
|
-
.command(
|
|
50
|
-
.description(
|
|
51
|
-
.option(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
.option(
|
|
56
|
-
.option(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.option(
|
|
61
|
-
.option(
|
|
62
|
-
.option(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
.command("start")
|
|
60
|
+
.description("Inicia o seu mini app em um workspace online")
|
|
61
|
+
.option(
|
|
62
|
+
"-A, --upload-all",
|
|
63
|
+
"(Obsoleto) Sobe todos os arquivos. O mesmo funcionamento é garantido usando-o ou não"
|
|
64
|
+
)
|
|
65
|
+
.option("-v, --verbose", "Exibe mais logs")
|
|
66
|
+
.option(
|
|
67
|
+
"-N, --new-qrcode",
|
|
68
|
+
"(Obsoleto) Novo qrcode. O mesmo funcionamento é garantido usando-o ou não"
|
|
69
|
+
)
|
|
70
|
+
.option("-Q, --old-qrcode", "QR Code legado")
|
|
71
|
+
.option("-f, --force", "Força o start")
|
|
72
|
+
.option("-S, --show-deeplink", "Exibe o deep link do workspace")
|
|
73
|
+
.option(
|
|
74
|
+
"-z, --zip",
|
|
75
|
+
"(Obsoleto) Envia os arquivos do projeto compactados para o compilador. O mesmo funcionamento é garantido usando-o ou não"
|
|
76
|
+
)
|
|
77
|
+
.option(
|
|
78
|
+
"-U, --unzip",
|
|
79
|
+
"Faz o upload descompactado, arquivo a arquivo, para o compilador"
|
|
80
|
+
)
|
|
81
|
+
.option(
|
|
82
|
+
"-P, --qr-printer <qrPrinter>",
|
|
83
|
+
"Indica qual programa imprimirá o QR Code. Se omitido, abre o browser default do usuário. Valores válidos: terminal|chrome|msedge|firefox"
|
|
84
|
+
)
|
|
85
|
+
.option("-e, --emulator", "Simula o ambiente de exibição do Mini App.")
|
|
86
|
+
.option(
|
|
87
|
+
"-c, --target-config <config>",
|
|
88
|
+
"Define uma configuração específica para o target do mini-app. Visite nossa documentação on-line para conhecer os cenários em que é necessário utilizar um target-config.",
|
|
89
|
+
"default"
|
|
90
|
+
)
|
|
91
|
+
.option(
|
|
92
|
+
"-l, --list-target-configs",
|
|
93
|
+
"Exibe lista de configurações cadastradas para o target do miniapp"
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
startProgram.action((cmdObj) => {
|
|
66
97
|
if (cmdObj.zip) {
|
|
67
|
-
console.log(
|
|
98
|
+
console.log(
|
|
99
|
+
"Uso de -z ou --zip é redundante. O eitri-app-tools já envia para o compilador os arquivos compactados."
|
|
100
|
+
);
|
|
68
101
|
}
|
|
69
102
|
|
|
70
103
|
if (cmdObj.newQrcode) {
|
|
71
|
-
console.log(
|
|
104
|
+
console.log(
|
|
105
|
+
"Uso de -N ou --new-qrcode é redundante. O eitri-app-tools já otimiza o Qr Code."
|
|
106
|
+
);
|
|
72
107
|
}
|
|
73
108
|
|
|
74
109
|
if (cmdObj.uploadAll) {
|
|
75
|
-
console.log(
|
|
110
|
+
console.log(
|
|
111
|
+
"Uso de -A ou --upload-all é redundante. O eitri-app-tools já faz o envio em lote dos arquivos do projeto"
|
|
112
|
+
);
|
|
76
113
|
}
|
|
77
114
|
|
|
78
|
-
require(
|
|
79
|
-
})
|
|
115
|
+
require("./src/cmd/start")(cmdObj);
|
|
116
|
+
});
|
|
80
117
|
|
|
81
118
|
// program
|
|
82
119
|
// .command('test-initialization-params <initializationParams>')
|
|
@@ -103,15 +140,24 @@ const run = async () => {
|
|
|
103
140
|
// })
|
|
104
141
|
|
|
105
142
|
program
|
|
106
|
-
.command(
|
|
107
|
-
.description(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
.option(
|
|
111
|
-
.option(
|
|
112
|
-
.
|
|
113
|
-
|
|
114
|
-
|
|
143
|
+
.command("push-version")
|
|
144
|
+
.description(
|
|
145
|
+
"Cria e envia um build do mini app para ser avaliado por um revisor antes de ser publicado"
|
|
146
|
+
)
|
|
147
|
+
.option("-l, --local", "Aponta para o servidor local")
|
|
148
|
+
.option("-v, --verbose", "Exibe mais logs")
|
|
149
|
+
.option(
|
|
150
|
+
"-c, --components",
|
|
151
|
+
"Publica o Eitri-App como biblioteca de components"
|
|
152
|
+
)
|
|
153
|
+
.option(
|
|
154
|
+
"-m, --message <revision-message>",
|
|
155
|
+
"Adiciona comentários ao build"
|
|
156
|
+
)
|
|
157
|
+
.option("-y, --yes", "Aceita automaticamente as respostas do prompt.")
|
|
158
|
+
.action((cmdObj) => {
|
|
159
|
+
require("./src/cmd/push-version")(cmdObj);
|
|
160
|
+
});
|
|
115
161
|
|
|
116
162
|
// program
|
|
117
163
|
// .command('clean')
|
|
@@ -124,8 +170,8 @@ const run = async () => {
|
|
|
124
170
|
// })
|
|
125
171
|
|
|
126
172
|
program
|
|
127
|
-
.command(
|
|
128
|
-
.description(
|
|
173
|
+
.command("self-update")
|
|
174
|
+
.description("Desinstala a versao antiga e instala a mais nova")
|
|
129
175
|
.action(() => {
|
|
130
176
|
require('child_process').execSync(
|
|
131
177
|
'npm uninstall -g eitri-cli && npm i eitri-cli -g',
|
|
@@ -166,19 +212,22 @@ const run = async () => {
|
|
|
166
212
|
// if (!process.argv.slice(2).length) {
|
|
167
213
|
// program.outputHelp()
|
|
168
214
|
// }
|
|
215
|
+
|
|
216
|
+
program.addCommand(VegvisirCommand());
|
|
217
|
+
|
|
169
218
|
if (
|
|
170
219
|
process.argv.length > 2 &&
|
|
171
|
-
!program.commands.map(cmd => cmd._name).includes(process.argv[2])
|
|
220
|
+
!program.commands.map((cmd) => cmd._name).includes(process.argv[2])
|
|
172
221
|
) {
|
|
173
|
-
if (!process.argv[2].startsWith(
|
|
222
|
+
if (!process.argv[2].startsWith("-")) {
|
|
174
223
|
console.log(
|
|
175
224
|
`\n ${emoji.lib.rotating_light.char} Comando ${process.argv[2]} inexistente.\n`
|
|
176
|
-
)
|
|
177
|
-
program.help()
|
|
225
|
+
);
|
|
226
|
+
program.help();
|
|
178
227
|
}
|
|
179
228
|
}
|
|
180
229
|
|
|
181
|
-
program.parse(process.argv)
|
|
182
|
-
}
|
|
230
|
+
program.parse(process.argv);
|
|
231
|
+
};
|
|
183
232
|
|
|
184
|
-
module.exports = run
|
|
233
|
+
module.exports = run;
|