eitri-cli 1.10.0-beta.4 → 1.10.0
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/Cargo.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/src/commands/run_test.rs +7 -2
- package/eitri-cli-v2/src/infra/http_client.rs +9 -0
- package/eitri-cli-v2/src/services/eitri_foundry.rs +1 -0
- package/package.json +1 -1
- package/src/cmd/runTests.js +15 -0
- package/src/service/Workspace.js +29 -21
package/eitri-cli-v2/Cargo.toml
CHANGED
|
@@ -21,6 +21,7 @@ serde = { version = "1.0.197", features = ["derive"] }
|
|
|
21
21
|
serde_derive = "1.0.197"
|
|
22
22
|
serde_json = "1.0.114"
|
|
23
23
|
tokio = { version = "1.36.0", features = ["full"] }
|
|
24
|
+
colored = "2.0"
|
|
24
25
|
|
|
25
26
|
[target.x86_64-unknown-linux-gnu]
|
|
26
27
|
openssl = { version = "0.9", features = ["vendored"] }
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
use std::{env, process::exit};
|
|
2
|
+
use colored::*;
|
|
2
3
|
|
|
3
4
|
use crate::{
|
|
4
5
|
model::{url::Url, workspace_auth::WorkspaceAuth},
|
|
@@ -28,8 +29,12 @@ pub async fn execute(_workspace_auth: WorkspaceAuth, _path: String) {
|
|
|
28
29
|
let output_str = output.stderr;
|
|
29
30
|
eprint!("{output_str}");
|
|
30
31
|
}
|
|
31
|
-
Err(
|
|
32
|
-
|
|
32
|
+
Err(http_error) => {
|
|
33
|
+
if let Some(message) = http_error.get_message() {
|
|
34
|
+
eprintln!("{}", message.red().bold());
|
|
35
|
+
} else {
|
|
36
|
+
eprintln!("Houve um erro ao executar os testes.");
|
|
37
|
+
}
|
|
33
38
|
exit(1)
|
|
34
39
|
}
|
|
35
40
|
}
|
|
@@ -22,6 +22,15 @@ pub enum HttpError {
|
|
|
22
22
|
Deserialize(reqwest::Error),
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
impl HttpError {
|
|
26
|
+
pub fn get_message(&self) -> Option<&String> {
|
|
27
|
+
match self {
|
|
28
|
+
HttpError::HttpError(_, api_error) => Some(&api_error.message),
|
|
29
|
+
_ => None,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
#[allow(dead_code)]
|
|
26
35
|
pub async fn post<T, U>(url: &str, data: U, headers: HeaderMap) -> Result<T, HttpError>
|
|
27
36
|
where
|
package/package.json
CHANGED
package/src/cmd/runTests.js
CHANGED
|
@@ -26,6 +26,21 @@ module.exports = async function runTests(args) {
|
|
|
26
26
|
const miniConf = workspace.getMiniConf()
|
|
27
27
|
let testPath = ""
|
|
28
28
|
|
|
29
|
+
if (!Object.prototype.hasOwnProperty.call(miniConf, 'type')) {
|
|
30
|
+
const message = "Erro no arquivo eitri-app.conf.js: A propriedade 'type' não está presente."
|
|
31
|
+
console.log(`\x1b[1m\x1b[31m${message}\x1b[0m`);
|
|
32
|
+
process.exit(1)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
Object.prototype.hasOwnProperty.call(miniConf, 'type') &&
|
|
37
|
+
miniConf.type !== 'module'
|
|
38
|
+
) {
|
|
39
|
+
const message = " Os testes não podem ser executados devido à ausência do tipo 'module' no arquivo 'eitri-app.conf.js'. Certifique-se de incluir o atributo 'type' com o valor 'module' no arquivo de configuração para permitir a execução dos testes com sucesso."
|
|
40
|
+
console.log(`\x1b[1m\x1b[31m${message}\x1b[0m`);
|
|
41
|
+
process.exit(1)
|
|
42
|
+
}
|
|
43
|
+
|
|
29
44
|
await vegvisirService.isCurrentWorkspaceOwnedByUser(miniConf.slug)
|
|
30
45
|
|
|
31
46
|
const separator = '======================================================================='
|
package/src/service/Workspace.js
CHANGED
|
@@ -187,35 +187,43 @@ class Workspace {
|
|
|
187
187
|
const headers = {
|
|
188
188
|
accept: this.config.libs.updateLibsEndpointVersion,
|
|
189
189
|
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
try {
|
|
191
|
+
const setupResponse = await this.http.post(
|
|
192
|
+
`${this.serverUrl}/${this.basePath}/setup`,
|
|
193
|
+
miniConf,
|
|
194
|
+
headers
|
|
195
|
+
); // somente para garantir que a pasta do usuario existe
|
|
195
196
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
console.log("Preparando compilador");
|
|
198
|
+
await this.http.put(
|
|
199
|
+
`${this.serverUrl}/${this.basePath}/version`,
|
|
200
|
+
miniConf,
|
|
201
|
+
headers
|
|
202
|
+
); // TODO PDV Setup fara isso aqui
|
|
203
|
+
console.log("Compilador pronto para uso contínuo");
|
|
203
204
|
|
|
204
|
-
|
|
205
|
+
const setupData = setupResponse.data;
|
|
205
206
|
|
|
206
|
-
|
|
207
|
+
const { state, target: remoteTarget, eitriConf: remoteEitriConf } = setupData;
|
|
207
208
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
if (!this.eitriAppService.validEitriConf(miniConf)) {
|
|
210
|
+
await this.eitriAppService.writeEitriConf(remoteEitriConf, miniConf, this.folder2watch);
|
|
211
|
+
}
|
|
211
212
|
|
|
212
|
-
|
|
213
|
+
await LibsService.validateLibsVersions({ libs: state.libs, eitriAppConf: miniConf });
|
|
213
214
|
|
|
214
|
-
|
|
215
|
+
this.printLibsVersion(state);
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
await this.loadTarget(remoteTarget);
|
|
217
218
|
|
|
218
|
-
|
|
219
|
+
return setupData;
|
|
220
|
+
} catch (e) {
|
|
221
|
+
if (e.response && e.response.data && e.response.data.name === "WorkspaceService.setup.mismatchAppType") {
|
|
222
|
+
console.error(`\x1b[1m\x1b[31m${e.response.data.message}\x1b[0m`);
|
|
223
|
+
process.exit(1)
|
|
224
|
+
}
|
|
225
|
+
throw Error(e)
|
|
226
|
+
}
|
|
219
227
|
}
|
|
220
228
|
|
|
221
229
|
async loadTarget(remoteTarget) {
|