eitri-cli 1.16.1 → 1.17.0-beta.10

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/.eslintrc.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "root": true,
3
+ "extends": ["eslint:recommended", "google", "plugin:prettier/recommended", "plugin:jest/recommended"],
4
+ "plugins": ["prettier", "jest"],
5
+ "env": {
6
+ "es6": true,
7
+ "node": true
8
+ },
9
+ "globals": {
10
+ "Atomics": "readonly",
11
+ "SharedArrayBuffer": "readonly"
12
+ },
13
+ "parserOptions": {
14
+ "sourceType": "commonjs"
15
+ },
16
+ "rules": {
17
+ "jest/no-conditional-expect": "warn",
18
+ "jest/no-focused-tests": "warn",
19
+ "prefer-const": "warn",
20
+ "prefer-rest-params": "warn",
21
+ "no-unused-expressions": "error",
22
+ "no-undef": "error",
23
+ "prettier/prettier": "error",
24
+ "no-console": "off"
25
+ }
26
+ }
package/.prettierrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "printWidth": 130,
3
+ "tabWidth": 4,
4
+ "singleQuote": false,
5
+ "semi": false
6
+ }
@@ -30,7 +30,7 @@ urlencoding = "2.1.3"
30
30
  url-parse = "1.0.7"
31
31
  config = "0.14.0"
32
32
  futures-util = "0.3.30"
33
- rust_socketio = { version = "0.4.2", features = ["async"] }
33
+ rust_socketio = { version = "0.6.0", features = ["async"] }
34
34
  log = "0.4.21"
35
35
  env_logger = "0.11.3"
36
36
  crossterm = "0.27.0"
@@ -41,6 +41,7 @@ zip = "2.1.0"
41
41
  sha1 = "0.10.6"
42
42
  file-hashing = "0.1.2"
43
43
  qr2term = "0.3.1"
44
+ fs_extra = "1.3.0"
44
45
 
45
46
  [dependencies.uuid]
46
47
  version = "1.8.0"
@@ -27,6 +27,7 @@ setup = "/v2/workspace/setup"
27
27
  version = "/version"
28
28
  upload_all = "/uploadAll"
29
29
  file_upload = "/fileupload"
30
+ setup_app = "/v2/workspace/setup-app"
30
31
 
31
32
  [foundry.libs]
32
33
  update_libs_endpoint_version = "application/vnd.workspace.api.v2+json"
@@ -27,6 +27,7 @@ setup = "/v2/workspace/setup"
27
27
  version = "/version"
28
28
  upload_all = "/uploadAll"
29
29
  file_upload = "/fileupload"
30
+ setup_app = "/v2/workspace/setup-app"
30
31
 
31
32
 
32
33
  [foundry.libs]
@@ -27,6 +27,7 @@ setup = "/v2/workspace/setup"
27
27
  version = "/version"
28
28
  upload_all = "/uploadAll"
29
29
  file_upload = "/fileupload"
30
+ setup_app = "/v2/workspace/setup-app"
30
31
 
31
32
 
32
33
  [foundry.libs]
@@ -39,7 +40,7 @@ upload_file = "/uploadSingle"
39
40
  watch_user_dir = "/server"
40
41
 
41
42
  [mini_log]
42
- url = "https://prod.eitri.calindra.com.br/mini-log"
43
+ url = "https://api.eitri.tech/mini-log"
43
44
  path = "/socket.io/"
44
45
  rooms = "/mini-log/rooms"
45
46
 
@@ -11,3 +11,4 @@ setup = "/v2/workspace/setup"
11
11
  version = "/version"
12
12
  upload_all = "/uploadAll"
13
13
  file_upload = "/fileupload"
14
+ setup_app = "/v2/workspace/setup-app"
@@ -27,6 +27,7 @@ setup = "/v2/workspace/setup"
27
27
  version = "/version"
28
28
  upload_all = "/uploadAll"
29
29
  file_upload = "/fileupload"
30
+ setup_app = "/v2/workspace/setup-app"
30
31
 
31
32
 
32
33
  [foundry.libs]
@@ -6,6 +6,8 @@
6
6
  export interface StartArguments {
7
7
  shared?: boolean
8
8
  verbose?: boolean
9
+ playground?: boolean
10
+ initializationParams?: string
9
11
  }
10
12
  export interface EitriLibsArguments {
11
13
  bifrost?: boolean
@@ -17,8 +19,9 @@ export function eitriLibs(eitriLibsArgs: EitriLibsArguments): Promise<void>
17
19
  export function doctor(): Promise<void>
18
20
  export function start(args: StartArguments): Promise<void>
19
21
  export namespace app {
20
- export function start(): Promise<void>
22
+ export function start(args: StartArguments): Promise<void>
21
23
  export function appLogs(): Promise<void>
24
+ export function clean(): Promise<void>
22
25
  }
23
26
  export namespace workspace {
24
27
  export function clean(): Promise<void>
package/index.js CHANGED
@@ -42,14 +42,15 @@ const run = async () => {
42
42
  .option("--yes", "Aceita o redirecionamento para o console")
43
43
  .option("-v, --verbose", "Exibe mais logs")
44
44
  .action(async (cmdObj) => {
45
- const isLoginV2 = process.env.FT_LOGIN_V2
46
- if (isLoginV2) {
47
- console.log("\n\n Iniciando login (v2) \n");
48
- require("./src/cmd/loginV2")(cmdObj);
45
+ const isLoginV1 = process.env.FT_LOGIN_V1
46
+ if (isLoginV1) {
47
+ console.log("\n\n Iniciando login (@deprecated) \n");
48
+ require("./src/cmd/login")(cmdObj);
49
49
  return
50
50
  }
51
51
 
52
- require("./src/cmd/login")(cmdObj);
52
+ console.log("\n\n Iniciando login \n");
53
+ require("./src/cmd/loginV2")(cmdObj);
53
54
  });
54
55
 
55
56
  program
@@ -73,8 +74,12 @@ const run = async () => {
73
74
  .option("-S, --show-deeplink", "Exibe o deep link do workspace")
74
75
  .option("-sm, --skip-mini-log", "Skipa conexão com o mini-log")
75
76
  .option(
76
- "-P, --qr-printer <qrPrinter>",
77
- "Indica qual programa imprimirá o QR Code. Se omitido, exibe o QrCode no terminal. Valores válidos: terminal|chrome|msedge|firefox"
77
+ "-p, --playground",
78
+ "Gera um QR code com a URL de abertura do Eitri Playground"
79
+ )
80
+ .option(
81
+ "-i, --initializationParams <initializationParams>",
82
+ "Define os parâmetros de inicialização do Eitri-App"
78
83
  )
79
84
  .option(
80
85
  "-e, --emulator <platform>",
@@ -90,14 +95,6 @@ const run = async () => {
90
95
  require("./src/cmd/start")(cmdObj);
91
96
  });
92
97
 
93
- program
94
- .command('test-initialization-params <initializationParams>')
95
- .option("-v, --verbose", "Exibe mais logs")
96
- .description('Define parâmetros na query string para inicializar o Eitri-App. Exemplo: stringChave1=stringValor1&stringChave2=stringValor2...')
97
- .action((initializationParams, cmdObj) => {
98
- require('./src/cmd/test-initialization-params')(initializationParams, cmdObj)
99
- })
100
-
101
98
  program
102
99
  .command("push-version")
103
100
  .description(
package/package.json CHANGED
@@ -1,93 +1,97 @@
1
1
  {
2
- "name": "eitri-cli",
3
- "version": "1.16.1",
4
- "description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
5
- "main": "index.js",
6
- "bin": {
7
- "eitri": "index-eitri.js"
8
- },
9
- "scripts": {
10
- "test-eitri": "NODE_APP_INSTANCE=eitri jest --detectOpenHandles",
11
- "test": "NODE_APP_INSTANCE=eitri jest --detectOpenHandles",
12
- "linter": "./node_modules/.bin/eslint --fix ./src/**/*.js",
13
- "docsify:run": "cd docsify && docsify serve",
14
- "build": "echo \"no build\"",
15
- "release": "semantic-release",
16
- "release:dry": "semantic-release --dry-run"
17
- },
18
- "engines": {
19
- "node": ">=16.0.0",
20
- "npm": ">=3.0.0"
21
- },
22
- "keywords": [],
23
- "author": "Calindra",
24
- "license": "ISC",
25
- "lint-staged": {
26
- "*.js": [
27
- "./node_modules/.bin/eslint --fix",
28
- "git add"
29
- ]
30
- },
31
- "dependencies": {
32
- "adm-zip": "^0.5.9",
33
- "axios": "0.21.3",
34
- "axios-cookiejar-support": "^0.5.1",
35
- "base-64": "^0.1.0",
36
- "base64url": "^3.0.1",
37
- "camelcase": "^6.3.0",
38
- "chalk": "^3.0.0",
39
- "cheerio": "^1.0.0-rc.3",
40
- "cli-progress": "^3.4.0",
41
- "commander": "^9.2.0",
42
- "config": "^3.3.0",
43
- "cors": "^2.8.5",
44
- "emojilib": "^2.4.0",
45
- "express": "^4.17.3",
46
- "express-rate-limit": "^6.3.0",
47
- "figlet": "^1.2.4",
48
- "folder-hash": "^3.3.0",
49
- "form-data": "^4.0.0",
50
- "inquirer": "^7.0.0",
51
- "js-yaml": "^4.1.0",
52
- "jsonwebtoken": "^8.5.1",
53
- "lz-string": "^1.5.0",
54
- "node-watch": "^0.6.3",
55
- "open": "^7.0.0",
56
- "ps-node": "^0.1.6",
57
- "qrcode": "^1.5.3",
58
- "semver": "^7.1.3",
59
- "slugify": "^1.4.0",
60
- "socket.io-client": "^4.5.2",
61
- "standard-version": "^9.5.0",
62
- "temp-dir": "^2.0.0",
63
- "tmp": "^0.1.0",
64
- "tough-cookie": "^3.0.1",
65
- "tough-cookie-file-store": "^2.0.2",
66
- "uuid": "^7.0.2",
67
- "yaml": "^2.4.2"
68
- },
69
- "devDependencies": {
70
- "@commitlint/cli": "^17.7.2",
71
- "@commitlint/config-conventional": "^17.7.0",
72
- "@faker-js/faker": "^7.6.0",
73
- "@semantic-release/changelog": "^6.0.3",
74
- "@semantic-release/git": "^10.0.1",
75
- "docsify-cli": "^4.4.4",
76
- "eslint": "^6.7.2",
77
- "eslint-config-google": "^0.14.0",
78
- "husky": "^8.0.3",
79
- "jest": "^29.7.0",
80
- "lint-staged": "^9.5.0",
81
- "nock": "^13.3.0",
82
- "puppeteer": "^21.4.1",
83
- "semantic-release": "^22.0.8"
84
- },
85
- "resolutions": {
86
- "lodash": "4.17.21",
87
- "minimist": "1.2.6",
88
- "ansi-regex": "5.0.1",
89
- "merge": "2.1.1",
90
- "tar": "6.1.9",
91
- "handlebars": "4.7.7"
92
- }
2
+ "name": "eitri-cli",
3
+ "version": "1.17.0-beta.10",
4
+ "description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "eitri": "index-eitri.js"
8
+ },
9
+ "scripts": {
10
+ "test-eitri": "NODE_APP_INSTANCE=eitri jest --detectOpenHandles",
11
+ "test": "NODE_APP_INSTANCE=eitri jest --detectOpenHandles",
12
+ "linter": "./node_modules/.bin/eslint --fix ./src/**/*.js",
13
+ "docsify:run": "cd docsify && docsify serve",
14
+ "build": "echo \"no build\"",
15
+ "release": "semantic-release",
16
+ "release:dry": "semantic-release --dry-run"
17
+ },
18
+ "engines": {
19
+ "node": ">=16.0.0",
20
+ "npm": ">=3.0.0"
21
+ },
22
+ "keywords": [],
23
+ "author": "Calindra",
24
+ "license": "ISC",
25
+ "lint-staged": {
26
+ "*.js": [
27
+ "./node_modules/.bin/eslint --fix",
28
+ "git add"
29
+ ]
30
+ },
31
+ "dependencies": {
32
+ "adm-zip": "^0.5.9",
33
+ "axios": "^1.7.2",
34
+ "axios-cookiejar-support": "^5.0.2",
35
+ "base-64": "^0.1.0",
36
+ "base64url": "^3.0.1",
37
+ "camelcase": "^6.3.0",
38
+ "chalk": "^3.0.0",
39
+ "cheerio": "^1.0.0-rc.3",
40
+ "cli-progress": "^3.4.0",
41
+ "commander": "^9.2.0",
42
+ "config": "^3.3.0",
43
+ "cors": "^2.8.5",
44
+ "emojilib": "^2.4.0",
45
+ "express": "^4.17.3",
46
+ "express-rate-limit": "^6.3.0",
47
+ "figlet": "^1.2.4",
48
+ "folder-hash": "^3.3.0",
49
+ "form-data": "^4.0.0",
50
+ "get-folder-size": "^2.0.1",
51
+ "inquirer": "^7.0.0",
52
+ "js-yaml": "^4.1.0",
53
+ "jsonwebtoken": "^9.0.2",
54
+ "lz-string": "^1.5.0",
55
+ "node-watch": "^0.6.3",
56
+ "open": "^7.0.0",
57
+ "ps-node": "^0.1.6",
58
+ "qrcode": "^1.5.3",
59
+ "semver": "^7.1.3",
60
+ "slugify": "^1.4.0",
61
+ "socket.io-client": "^4.5.2",
62
+ "standard-version": "^9.5.0",
63
+ "temp-dir": "^2.0.0",
64
+ "tmp": "^0.1.0",
65
+ "tough-cookie": "^4.1.4",
66
+ "tough-cookie-file-store": "^2.0.2",
67
+ "uuid": "^7.0.2",
68
+ "yaml": "^2.4.2"
69
+ },
70
+ "devDependencies": {
71
+ "@commitlint/cli": "^17.7.2",
72
+ "@commitlint/config-conventional": "^17.7.0",
73
+ "@faker-js/faker": "^7.6.0",
74
+ "@semantic-release/changelog": "^6.0.3",
75
+ "@semantic-release/git": "^10.0.1",
76
+ "docsify-cli": "^4.4.2",
77
+ "eslint": "^9.5.0",
78
+ "eslint-config-google": "^0.14.0",
79
+ "eslint-plugin-jest": "^28.6.0",
80
+ "eslint-plugin-prettier": "^5.1.3",
81
+ "husky": "^8.0.3",
82
+ "jest": "^29.7.0",
83
+ "lint-staged": "^9.5.0",
84
+ "nock": "^13.3.0",
85
+ "prettier": "^3.3.2",
86
+ "puppeteer": "^22.11.2",
87
+ "semantic-release": "^22.0.8"
88
+ },
89
+ "resolutions": {
90
+ "lodash": "4.17.21",
91
+ "minimist": "1.2.6",
92
+ "ansi-regex": "5.0.1",
93
+ "merge": "2.1.1",
94
+ "tar": "6.1.9",
95
+ "handlebars": "4.7.7"
96
+ }
93
97
  }
@@ -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
- const qrCodeUrl = config.get('qrCode').url
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
  };