eitri-cli 1.9.0-beta.15 → 1.9.0-beta.17

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.
@@ -89,6 +89,7 @@ pipelines:
89
89
  - export CC=o64-clang
90
90
  - export CXX=o64-clang++
91
91
  - cd eitri-cli-v2
92
+ - cargo add openssl --features vendored
92
93
  - npm install
93
94
  - npm run build -- --target aarch64-apple-darwin
94
95
  - npm run build -- --target x86_64-apple-darwin
@@ -102,10 +103,10 @@ pipelines:
102
103
  - eitri-cli-v2.darwin-x64.node
103
104
  - index.d.ts
104
105
  - rust-index.js
105
- - step: &linuxAndWindowsCrossCompile
106
+ - step: &linuxCrossCompile
106
107
  caches:
107
108
  - node
108
- name: 'Linux and Windows cross compile'
109
+ name: 'Linux compile'
109
110
  script:
110
111
  - apt-get update
111
112
  - apt-get install -y git
@@ -119,18 +120,38 @@ pipelines:
119
120
  - export PATH="/root/.cargo/bin:${PATH}"
120
121
  - rustup --version
121
122
  - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
122
- - rustup target add x86_64-pc-windows-msvc
123
123
  - rustup target add x86_64-unknown-linux-gnu
124
- - cargo install cargo-xwin
125
124
  - cd eitri-cli-v2
125
+ - cargo add openssl --features vendored
126
126
  - npm install
127
127
  - npm run build -- --target x86_64-unknown-linux-gnu
128
- - npm run build -- --target x86_64-pc-windows-msvc
129
- - ls
130
128
  - cp -r ./eitri-cli-v2.linux-x64-gnu.node ../eitri-cli-v2.linux-x64-gnu.node
131
- - cp -r ./eitri-cli-v2.win32-x64-msvc.node ../eitri-cli-v2.win32-x64-msvc.node
132
129
  artifacts:
133
130
  - eitri-cli-v2.linux-x64-gnu.node
131
+ - step: &windowsCrossCompile
132
+ caches:
133
+ - node
134
+ name: 'Windows cross compile'
135
+ 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
+ - rustup target add x86_64-pc-windows-msvc
149
+ - cargo install cargo-xwin
150
+ - cd eitri-cli-v2
151
+ - npm install
152
+ - npm run build -- --target x86_64-pc-windows-msvc
153
+ - cp -r ./eitri-cli-v2.win32-x64-msvc.node ../eitri-cli-v2.win32-x64-msvc.node
154
+ artifacts:
134
155
  - eitri-cli-v2.win32-x64-msvc.node
135
156
  branches:
136
157
  "**":
@@ -148,7 +169,8 @@ pipelines:
148
169
  - parallel:
149
170
  fail-fast: true
150
171
  steps:
151
- - step: *linuxAndWindowsCrossCompile
172
+ - step: *windowsCrossCompile
173
+ - step: *linuxCrossCompile
152
174
  - step: *macOSCrossCompile
153
175
  - step:
154
176
  name: "Generation of a new version: beta or stable."
@@ -23,13 +23,13 @@ serde_json = "1.0.114"
23
23
  tokio = { version = "1.36.0", features = ["full"] }
24
24
 
25
25
  [target.x86_64-unknown-linux-gnu]
26
- openssl = { version = "0.10.64", features = ["vendored"] }
26
+ openssl = { version = "0.9", features = ["vendored"] }
27
27
 
28
28
  [target.aarch64-apple-darwin]
29
- openssl = { version = "0.10.64", features = ["vendored"] }
29
+ openssl = { version = "0.9", features = ["vendored"] }
30
30
 
31
31
  [target.x86_64-apple-darwin]
32
- openssl = { version = "0.10.64", features = ["vendored"] }
32
+ openssl = { version = "0.9", features = ["vendored"] }
33
33
 
34
34
  [build-dependencies]
35
35
  napi-build = "2.0.1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eitri-cli",
3
- "version": "1.9.0-beta.15",
3
+ "version": "1.9.0-beta.17",
4
4
  "description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/cmd/create.js CHANGED
@@ -76,6 +76,7 @@ module.exports = async function create(projectName, cmdObj) {
76
76
  eventName: "create",
77
77
  userId: workspace?.userEmail,
78
78
  });
79
+ console.log("Eitri-App criado com sucesso!")
79
80
  return responseAskProjMetadata
80
81
  } catch (e) {
81
82
  TrackingEitriAnalytics.sendEvent({
@@ -187,6 +188,7 @@ async function askProjMetadata(clientApplication, cmdObj, projectName) {
187
188
 
188
189
  // Cria no banco no final das configs locais
189
190
  const eitriApp = await eitriAppManager.create(eitriAppToCreate);
191
+
190
192
  conf["id"] = eitriApp.id;
191
193
  conf["public-key"] = eitriApp.publicKey;
192
194
 
@@ -194,12 +196,12 @@ async function askProjMetadata(clientApplication, cmdObj, projectName) {
194
196
  templateProject?.structure?.eitriAppConf;
195
197
 
196
198
  const finalConf = {
197
- ...templateEitriAppConf,
198
- ...conf,
199
- organizationId: clientApplication.organization.id,
199
+ ...templateEitriAppConf,
200
+ ...conf,
201
+ organizationId: clientApplication.organization.id,
200
202
  applicationId: clientApplication.id,
201
203
  };
202
-
204
+
203
205
  await factory.writeEitriAppConf(templateProject, finalConf);
204
206
  } catch (err) {
205
207
  if (cmdObj.verbose) {
@@ -1,3 +1,4 @@
1
+ const os = require('os');
1
2
  const util = require("util");
2
3
  const puppeteer = require("puppeteer");
3
4
  const path = require("path");
@@ -9,6 +10,8 @@ const Helper = require("../Helper.js");
9
10
  const ConfigService = require("../../src/service/ConfigService.js");
10
11
  const Http = require("../../src/service/Http.js");
11
12
  const BlindGuardian = require("../../src/service/BlindGuardian.js");
13
+ const childProcess = require('child_process');
14
+ const { writeFile, rm } = require("fs/promises");
12
15
  const FOUNDRY_CONTEXT_PATH = process.env.FOUNDRY_CONTEXT_PATH ?? 'foundry'
13
16
 
14
17
  describe("eitri-cli", () => {
@@ -44,7 +47,7 @@ describe("eitri-cli", () => {
44
47
  `cd ${EITRI_WORK_DIR} && eitri create ${EITRI_APP_NAME} --yes --application=APPLICATION_CALINDRA`,
45
48
  { env: devEnv }
46
49
  )
47
- .waitFor(/Download de template completo/);
50
+ .waitFor(/Eitri-App criado com sucesso!/);
48
51
  await sleep(200);
49
52
  const EITRI_APP_FOLDER = path.resolve(
50
53
  EITRI_WORK_DIR,
@@ -141,9 +144,8 @@ describe("eitri-cli", () => {
141
144
  inputPassword.type(pass);
142
145
  await sleep(500);
143
146
 
144
- // TODO: xpath quebra bastante...
145
147
  const buttonElement = await page.waitForXPath(
146
- '//*[@id="root"]/div/div/div[2]/div/div/div/form/div/button'
148
+ '//*[@id="button-do-login"]'
147
149
  );
148
150
  console.log("Clicando no botão");
149
151
  await sleep(1000);
@@ -151,7 +153,15 @@ describe("eitri-cli", () => {
151
153
  await sleep(3000);
152
154
  await browser.close();
153
155
  await loginPromise;
154
- // TODO: testes sem assert...
156
+ const homeDir = os.homedir();
157
+ const executorLS = new Executor({ env: devEnv });
158
+ await executorLS.exec(`ls ${path.join(homeDir, '.eitri')}`)
159
+ .waitFor(/.*/);
160
+ console.log('ls output', executorLS.stdout)
161
+ const configFilePath = path.join(homeDir, '.eitri', 'dev.conf.js')
162
+ const config = require(configFilePath);
163
+ expect(config.devUser).toBeDefined();
164
+ expect(config.devKey).toBeDefined();
155
165
  } catch (error) {
156
166
  console.error(error);
157
167
  throw error;
@@ -177,7 +187,7 @@ describe("eitri-cli", () => {
177
187
  `cd ${EITRI_WORK_DIR} && eitri create ${EITRI_APP_NAME} --yes --application=APPLICATION_CALINDRA`,
178
188
  { env: devEnv }
179
189
  )
180
- .waitFor(/Download de template completo/);
190
+ .waitFor(/Eitri-App criado com sucesso!/);
181
191
  await sleep(200);
182
192
 
183
193
  const EITRI_APP_FOLDER = path.resolve(
@@ -280,7 +290,7 @@ describe("eitri-cli", () => {
280
290
  `cd ${EITRI_WORK_DIR} && eitri create ${EITRI_APP_NAME} --yes --application=APPLICATION_CALINDRA`,
281
291
  { env: devEnv }
282
292
  )
283
- .waitFor(/Download de template completo/);
293
+ .waitFor(/Eitri-App criado com sucesso!/);
284
294
  executor.child.kill("SIGKILL");
285
295
  await sleep(1000)
286
296
  const EITRI_APP_FOLDER = path.resolve(
@@ -318,6 +328,135 @@ describe("eitri-cli", () => {
318
328
  3 * minutes
319
329
  );
320
330
 
331
+ it("should do start and push-version using shared-eitri-app", async () => {
332
+ console.log("should do start and push-version using shared-eitri-app - init")
333
+ const EITRI_APP_NAME = `eitri-test-${Date.now()}`;
334
+ const executor = new Executor({ env: devEnv });
335
+ const startExecution = new Executor({ env: devEnv });
336
+ const pushVersion = new Executor({ env: devEnv });
337
+ try {
338
+ console.log("==========================================")
339
+ console.log("Create")
340
+ console.log("==========================================")
341
+ await executor
342
+ .exec(
343
+ `cd ${EITRI_WORK_DIR} && eitri create ${EITRI_APP_NAME} --yes --application=APPLICATION_CALINDRA --verbose`,
344
+ { env: devEnv }
345
+ )
346
+ .waitFor(/Eitri-App criado com sucesso!/);
347
+
348
+ const EITRI_APP_FOLDER = path.resolve(
349
+ EITRI_WORK_DIR,
350
+ EITRI_APP_NAME
351
+ );
352
+
353
+ // Use Shared Eitri-App
354
+ const conf = require(`../../developer-folder/${EITRI_APP_NAME}/eitri-app.conf.js`);
355
+ expect(conf.id).toBeDefined()
356
+ expect(conf.name).toBe(EITRI_APP_NAME)
357
+
358
+ console.log({ conf })
359
+ conf['eitri-luminus'] = "@baldurs-gate:0.1.24"
360
+ const eitriConfPath = path.join(EITRI_APP_FOLDER, 'eitri-app.conf.js')
361
+ await writeFile(eitriConfPath, `module.exports = ${JSON.stringify(conf)}`)
362
+
363
+ const componentsFolderPath = path.join(EITRI_APP_FOLDER, 'src', 'components')
364
+ await rm(componentsFolderPath, { recursive: true, force: true })
365
+
366
+ console.log("==========================================")
367
+ console.log("Start")
368
+ console.log("==========================================")
369
+ await startExecution
370
+ .exec(`cd ${EITRI_APP_FOLDER} && eitri start`)
371
+ .waitFor(/Utilize o QR-Code para iniciar o seu Eitri-App/);
372
+ startExecution.child.kill("SIGKILL");
373
+
374
+ console.log("==========================================")
375
+ console.log("PUSH VERSION")
376
+ console.log("==========================================")
377
+
378
+ await pushVersion
379
+ .exec(`cd ${EITRI_APP_FOLDER} && eitri push-version`)
380
+ .waitFor(/disponível no Eitri Console/);
381
+
382
+ const data = await getPublishedVersion(conf.version, conf.id);
383
+
384
+ expect(data.length).toBe(1);
385
+ expect(data[0].version).toBe(conf.version);
386
+ expect(data[0].eitriAppId).toBe(conf.id);
387
+ } catch (e) {
388
+ executor.child.kill("SIGKILL");
389
+ startExecution.child.kill("SIGKILL");
390
+ pushVersion.child.kill("SIGKILL");
391
+ console.error(e);
392
+ throw e;
393
+ } finally {
394
+ const conf = require(`../../developer-folder/${EITRI_APP_NAME}/eitri-app.conf.js`);
395
+ await Helper.delete(conf.id);
396
+ }
397
+ console.log("should do push-version as shared-eitri-app - end")
398
+ }, 2 * minutes);
399
+
400
+ it("should do push-version as shared-eitri-app", async () => {
401
+ console.log("should do push-version as shared-eitri-app - init")
402
+ const EITRI_APP_NAME = `eitri-test-${Date.now()}`;
403
+ const executor = new Executor({ env: devEnv });
404
+ const startExecution = new Executor({ env: devEnv });
405
+ const pushVersion = new Executor({ env: devEnv });
406
+ try {
407
+ console.log("==========================================")
408
+ console.log("Create")
409
+ console.log("==========================================")
410
+ await executor
411
+ .exec(
412
+ `cd ${EITRI_WORK_DIR} && eitri create ${EITRI_APP_NAME} --yes --application=APPLICATION_CALINDRA`,
413
+ { env: devEnv }
414
+ )
415
+ .waitFor(/Eitri-App criado com sucesso!/);
416
+
417
+ const EITRI_APP_FOLDER = path.resolve(
418
+ EITRI_WORK_DIR,
419
+ EITRI_APP_NAME
420
+ );
421
+ console.log("==========================================")
422
+ console.log("Start")
423
+ console.log("==========================================")
424
+ await startExecution
425
+ .exec(`cd ${EITRI_APP_FOLDER} && eitri start`)
426
+ .waitFor(/Utilize o QR-Code para iniciar o seu Eitri-App/);
427
+
428
+ startExecution.child.kill("SIGKILL");
429
+
430
+ const exportComponentsPath = path.join(EITRI_APP_FOLDER, 'src', 'export.js')
431
+ await writeFile(exportComponentsPath, `export {default as HeaderComponent} from './components/HeaderComponent.js'`)
432
+
433
+ console.log("==========================================")
434
+ console.log("PUSH VERSION")
435
+ console.log("==========================================")
436
+
437
+ await pushVersion
438
+ .exec(`cd ${EITRI_APP_FOLDER} && eitri push-version --shared`)
439
+ .waitFor(/disponível no Eitri Console/);
440
+
441
+ const conf = require(`../../developer-folder/${EITRI_APP_NAME}/eitri-app.conf.js`);
442
+ const data = await getPublishedVersion(conf.version, conf.id);
443
+
444
+ expect(data.length).toBe(1);
445
+ expect(data[0].version).toBe(conf.version);
446
+ expect(data[0].eitriAppId).toBe(conf.id);
447
+ } catch (e) {
448
+ executor.child.kill("SIGKILL");
449
+ startExecution.child.kill("SIGKILL");
450
+ pushVersion.child.kill("SIGKILL");
451
+ console.error(e);
452
+ throw e;
453
+ } finally {
454
+ const conf = require(`../../developer-folder/${EITRI_APP_NAME}/eitri-app.conf.js`);
455
+ await Helper.delete(conf.id);
456
+ }
457
+ console.log("should do push-version as shared-eitri-app - end")
458
+ }, 2 * minutes);
459
+
321
460
  const getPublishedVersion = async (version, eitriAppId) => {
322
461
  const blindGuardian = new BlindGuardian();
323
462
  const http = new Http(blindGuardian);