eitri-cli 1.20.0 → 1.21.0-beta.2
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 +11 -2
- package/bitbucket-pipelines.yml +2 -2
- 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/index.js +2 -6
- package/package.json +2 -3
- package/src/cmd/runTests.js +1 -1
- package/src/cmd/start.js +1 -1
- package/src/service/PrerequisitesValidator.js +59 -20
package/.vscode/settings.json
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cSpell.words": [
|
|
2
|
+
"cSpell.words": [
|
|
3
|
+
"bifrost",
|
|
4
|
+
"eitri",
|
|
5
|
+
"luminus",
|
|
6
|
+
"miniapp",
|
|
7
|
+
"napi",
|
|
8
|
+
"Unmocked",
|
|
9
|
+
"vegvisir",
|
|
10
|
+
"Vegvisir"
|
|
11
|
+
],
|
|
3
12
|
"rust-analyzer.showUnlinkedFileNotification": false,
|
|
4
13
|
"cSpell.language": "en,pt,pt-BR"
|
|
5
|
-
}
|
|
14
|
+
}
|
package/bitbucket-pipelines.yml
CHANGED
|
@@ -17,7 +17,7 @@ pipelines:
|
|
|
17
17
|
- dig +short ns eitri.tech
|
|
18
18
|
- cd eitri-cli-v2
|
|
19
19
|
- npm i
|
|
20
|
-
- npm i puppeteer@
|
|
20
|
+
- npm i puppeteer@22.12.1
|
|
21
21
|
- npm run build:debug
|
|
22
22
|
- cd ..
|
|
23
23
|
- npm i
|
|
@@ -34,7 +34,7 @@ pipelines:
|
|
|
34
34
|
- dig +short ns eitri.tech
|
|
35
35
|
- cd eitri-cli-v2
|
|
36
36
|
- npm i
|
|
37
|
-
- npm i puppeteer@
|
|
37
|
+
- npm i puppeteer@22.12.1
|
|
38
38
|
- npm run build:debug
|
|
39
39
|
- cd ..
|
|
40
40
|
- yarn
|
package/eitri-cli-v2/Cargo.toml
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -88,12 +88,8 @@ const run = async () => {
|
|
|
88
88
|
.option("-sh, --shared", "Executa o Eitri-App no modo compartilhável.")
|
|
89
89
|
|
|
90
90
|
startProgram.action(async (cmdObj) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const eitriCLIV2 = require("./eitri-cli-v2/index.js");
|
|
94
|
-
return await eitriCLIV2.start(cmdObj);
|
|
95
|
-
}
|
|
96
|
-
require("./src/cmd/start")(cmdObj);
|
|
91
|
+
const eitriCLIV2 = require("./eitri-cli-v2/index.js");
|
|
92
|
+
return await eitriCLIV2.start(cmdObj);
|
|
97
93
|
});
|
|
98
94
|
|
|
99
95
|
program
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eitri-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0-beta.2",
|
|
4
4
|
"description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -73,7 +73,6 @@
|
|
|
73
73
|
"@faker-js/faker": "^7.6.0",
|
|
74
74
|
"@semantic-release/changelog": "^6.0.3",
|
|
75
75
|
"@semantic-release/git": "^10.0.1",
|
|
76
|
-
"docsify-cli": "^4.4.2",
|
|
77
76
|
"eslint": "^9.5.0",
|
|
78
77
|
"eslint-config-google": "^0.14.0",
|
|
79
78
|
"eslint-plugin-jest": "^28.6.0",
|
|
@@ -83,7 +82,7 @@
|
|
|
83
82
|
"lint-staged": "^9.5.0",
|
|
84
83
|
"nock": "^13.3.0",
|
|
85
84
|
"prettier": "^3.3.2",
|
|
86
|
-
"puppeteer": "
|
|
85
|
+
"puppeteer": "22.12.1",
|
|
87
86
|
"semantic-release": "^22.0.8"
|
|
88
87
|
},
|
|
89
88
|
"resolutions": {
|
package/src/cmd/runTests.js
CHANGED
|
@@ -46,7 +46,7 @@ module.exports = async function runTests(args) {
|
|
|
46
46
|
const separator = '======================================================================='
|
|
47
47
|
let displayFriendlyErrorAtEnd = ""
|
|
48
48
|
|
|
49
|
-
await prerequisitesValidator.checkAll()
|
|
49
|
+
await prerequisitesValidator.checkAll(args)
|
|
50
50
|
|
|
51
51
|
try {
|
|
52
52
|
if (!args.force) {
|
package/src/cmd/start.js
CHANGED
|
@@ -47,7 +47,7 @@ module.exports = async function start(args) {
|
|
|
47
47
|
const separator = '======================================================================='
|
|
48
48
|
let displayFriendlyErrorAtEnd = ""
|
|
49
49
|
|
|
50
|
-
await prerequisitesValidator.checkAll()
|
|
50
|
+
await prerequisitesValidator.checkAll(args)
|
|
51
51
|
|
|
52
52
|
try {
|
|
53
53
|
if (!args.force) {
|
|
@@ -12,43 +12,82 @@ class PrerequisitesValidator {
|
|
|
12
12
|
this.blindGuardian = workspace.blindGuardian;
|
|
13
13
|
this.http = new Http(workspace.blindGuardian);
|
|
14
14
|
this.userInfo = {id: "", email: ""}
|
|
15
|
+
this.userOrgsData = []
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
async checkAll() {
|
|
18
|
-
this.
|
|
18
|
+
async checkAll(args = {}) {
|
|
19
|
+
await this.checkConnection(args)
|
|
20
|
+
this.checkCredentials(args)
|
|
19
21
|
await this.isUserInOrg()
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
async checkConnection(args = {}) {
|
|
25
|
+
try {
|
|
26
|
+
if(args?.verbose) console.log("\n ↺ Verificando conexão com a internet...")
|
|
27
|
+
|
|
28
|
+
const respMyOrgsData = await this.http.get(`${MANAGER_URL}/users/me/organizations`);
|
|
29
|
+
this.userOrgsData = respMyOrgsData
|
|
30
|
+
|
|
31
|
+
if(args?.verbose) console.log("\n ✔ Conectado \n\n")
|
|
32
|
+
|
|
33
|
+
} catch (error) {
|
|
34
|
+
this.sendErrorToAnalytics("checkConnection.error", error)
|
|
35
|
+
|
|
36
|
+
if(args?.verbose) {
|
|
37
|
+
debug("ERRO na verificação de conexão", {message: error?.message, error})
|
|
38
|
+
console.error("\nError: \n", {message: error?.message, errorData: error?.response?.data})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const friendlyErrorMessage = `Não foi possível conectar. \n Por favor, verifique sua conexão com a internet e tente novamente.`
|
|
42
|
+
console.error(`\n\x1b[1m\x1b[31m ${friendlyErrorMessage} \x1b[0m\n`)
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
checkCredentials(args) {
|
|
23
48
|
try {
|
|
24
49
|
UserLocalCredential.checkForCredentials()
|
|
25
|
-
debug("
|
|
50
|
+
debug("Sucesso na checagem de credenciais")
|
|
26
51
|
} catch (error) {
|
|
27
52
|
this.sendErrorToAnalytics("checkCredentials.error", error)
|
|
28
53
|
|
|
29
|
-
|
|
30
|
-
console.
|
|
54
|
+
const friendlyErrorMessage = `Por favor, execute o comando 'eitri login' para configurar suas credenciais`
|
|
55
|
+
console.log(`\n\x1b[1m\x1b[31m${friendlyErrorMessage}\x1b[0m\n`);
|
|
56
|
+
|
|
57
|
+
if(args?.verbose) {
|
|
58
|
+
debug("ERRO na checagem de credenciais", {message: error?.message, error})
|
|
59
|
+
console.error("\nError: ", {message: error?.message, error})
|
|
60
|
+
}
|
|
61
|
+
|
|
31
62
|
process.exit(1);
|
|
32
63
|
}
|
|
33
64
|
}
|
|
34
65
|
|
|
35
66
|
async isUserInOrg() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
67
|
+
try {
|
|
68
|
+
const eitriAppConf = workspace.getMiniConf();
|
|
69
|
+
|
|
70
|
+
const respEitriAppData = await this.http.get(`${MANAGER_URL}/v2/eitri-apps/${eitriAppConf.id}`);
|
|
71
|
+
const respMyOrgsData = this.userOrgsData
|
|
72
|
+
|
|
73
|
+
const belongTo = respMyOrgsData?.some(org => org?.id === respEitriAppData?.organizationId)
|
|
74
|
+
const myOrgs = respMyOrgsData?.length > 0
|
|
75
|
+
if (myOrgs && belongTo) {
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
} catch (error) {
|
|
80
|
+
this.sendErrorToAnalytics("isUserInOrg.error", {organizations: this.userOrgsData})
|
|
40
81
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
82
|
+
if (args?.verbose) {
|
|
83
|
+
debug("ERRO na verificação de conexão", {message: error?.message, error})
|
|
84
|
+
console.error("\nError: \n", {message: error?.message, errorData: error?.response?.data})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const friendlyErrorMessage = `Você ainda não foi registrado em nenhuma organização ou não pertence a organização deste Eitri-App. \n Por favor, entre em contato com o administrador da sua organização.`
|
|
88
|
+
console.log(`\n\x1b[1m\x1b[31m ${friendlyErrorMessage} \x1b[0m\n`)
|
|
89
|
+
process.exit(1)
|
|
45
90
|
}
|
|
46
|
-
|
|
47
|
-
this.sendErrorToAnalytics("isUserInOrg.error", {confOrgId: respEitriAppData.organizationId, organizations: respMyOrgsData})
|
|
48
|
-
|
|
49
|
-
const friendlyErrorMessage = `Você ainda não foi registrado em nenhuma organização ou não pertence a organização deste Eitri-App. \n Por favor, entre em contato com o administrador da sua organização.`
|
|
50
|
-
console.log(`\n\x1b[1m\x1b[31m ${friendlyErrorMessage} \x1b[0m\n`)
|
|
51
|
-
process.exit(1)
|
|
52
91
|
}
|
|
53
92
|
|
|
54
93
|
async getUserBasicInfo() {
|