eitri-cli 1.11.0 → 1.12.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.
@@ -1,4 +1,8 @@
1
- image: node:18-buster
1
+ image:
2
+ name: 343482176926.dkr.ecr.us-east-1.amazonaws.com/eitri-base-cli-pipeline:latest
3
+ aws:
4
+ access-key: $EITRI_PROD_AWS_ACCESS_KEY_ID
5
+ secret-key: $EITRI_PROD_AWS_SECRET_ACCESS_KEY
2
6
  pipelines:
3
7
  custom:
4
8
  test-validation:
@@ -7,18 +11,6 @@ pipelines:
7
11
  caches:
8
12
  - node
9
13
  script:
10
- - apt-get update
11
- - apt-get install -y wget
12
- - wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
13
- - apt-get install -y ./google-chrome-stable_current_amd64.deb
14
- - export PUPPETEER_EXECUTABLE_PATH='/usr/bin/google-chrome-stable'
15
- - apt-get install -y libssl-dev
16
- - apt-get install -y pkg-config
17
- - apt-get install -y git
18
- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
19
- - export PATH="/root/.cargo/bin:${PATH}"
20
- - rustup --version
21
- - rustup target add x86_64-unknown-linux-gnu
22
14
  - cd eitri-cli-v2
23
15
  - npm i
24
16
  - npm run build:debug
@@ -33,21 +25,9 @@ pipelines:
33
25
  caches:
34
26
  - node
35
27
  script:
36
- - apt-get update
37
- - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
38
- - apt-get install -y wget
39
- - wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
40
- - apt-get install -y ./google-chrome-stable_current_amd64.deb
41
- - export PUPPETEER_EXECUTABLE_PATH='/usr/bin/google-chrome-stable'
42
- - apt-get install -y libssl-dev
43
- - apt-get install -y pkg-config
44
- - apt-get install -y git
45
- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
46
- - export PATH="/root/.cargo/bin:${PATH}"
47
- - rustup --version
48
- - rustup target add x86_64-unknown-linux-gnu
49
28
  - cd eitri-cli-v2
50
29
  - npm i
30
+ - npm i puppeteer@21.4.1
51
31
  - npm run build:debug
52
32
  - cd ..
53
33
  - yarn
@@ -59,35 +39,18 @@ pipelines:
59
39
  caches:
60
40
  - node
61
41
  script:
62
- - apt-get update
63
- - apt-get install -y libssl-dev
64
- - apt-get install -y pkg-config
65
- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
66
- - export PATH="/root/.cargo/bin:${PATH}"
67
- - rustup --version
68
- - rustup target add x86_64-unknown-linux-gnu
69
42
  - cd eitri-cli-v2
70
- - cargo test
43
+ - cargo test -- --test-threads=1
71
44
  - step: &macOSCrossCompile
72
- image: joseluisq/rust-linux-darwin-builder:1.76.0
45
+ image:
46
+ name: 343482176926.dkr.ecr.us-east-1.amazonaws.com/eitri-base-cli-pipeline:macos
47
+ aws:
48
+ access-key: $EITRI_PROD_AWS_ACCESS_KEY_ID
49
+ secret-key: $EITRI_PROD_AWS_SECRET_ACCESS_KEY
73
50
  name: "macOS cross compile"
74
51
  caches:
75
52
  - node
76
53
  script:
77
- - apt-get update
78
- - apt-get install -y git
79
- - apt-get install -y libssl-dev
80
- - apt-get install -y libudev-dev
81
- - apt-get install -y pkg-config
82
- - apt-get install -y cargo
83
- - apt-get install -y gcc-mingw-w64
84
- - apt-get install -y curl
85
- - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
86
- - rustup update
87
- - export PATH="/root/.cargo/bin:${PATH}"
88
- - rustup --version
89
- - export CC=o64-clang
90
- - export CXX=o64-clang++
91
54
  - cd eitri-cli-v2
92
55
  - cargo add openssl --features vendored
93
56
  - npm install
@@ -108,18 +71,6 @@ pipelines:
108
71
  - node
109
72
  name: 'Linux compile'
110
73
  script:
111
- - apt-get update
112
- - apt-get install -y git
113
- - apt-get install -y libssl-dev
114
- - apt-get install -y libudev-dev
115
- - apt-get install -y pkg-config
116
- - apt-get install -y cargo
117
- - apt-get install -y gcc-mingw-w64
118
- - apt-get install -y curl
119
- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
120
- - export PATH="/root/.cargo/bin:${PATH}"
121
- - rustup --version
122
- - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
123
74
  - rustup target add x86_64-unknown-linux-gnu
124
75
  - cd eitri-cli-v2
125
76
  - cargo add openssl --features vendored
@@ -133,18 +84,6 @@ pipelines:
133
84
  - node
134
85
  name: 'Windows cross compile'
135
86
  script:
136
- - apt-get update
137
- - apt-get install -y git
138
- - apt-get install -y libssl-dev
139
- - apt-get install -y libudev-dev
140
- - apt-get install -y pkg-config
141
- - apt-get install -y cargo
142
- - apt-get install -y gcc-mingw-w64
143
- - apt-get install -y curl
144
- - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
145
- - export PATH="/root/.cargo/bin:${PATH}"
146
- - rustup --version
147
- - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
148
87
  - rustup target add x86_64-pc-windows-msvc
149
88
  - cargo install cargo-xwin
150
89
  - cd eitri-cli-v2
@@ -162,13 +101,10 @@ pipelines:
162
101
  - step: *runRustTests
163
102
  '{beta,master}':
164
103
  - parallel:
165
- fail-fast: false
104
+ fail-fast: true
166
105
  steps:
167
106
  - step: *runTests
168
107
  - step: *runRustTests
169
- - parallel:
170
- fail-fast: true
171
- steps:
172
108
  - step: *windowsCrossCompile
173
109
  - step: *linuxCrossCompile
174
110
  - step: *macOSCrossCompile
@@ -183,8 +119,6 @@ pipelines:
183
119
  - mv ./eitri-cli-v2.win32-x64-msvc.node ./eitri-cli-v2/eitri-cli-v2.win32-x64-msvc.node
184
120
  - mv ./index.d.ts ./eitri-cli-v2/index.d.ts
185
121
  - mv ./rust-index.js ./eitri-cli-v2/index.js
186
- - apt-get update
187
- - apt-get install -y git
188
122
  - echo 'Start release'
189
123
  - echo 'If there is a new version, it will be automatically published on NPM according to the channel/branch (beta or master (stable)).'
190
124
  - npm i
@@ -1,6 +1,23 @@
1
1
  module.exports = {
2
2
  extends: ['@commitlint/config-conventional'],
3
3
  rules: {
4
- "body-max-line-length": [0, "always", 10000]
4
+ "body-max-line-length": [0, "always", 10000],
5
+ 'type-enum': [
6
+ 2,
7
+ 'always',
8
+ [
9
+ 'build',
10
+ 'chore',
11
+ 'ci',
12
+ 'docs',
13
+ 'feat',
14
+ 'fix',
15
+ 'perf',
16
+ 'refactor',
17
+ 'revert',
18
+ 'style',
19
+ 'test'
20
+ ]
21
+ ],
5
22
  }
6
23
  };
@@ -0,0 +1,15 @@
1
+ FROM node:18-buster
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y wget \
5
+ && wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
6
+ && apt-get install -y ./google-chrome-stable_current_amd64.deb \
7
+ && export PUPPETEER_EXECUTABLE_PATH='/usr/bin/google-chrome-stable' \
8
+ && apt-get install -y libssl-dev \
9
+ && apt-get install -y pkg-config \
10
+ && apt-get install -y git \
11
+ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
12
+ && export PATH="/root/.cargo/bin:${PATH}" \
13
+ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
14
+
15
+ ENTRYPOINT ["/bin/bash"]
@@ -0,0 +1,21 @@
1
+ FROM joseluisq/rust-linux-darwin-builder:1.76.0
2
+
3
+ RUN apt-get update \
4
+ && apt-get install -y wget \
5
+ && wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
6
+ && apt-get install -y ./google-chrome-stable_current_amd64.deb \
7
+ && export PUPPETEER_EXECUTABLE_PATH='/usr/bin/google-chrome-stable' \
8
+ && apt-get install -y libssl-dev \
9
+ && apt-get install -y libudev-dev \
10
+ && apt-get install -y pkg-config \
11
+ && apt-get install -y git \
12
+ && apt-get install -y gcc-mingw-w64 \
13
+ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
14
+ && export PATH="/root/.cargo/bin:${PATH}" \
15
+ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs \
16
+ && rustup update
17
+
18
+ ENV CC=o64-clang
19
+ ENV CXX=o64-clang++
20
+
21
+ ENTRYPOINT ["/bin/bash"]
@@ -0,0 +1,11 @@
1
+ #/bin/bash
2
+
3
+ # Build base image
4
+ docker build -t eitri-base-cli-pipeline:latest -f Dockerfile-BaseCLI .
5
+ docker tag eitri-base-cli-pipeline:latest 343482176926.dkr.ecr.us-east-1.amazonaws.com/eitri-base-cli-pipeline:latest
6
+ docker push 343482176926.dkr.ecr.us-east-1.amazonaws.com/eitri-base-cli-pipeline:latest ─╯
7
+
8
+ # Build macos cross compile image
9
+ docker build -t eitri-base-cli-pipeline:macos -f Dockerfile-macos .
10
+ docker tag eitri-base-cli-pipeline:macos 343482176926.dkr.ecr.us-east-1.amazonaws.com/eitri-base-cli-pipeline:macos
11
+ docker push 343482176926.dkr.ecr.us-east-1.amazonaws.com/eitri-base-cli-pipeline:macos
@@ -29,6 +29,12 @@ url = "2.5.0"
29
29
  urlencoding = "2.1.3"
30
30
  url-parse = "1.0.7"
31
31
  config = "0.14.0"
32
+ futures-util = "0.3.30"
33
+ rust_socketio = { version = "0.4.2", features = ["async"] }
34
+ log = "0.4.21"
35
+ env_logger = "0.11.3"
36
+ crossterm = "0.27.0"
37
+ spinners = "4.1.1"
32
38
 
33
39
  [dependencies.uuid]
34
40
  version = "1.8.0"
@@ -38,6 +44,9 @@ features = [
38
44
  "macro-diagnostics", # Enable better diagnostics for compile-time UUIDs
39
45
  ]
40
46
 
47
+ [dev-dependencies]
48
+ serial_test = "*"
49
+
41
50
  [target.x86_64-unknown-linux-gnu]
42
51
  openssl = { version = "0.9", features = ["vendored"] }
43
52
 
@@ -8,7 +8,8 @@ old_config_file_path = ".miniapp/prod-eitri.conf.js"
8
8
  create_url = "https://console.eitri.tech/docs"
9
9
 
10
10
  [blind_guardian]
11
- url = "https://api.eitri.tech/blind-guardian-api"
11
+ url = "https://api.eitri.tech"
12
+ base_path = "/blind-guardian-api"
12
13
  auth_path = "/v2/o/auth"
13
14
 
14
15
  [share_api]
@@ -16,10 +17,12 @@ url = "https://api.eitri.tech/share-api/share"
16
17
 
17
18
  [foundry]
18
19
  url = "https://api.eitri.tech"
19
- base_path = "runes-foundry"
20
+ base_path = "/runes-foundry"
20
21
  target_path = "/runes-foundry/targets"
21
22
  run_test_path = "/runes-foundry/run-test"
22
23
  share_path = "/foundry/share"
24
+ clean_path = "/sources"
25
+ shared_tags_json_path = "/user/:workspaceId/index.json"
23
26
 
24
27
  [foundry.libs]
25
28
  update_libs_endpoint_version = "application/vnd.workspace.api.v2+json"
@@ -34,8 +37,9 @@ watch_user_dir = "/server"
34
37
  url = "https://prod.eitri.calindra.com.br/workspace/share"
35
38
 
36
39
  [mini_log]
37
- url = "https://prod.eitri.calindra.com.br/mini-log/rooms"
38
- path = "/mini-log/socket.io"
40
+ url = "https://prod.eitri.calindra.com.br/mini-log"
41
+ path = "/socket.io/"
42
+ rooms = "/mini-log/rooms"
39
43
 
40
44
  [manager_api]
41
45
  url = "https://api.eitri.tech/miniapp-manager-api"
@@ -44,6 +48,7 @@ url = "https://api.eitri.tech/miniapp-manager-api"
44
48
  url = "https://api.eitri.tech/eitri-manager-api"
45
49
  revision_path = "/v2/revisions"
46
50
  publish_path = "/revisions/:eitriAppId/publish"
51
+ application_by_id_path = "/applications/:applicationId"
47
52
 
48
53
  [eitri_analytics]
49
54
  url = "https://api.eitri.tech/analytics/event"
@@ -8,7 +8,8 @@ old_config_file_path = ".miniapp/prod-eitri.conf.js"
8
8
  create_url = "https://console.eitri.tech/docs"
9
9
 
10
10
  [blind_guardian]
11
- url = "https://api.eitri.tech/blind-guardian-api"
11
+ url = "https://api.eitri.tech"
12
+ base_path = "/blind-guardian-api"
12
13
  auth_path = "/v2/o/auth"
13
14
 
14
15
  [share_api]
@@ -16,10 +17,12 @@ url = "https://api.eitri.tech/share-api/share"
16
17
 
17
18
  [foundry]
18
19
  url = "http://localhost:3000"
19
- base_path = "runes-foundry"
20
+ base_path = "/runes-foundry"
20
21
  target_path = "/runes-foundry/targets"
21
22
  run_test_path = "/runes-foundry/run-test"
22
23
  share_path = "/runes-foundry/share"
24
+ clean_path = "/sources"
25
+ shared_tags_json_path = "/user/:workspaceId/index.json"
23
26
 
24
27
  [foundry.libs]
25
28
  update_libs_endpoint_version = "application/vnd.workspace.api.v2+json"
@@ -34,8 +37,9 @@ watch_user_dir = "/server"
34
37
  url = "https://prod.eitri.calindra.com.br/workspace/share"
35
38
 
36
39
  [mini_log]
37
- url = "https://prod.eitri.calindra.com.br/mini-log/rooms"
38
- path = "/mini-log/socket.io"
40
+ url = "https://prod.eitri.calindra.com.br/mini-log"
41
+ path = "/socket.io/"
42
+ rooms = "/mini-log/rooms"
39
43
 
40
44
  [manager_api]
41
45
  url = "https://api.eitri.tech/miniapp-manager-api"
@@ -44,6 +48,7 @@ url = "https://api.eitri.tech/miniapp-manager-api"
44
48
  url = "https://api.eitri.tech/eitri-manager-api"
45
49
  revision_path = "/v2/revisions"
46
50
  publish_path = "/revisions/:eitriAppId/publish"
51
+ application_by_id_path = "/applications/:applicationId"
47
52
 
48
53
  [eitri_analytics]
49
54
  url = "https://api.eitri.tech/analytics/event"
@@ -8,7 +8,8 @@ old_config_file_path = ".miniapp/prod-eitri.conf.js"
8
8
  create_url = "https://console.eitri.tech/docs"
9
9
 
10
10
  [blind_guardian]
11
- url = "https://api.eitri.tech/blind-guardian-api"
11
+ url = "https://api.eitri.tech"
12
+ base_path = "/blind-guardian-api"
12
13
  auth_path = "/v2/o/auth"
13
14
 
14
15
  [share_api]
@@ -16,10 +17,12 @@ url = "https://api.eitri.tech/share-api/share"
16
17
 
17
18
  [foundry]
18
19
  url = "https://api.eitri.tech"
19
- base_path = "foundry"
20
+ base_path = "/foundry"
20
21
  target_path = "/foundry/targets"
21
22
  run_test_path = "/foundry/run-test"
22
23
  share_path = "/foundry/share"
24
+ clean_path = "/sources"
25
+ shared_tags_json_path = "/user/:workspaceId/index.json"
23
26
 
24
27
  [foundry.libs]
25
28
  update_libs_endpoint_version = "application/vnd.workspace.api.v2+json"
@@ -31,14 +34,16 @@ upload_file = "/uploadSingle"
31
34
  watch_user_dir = "/server"
32
35
 
33
36
  [mini_log]
34
- url = "https://prod.eitri.calindra.com.br/mini-log/rooms"
35
- path = "/mini-log/socket.io"
37
+ url = "https://prod.eitri.calindra.com.br/mini-log"
38
+ path = "/socket.io/"
39
+ rooms = "/mini-log/rooms"
36
40
 
37
41
 
38
42
  [eitri_manager]
39
43
  url = "https://api.eitri.tech/eitri-manager-api"
40
44
  revision_path = "/v2/revisions"
41
45
  publish_path = "/revisions/:eitriAppId/publish"
46
+ application_by_id_path = "/applications/:applicationId"
42
47
 
43
48
  [eitri_analytics]
44
49
  url = "https://api.eitri.tech/analytics/event"
@@ -1,7 +1,9 @@
1
1
 
2
2
  [foundry]
3
3
  url = "https://api.eitri.tech"
4
- base_path = "runes-foundry"
4
+ base_path = "/runes-foundry"
5
5
  target_path = "/runes-foundry/targets"
6
6
  run_test_path = "/runes-foundry/run-test"
7
7
  share_path = "/runes-foundry/share"
8
+ clean_path = "/sources"
9
+ shared_tags_json_path = "/user/:workspaceId/index.json"
@@ -8,7 +8,8 @@ old_config_file_path = ".miniapp/prod-eitri.conf.js"
8
8
  create_url = "https://console.eitri.tech/docs"
9
9
 
10
10
  [blind_guardian]
11
- url = "https://api.eitri.tech/blind-guardian-api"
11
+ url = "https://api.eitri.tech"
12
+ base_path = "/blind-guardian-api"
12
13
  auth_path = "/v2/o/auth"
13
14
 
14
15
  [share_api]
@@ -16,10 +17,12 @@ url = "https://api.eitri.tech/share-api/share"
16
17
 
17
18
  [foundry]
18
19
  url = "https://api.eitri.tech"
19
- base_path = "runes-foundry"
20
+ base_path = "/runes-foundry"
20
21
  target_path = "/runes-foundry/targets"
21
22
  run_test_path = "/runes-foundry/run-test"
22
23
  share_path = "/foundry/share"
24
+ clean_path = "/sources"
25
+ shared_tags_json_path = "/user/:workspaceId/index.json"
23
26
 
24
27
  [foundry.libs]
25
28
  update_libs_endpoint_version = "application/vnd.workspace.api.v2+json"
@@ -34,8 +37,9 @@ watch_user_dir = "/server"
34
37
  url = "https://prod.eitri.calindra.com.br/workspace/share"
35
38
 
36
39
  [mini_log]
37
- url = "https://prod.eitri.calindra.com.br/mini-log/rooms"
38
- path = "/mini-log/socket.io"
40
+ url = "https://prod.eitri.calindra.com.br/mini-log"
41
+ path = "/socket.io/"
42
+ rooms = "/mini-log/rooms"
39
43
 
40
44
  [manager_api]
41
45
  url = "https://api.eitri.tech/miniapp-manager-api"
@@ -44,6 +48,7 @@ url = "https://api.eitri.tech/miniapp-manager-api"
44
48
  url = "https://api.eitri.tech/eitri-manager-api"
45
49
  revision_path = "/v2/revisions"
46
50
  publish_path = "/revisions/:eitriAppId/publish"
51
+ application_by_id_path = "/applications/:applicationId"
47
52
 
48
53
  [eitri_analytics]
49
54
  url = "https://api.eitri.tech/analytics/event"
@@ -11,3 +11,7 @@ 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
+ export function appLogs(): Promise<void>
17
+ }
@@ -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"
@@ -73,6 +75,10 @@ const run = async () => {
73
75
  .option(
74
76
  "-e, --emulator <platform>",
75
77
  "Abre o Eitri-App no emulador, desde que seja definido qual plataforma será aberto, android ou ios."
78
+ )
79
+ .option(
80
+ "-sh, --shared",
81
+ "Executa o Eitri-App no modo compartilhável."
76
82
  );
77
83
 
78
84
  startProgram.action((cmdObj) => {
@@ -141,7 +147,7 @@ const run = async () => {
141
147
  .command("doctor")
142
148
  .description("Valida as dependências externas para execução da CLI do Eitri")
143
149
  .action(async (cmdObj) => {
144
- if(NEW_CLI_VERSION){
150
+ if (NEW_CLI_VERSION) {
145
151
  console.log("doctor (v2)")
146
152
  const eitriCLIV2 = require('./eitri-cli-v2/index.js')
147
153
  return await eitriCLIV2.doctor()
@@ -175,6 +181,7 @@ const run = async () => {
175
181
  .action(async (cmdObj) => { return require("./src/cmd/runTests")(cmdObj) });
176
182
 
177
183
  program.addCommand(VegvisirCommand());
184
+ program.addCommand(AppCommand());
178
185
 
179
186
  if (
180
187
  process.argv.length > 2 &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eitri-cli",
3
- "version": "1.11.0",
3
+ "version": "1.12.0-beta.10",
4
4
  "description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -34,6 +34,7 @@
34
34
  "axios-cookiejar-support": "^0.5.1",
35
35
  "base-64": "^0.1.0",
36
36
  "base64url": "^3.0.1",
37
+ "camelcase": "^6.3.0",
37
38
  "chalk": "^3.0.0",
38
39
  "cheerio": "^1.0.0-rc.3",
39
40
  "cli-progress": "^3.4.0",
@@ -47,6 +48,7 @@
47
48
  "folder-hash": "^3.3.0",
48
49
  "form-data": "^4.0.0",
49
50
  "inquirer": "^7.0.0",
51
+ "js-yaml": "^4.1.0",
50
52
  "jsonwebtoken": "^8.5.1",
51
53
  "lz-string": "^1.5.0",
52
54
  "node-watch": "^0.6.3",
@@ -62,7 +64,8 @@
62
64
  "tmp": "^0.1.0",
63
65
  "tough-cookie": "^3.0.1",
64
66
  "tough-cookie-file-store": "^2.0.2",
65
- "uuid": "^7.0.2"
67
+ "uuid": "^7.0.2",
68
+ "yaml": "^2.4.2"
66
69
  },
67
70
  "devDependencies": {
68
71
  "@commitlint/cli": "^17.7.2",
package/src/cmd/create.js CHANGED
@@ -10,7 +10,7 @@ const { NAME_TITLE_REGEX, SLUG_REGEX } = require("./validate");
10
10
  const handleStartServer = require("../service/StarterService");
11
11
  const getCreateFactory = require("../util/getCreateFactory");
12
12
  const UrlUtils = require("../util/UrlUtils");
13
-
13
+ const open = require("open");
14
14
  // eslint-disable-next-line no-unused-vars
15
15
  const Target = require("../model/Target");
16
16
  const EitriAppManager = require("../service/EitriAppManager");
@@ -54,7 +54,7 @@ module.exports = async function create(projectName, cmdObj) {
54
54
  }
55
55
 
56
56
  console.log(
57
- "\x1b[34mVamos criar o seu Eitri-App. Para isso basta responder algumas perguntas:\x1b[0m"
57
+ "Vamos criar o seu Eitri-App. Carregando configurações..."
58
58
  );
59
59
 
60
60
  try {
@@ -62,6 +62,7 @@ module.exports = async function create(projectName, cmdObj) {
62
62
  workspace.setServerUrl(url);
63
63
  const clientApplication = await askClientApplication(cmdObj.application);
64
64
  if (clientApplication.name === ITEM_DOUBT) {
65
+ open("https://docs.eitri.tech/")
65
66
  handleStartServer(
66
67
  cmdObj,
67
68
  trackingService,
@@ -92,6 +93,11 @@ module.exports = async function create(projectName, cmdObj) {
92
93
 
93
94
  async function askClientApplication(applicationName) {
94
95
  const availableApplications = await eitriAppManager.findAllApplications();
96
+
97
+ console.log(
98
+ "\x1b[34m \nAgora, responda algumas perguntas:\n\x1b[0m"
99
+ );
100
+
95
101
  if (availableApplications.length <= 0) {
96
102
  console.log(
97
103
  "Sua organização não contém nenhuma aplicação disponível para prosseguir com a criação."
@@ -120,9 +126,10 @@ async function askClientApplication(applicationName) {
120
126
  name: "accepted",
121
127
  type: "rawlist",
122
128
  message:
123
- "Selecione a aplicação para qual destina-se seu Eitri-App:",
129
+ "Selecione o Aplicativo para o Eitri-App:",
124
130
  choices: cliOptions.map(createLabel),
125
- pageSize: cliOptions.length + 2,
131
+ pageSize: 10,
132
+ loop: false,
126
133
  },
127
134
  ]);
128
135
  const clientApplication = cliOptions.find(
@@ -200,6 +207,7 @@ async function askProjMetadata(clientApplication, cmdObj, projectName) {
200
207
  ...conf,
201
208
  organizationId: clientApplication.organization.id,
202
209
  applicationId: clientApplication.id,
210
+ "type":"module",
203
211
  };
204
212
 
205
213
  await factory.writeEitriAppConf(templateProject, finalConf);
@@ -133,7 +133,7 @@ module.exports = async function runTests(args) {
133
133
  args
134
134
  }
135
135
  })
136
- process.exit(1)
136
+ process.exit(0)
137
137
  } catch (e) {
138
138
  debug(`Erro no processo de ${COMMAND_NAME}`, { message: e?.message, error: e })
139
139
  TrackingEitriAnalytics.sendEvent({
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,14 +45,13 @@ 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
-
50
- const url = config.get('workspace').url
51
- const setupResult = await workspace.setup()
52
- debug("Informações do setupResult do workspace", {setupResult})
48
+ debug("Fim da busca e validação do EitriAppConf", { miniConf })
53
49
 
50
+ const url = config.get('workspace').url
51
+ const setupResult = await workspace.setup(args)
52
+ debug("Informações do setupResult do workspace", { setupResult })
54
53
 
55
- const target = setupResult.target.name
54
+ const applicationName = setupResult?.application?.name
56
55
 
57
56
  blindGuardian.readConf()
58
57
  const qrCodeUrl = config.get('qrCode').url
@@ -64,23 +63,25 @@ module.exports = async function start(args) {
64
63
  workspace.setServerUrl(url)
65
64
  workspace.setQrCodeUrl(qrCodeUrl)
66
65
 
67
- debug("Iniciando workspace", {workspace})
66
+ debug("Iniciando workspace", { workspace })
68
67
  await workspace.init()
69
- debug("Workspace iniciado", {workspace})
68
+ debug("Workspace iniciado", { workspace })
70
69
 
71
70
  const silentOnConnect = args.verbose ? false : true
72
71
  const userWorkspace = await vegvisirService.getWorkspace()
73
72
  console.log(`Construindo para o Workspace [${userWorkspace.id}]`)
74
- await miniLog.connect(userWorkspace.id, silentOnConnect)
73
+ if (!args.skipMiniLog) {
74
+ await miniLog.connect(userWorkspace.id, silentOnConnect)
75
+ }
75
76
 
76
77
  LogVerbose(args.verbose, "Construindo...");
77
78
  const isDevMode = true
78
79
  try {
79
- debug("Iniciando workspace.uploadZip", {isDevMode, workspace})
80
+ debug("Iniciando workspace.uploadZip", { isDevMode, workspace })
80
81
  await workspace.uploadZip(isDevMode);
81
82
  } catch (error) {
82
- debug("Erro no workspace.uploadZip", {isDevMode, workspace, error})
83
- if(args.verbose){
83
+ debug("Erro no workspace.uploadZip", { isDevMode, workspace, error })
84
+ if (args.verbose) {
84
85
  console.error("::uploadZip::", error?.message)
85
86
  console.error(":::uploadZip::: ", error)
86
87
  }
@@ -90,29 +91,29 @@ module.exports = async function start(args) {
90
91
  const friendlyMessage3 = "Se o problema persistir, por favor, entre em contato com o suporte técnico do Eitri."
91
92
  const friendlyMessage4 = "Você pode continuar o desenvolvimento localmente, mesmo que a sincronização não esteja disponível no momento."
92
93
  displayFriendlyErrorAtEnd = `\x1b[1m\x1b[31m\n${friendlyMessage1}\n${friendlyMessage2} \x1b[0m` + "\n" + `\n${friendlyMessage3}\n${friendlyMessage4}\n\x1b[0m`
93
-
94
+
94
95
  const errorData = error.response.data
95
96
  const commonStartErrors = ['CodeCompileError', 'TagNotFound']
96
- if(commonStartErrors.includes(errorData.name)) {
97
+ if (commonStartErrors.includes(errorData.name)) {
97
98
  displayFriendlyErrorAtEnd += `\n\x1b[1m\x1b[31mMotivo: ${errorData.friendlyMessage}\x1b[0m\n`;
98
99
  }
99
100
  }
100
101
  console.log("Pronto!\n");
101
102
 
102
103
  const loadedTarget = await workspace.getTarget()
103
- debug("Target carregado do workspace", {loadedTarget})
104
+ debug("Target carregado do workspace", { loadedTarget })
104
105
 
105
106
  const platform = loadedTarget.platform
106
107
  const argsWithDeeplinks = {
107
108
  ...args,
108
109
  deepLinks: loadedTarget?.deepLinks || []
109
110
  }
110
- debug("Iniciando servidor", {argsWithDeeplinks, trackingService, watcher, workspace, target, setupResult, platform})
111
- await handleStartServer(argsWithDeeplinks, trackingService, watcher, workspace, target, setupResult, platform)
112
- debug("Servidor iniciado", {loadedTarget})
111
+ debug("Iniciando servidor", { argsWithDeeplinks, trackingService, watcher, workspace, applicationName, setupResult, platform })
112
+ await handleStartServer(argsWithDeeplinks, trackingService, watcher, workspace, applicationName, setupResult, platform)
113
+ debug("Servidor iniciado", { loadedTarget })
113
114
 
114
115
  TrackingEitriAnalytics.sendEvent({
115
- eventName:"start",
116
+ eventName: "start",
116
117
  userId: workspace?.userEmail,
117
118
  data: {
118
119
  workspaceId: userWorkspace.id,
@@ -121,7 +122,7 @@ module.exports = async function start(args) {
121
122
  }
122
123
  })
123
124
  } catch (e) {
124
- debug("Erro no processo de start", {message: e?.message, error: e})
125
+ debug("Erro no processo de start", { message: e?.message, error: e })
125
126
  TrackingEitriAnalytics.sendEvent({
126
127
  eventName: "start.error",
127
128
  userId: workspace?.userEmail,
@@ -149,8 +150,8 @@ module.exports = async function start(args) {
149
150
  await trackingService.sendError(e)
150
151
 
151
152
  process.exit(1)
152
- } finally{
153
- if(displayFriendlyErrorAtEnd){
153
+ } finally {
154
+ if (displayFriendlyErrorAtEnd) {
154
155
  const folderHash = workspace.getFolderHashPath()
155
156
  await workspace.transpile([folderHash])
156
157
  console.log("\n\n" + separator + "\n" + displayFriendlyErrorAtEnd + "\n" + separator + "\n\n")
@@ -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[34m Iniciando Eitri builder\x1b[0m');
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
- resolve()
37
+ resolve()
38
38
  // }
39
39
  })
40
40
  })
@@ -0,0 +1,23 @@
1
+ const commander = require("commander");
2
+ module.exports = function AppCommand() {
3
+ const app = commander.command("app")
4
+ .description("Gerencia a execução de Eitri-Apps do Aplicativo declarado no app-config.yaml 'eitri app --help'")
5
+
6
+ app
7
+ .command("start")
8
+ .description("Inicializa todos os Eitri-Apps do arquivo de configuração app-config.yaml")
9
+ .action(async (cmdObj) => {
10
+ const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
11
+ await eitriCLIV2.app.start(cmdObj)
12
+ });
13
+
14
+ app
15
+ .command("logs")
16
+ .description("Exibe os logs dos Eitri-Apps em execução do comando 'eitri app start'")
17
+ .action(async () => {
18
+ const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
19
+ await eitriCLIV2.app.appLogs();
20
+ });
21
+
22
+ return app;
23
+ };
@@ -2,11 +2,12 @@ const axios = require('axios')
2
2
  const configService = require('./ConfigService')
3
3
  const CDN_83io_LIBRARY = configService.get('cdn')?.library
4
4
  const TrackingEitriAnalytics = require('./TrackingEitriAnalytics')
5
+ const { validateUUID } = require('../util/GenericUtils')
5
6
 
6
7
  class LibsService {
7
8
 
8
- static async validateLibsVersions({libs = [], eitriAppConf = {}}) {
9
- const {luminusUiVersion, bifrostVersion} = this.getEitriConfLibsVersions(libs)
9
+ static async validateLibsVersions({ libs = [], eitriAppConf = {} }) {
10
+ const { luminusUiVersion, bifrostVersion } = this.getEitriConfLibsVersions(libs)
10
11
  if (!luminusUiVersion) {
11
12
  throw new Error("Nenhuma versão do [luminus-ui/eitri-app-components] encontrada em seu eitri-app.conf");
12
13
  }
@@ -15,10 +16,11 @@ class LibsService {
15
16
  throw new Error("Nenhuma versão do [bifrost/eitri-app-client] encontrada em seu eitri-app.conf");
16
17
  }
17
18
 
18
- const {luminusUiVersions, bifrostVersions} = await this.simultaneousRequestAndHandleData();
19
+ const { luminusUiVersions, bifrostVersions } = await this.simultaneousRequestAndHandleData();
19
20
  const allBifrostVersions = bifrostVersions?.versions?.concat(bifrostVersions?.betaVersions, bifrostVersions?.alphaVersions);
20
21
 
21
- if(!luminusUiVersion.includes("@")){
22
+
23
+ if (!luminusUiVersion.includes("@") && !validateUUID(luminusUiVersion)) {
22
24
  const existsLuminus = luminusUiVersions?.versions?.some(version => version === luminusUiVersion);
23
25
  if (!existsLuminus) {
24
26
  this.throwNonExistentLibError({
@@ -30,7 +32,7 @@ class LibsService {
30
32
  }
31
33
  }
32
34
 
33
- if(!bifrostVersion.includes("@")){
35
+ if (!bifrostVersion.includes("@")) {
34
36
  const existsBifrost = allBifrostVersions.some(version => version === bifrostVersion);
35
37
  if (!existsBifrost) {
36
38
  this.throwNonExistentLibError({
@@ -127,12 +129,12 @@ class LibsService {
127
129
  TrackingEitriAnalytics.sendEvent({
128
130
  eventName: `${method}.error`,
129
131
  userId: "",
130
- data: {errorMessage}
132
+ data: { errorMessage }
131
133
  })
132
134
  }
133
135
 
134
- static throwNonExistentLibError(input = {libName: "", eitriConfLibVersion: "", availableVersions: [], eitriAppConf: {}}) {
135
- const {libName, eitriConfLibVersion, availableVersions, eitriAppConf} = input
136
+ static throwNonExistentLibError(input = { libName: "", eitriConfLibVersion: "", availableVersions: [], eitriAppConf: {} }) {
137
+ const { libName, eitriConfLibVersion, availableVersions, eitriAppConf } = input
136
138
 
137
139
  const friendlyErrorMessage = `Versão da biblioteca [${libName}] não encontrada`;
138
140
  console.log(`\n\x1b[1m\x1b[31m${friendlyErrorMessage}\x1b[0m\n`);
@@ -84,7 +84,7 @@ class MiniLog {
84
84
  console.log(`\x1b[34meitri:\x1b[0m\x1b[97m${data.msg}\x1b[0m`);
85
85
  } else {
86
86
  const message = this._colorizeMessage(data.msg, data.method)
87
- console[data.method](`\x1b[34meitri:\x1b[0m${message}`);
87
+ console[data.method](`\x1b[34meitri [${data.slug}]:\x1b[0m${message}`);
88
88
  }
89
89
  }
90
90
  if (data.stopCLI) {
@@ -30,7 +30,7 @@ class Watcher {
30
30
  return
31
31
  }
32
32
  if (stat.isFile()) {
33
- console.log('\x1b[34mAlterações em: %s\x1b[0m', filePath)
33
+ console.log('\x1b[34meitri:Alterações em: %s\x1b[0m', filePath)
34
34
  this.workspace
35
35
  .upsert(filePath, { why: WatcherOpts.SAVE })
36
36
  .then((result) => {
@@ -43,10 +43,10 @@ class Watcher {
43
43
  }
44
44
  if (result.relativePath === '/folder.hash') {
45
45
 
46
- console.log(`\x1b[94mForjado em ${result.time} milissegundos\x1b[0m`);
46
+ console.log(`\x1b[94meitri:Forjado em ${result.time} milissegundos\x1b[0m`);
47
47
  this.trackingService.sendSave(event)
48
48
  } else {
49
- console.log(`\x1b[94mTransportado em ${result.time} milissegundos\x1b[0m`);
49
+ console.log(`\x1b[94meitri:Transportado em ${result.time} milissegundos\x1b[0m`);
50
50
  this.trackingService.sendCompile(event)
51
51
  }
52
52
  return this.hashFolder.updateHashFile()
@@ -31,8 +31,13 @@ const EitriAppType = require("../model/EitriAppType");
31
31
  const chalk = require("chalk");
32
32
  const LibsService = require("./LibsService");
33
33
  const { LogSuccess } = require("../util/LogUtil");
34
+ const { extractSlug } = require("../util/LibUtil");
34
35
  const vegvisirService = new VegvisirService()
35
36
  const huginService = new HuginService()
37
+ const YAML = require('yaml');
38
+ const { readFile } = require("fs/promises");
39
+ const convertKeysToCamelCase = require("../util/convertKeysToCamelCase");
40
+ const { exit } = require("process");
36
41
 
37
42
  class Workspace {
38
43
 
@@ -138,6 +143,9 @@ class Workspace {
138
143
  throw Error("Arquivo eitri-app.conf.js sem version");
139
144
  }
140
145
  }
146
+ if (process.env.WORKSPACE_SHARED) {
147
+ this._miniConf['eitri-luminus'] = process.env.WORKSPACE_SHARED
148
+ }
141
149
  return this._miniConf;
142
150
  }
143
151
 
@@ -182,39 +190,50 @@ class Workspace {
182
190
  });
183
191
  }
184
192
 
185
- async setup() {
186
- const miniConf = this.getMiniConf();
193
+ async setup(args) {
194
+ const eitriConf = this.getMiniConf();
195
+ eitriConf.isShared = args?.shared
187
196
  const headers = {
188
197
  accept: this.config.libs.updateLibsEndpointVersion,
189
198
  };
190
199
  try {
200
+ const appConfig = await this.getAppConfig()
191
201
  const setupResponse = await this.http.post(
192
- `${this.serverUrl}/${this.basePath}/setup`,
193
- miniConf,
202
+ `${this.serverUrl}/${this.basePath}/v2/workspace/setup`,
203
+ {
204
+ eitriConf,
205
+ appConfig
206
+ },
194
207
  headers
195
208
  ); // somente para garantir que a pasta do usuario existe
196
209
 
197
210
  console.log("Preparando compilador");
198
211
  await this.http.put(
199
212
  `${this.serverUrl}/${this.basePath}/version`,
200
- miniConf,
213
+ eitriConf,
201
214
  headers
202
215
  ); // TODO PDV Setup fara isso aqui
203
216
  console.log("Compilador pronto para uso contínuo");
204
217
 
205
218
  const setupData = setupResponse.data;
206
219
 
207
- const { state, target: remoteTarget, eitriConf: remoteEitriConf } = setupData;
220
+ const { state, application, eitriConf: remoteEitriConf } = setupData;
208
221
 
209
- if (!this.eitriAppService.validEitriConf(miniConf)) {
210
- await this.eitriAppService.writeEitriConf(remoteEitriConf, miniConf, this.folder2watch);
222
+ if (!application) {
223
+ console.error("O Aplicativo não foi encontrado durante o processo de setup do Eitri-App.");;
224
+ return exit(1);
211
225
  }
212
226
 
213
- await LibsService.validateLibsVersions({ libs: state.libs, eitriAppConf: miniConf });
227
+ if (!this.eitriAppService.validEitriConf(eitriConf)) {
228
+ await this.eitriAppService.writeEitriConf(remoteEitriConf, eitriConf, this.folder2watch);
229
+ }
230
+
231
+ await LibsService.validateLibsVersions({ libs: state.libs, eitriAppConf: eitriConf });
214
232
 
215
233
  this.printLibsVersion(state);
216
234
 
217
- await this.loadTarget(remoteTarget);
235
+ await this.loadTarget(application);
236
+
218
237
 
219
238
  return setupData;
220
239
  } catch (e) {
@@ -226,6 +245,18 @@ class Workspace {
226
245
  }
227
246
  }
228
247
 
248
+ async getAppConfig() {
249
+ const appConfigPath = path.resolve(
250
+ this.folder2watch,
251
+ "../../app-config.yaml"
252
+ );
253
+ if (!fs.existsSync(appConfigPath)) return
254
+ const content = await readFile(appConfigPath, 'utf8')
255
+ const appConfig = YAML.parse(content);
256
+ return convertKeysToCamelCase(appConfig);
257
+ }
258
+
259
+
229
260
  async loadTarget(remoteTarget) {
230
261
  const targets = await this.availableTargets();
231
262
  this.target = targets.find((t) => t.name === remoteTarget.name);
@@ -240,6 +271,11 @@ class Workspace {
240
271
  const miniConf = this.getMiniConf();
241
272
  let libVersionsOutput = "";
242
273
  state.libs.forEach((lib) => {
274
+ let libraryDisplayName = lib.name
275
+ if (libraryDisplayName === "eitri-luminus") {
276
+ libraryDisplayName = extractSlug(miniConf[lib.name])
277
+ }
278
+
243
279
  let version = miniConf[lib.name];
244
280
  if (version) {
245
281
  // Captura a versao da lib quando estamos usando uma url
@@ -248,7 +284,7 @@ class Workspace {
248
284
  if (m) {
249
285
  version = m[1];
250
286
  }
251
- libVersionsOutput += ` ${lib.name} [${version}]`;
287
+ libVersionsOutput += ` ${libraryDisplayName} [${version}]`;
252
288
  }
253
289
  });
254
290
  console.log(" ", libVersionsOutput, "\n");
@@ -0,0 +1,26 @@
1
+ const camelCase = require('camelcase');
2
+
3
+ function convertKeysToCamelCase(obj) {
4
+ const newObj = {};
5
+ for (let key in obj) {
6
+ if (Object.getOwnPropertyNames(obj)) {
7
+ let value = obj[key];
8
+ const camelKey = camelCase(key);
9
+ if (typeof value === 'object' && !Array.isArray(value)) {
10
+ value = convertKeysToCamelCase(value); // Se for um objeto, chama a função recursivamente
11
+ } else if (Array.isArray(value)) {
12
+ // Se for um array, percorre cada item e chama a função recursivamente se for um objeto
13
+ value = value.map(item => {
14
+ if (typeof item === 'object' && !Array.isArray(item)) {
15
+ return convertKeysToCamelCase(item);
16
+ }
17
+ return item;
18
+ });
19
+ }
20
+ newObj[camelKey] = value;
21
+ }
22
+ }
23
+ return newObj;
24
+ }
25
+
26
+ module.exports = convertKeysToCamelCase