eitri-cli 1.6.1-beta.2 → 1.6.1-beta.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eitri-cli",
3
- "version": "1.6.1-beta.2",
3
+ "version": "1.6.1-beta.3",
4
4
  "description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,20 +1,20 @@
1
1
  const configService = require('./ConfigService')
2
2
  const targetEnum = require('../enum/target')
3
3
  // eslint-disable-next-line no-unused-vars
4
-
5
- const LIBS_FOR_TARGET = {
6
- MOBILE: {
7
- superApp: 'eitri-app-client',
8
- components: 'eitri-app-components',
9
- sdkSupport: 'eitri-app-sdk-support',
10
- },
11
- WEB: {
12
- superApp: 'eitri-app-client-web',
13
- components: 'eitri-miniapp-components-web',
14
- sdkSupport: 'eitri-app-sdk-support',
15
- },
16
- }
17
4
  class TargetService{
5
+
6
+ static LIBS_FOR_TARGET = {
7
+ MOBILE: {
8
+ bifrost: 'eitri-app-client',
9
+ luminus: 'eitri-app-components',
10
+ sdkSupport: 'eitri-app-sdk-support',
11
+ },
12
+ MOBILE_NEW: {
13
+ bifrost: 'eitri-bifrost',
14
+ luminus: 'eitri-luminus',
15
+ sdkSupport: 'eitri-app-sdk-support',
16
+ },
17
+ }
18
18
  constructor(workspace) {
19
19
  this.workspace = workspace
20
20
  this.conf = configService.get('managerApi')
@@ -37,16 +37,16 @@ class TargetService{
37
37
  }
38
38
  }
39
39
 
40
- static getLibsFromMiniConf(miniConf, availableTargets) {
41
- const target = availableTargets.find(t => t.name === miniConf.target)
42
- if (target) {
40
+ static getLibsFromMiniConf(eitriConf, availableTargets) {
41
+ const application = availableTargets.find(t => t.name === eitriConf.target || t.id === eitriConf.applicationId)
42
+ if (application) {
43
43
  return {
44
- superApp: target.superAppClientLibName,
45
- components: target.componentsLibName,
46
- sdkSupport: target.sdkSupportLibName || LIBS_FOR_TARGET.MOBILE.sdkSupport
44
+ bifrost: application.superAppClientLibName,
45
+ luminus: application.componentsLibName,
46
+ sdkSupport: application.sdkSupportLibName || this.LIBS_FOR_TARGET.MOBILE.sdkSupport
47
47
  }
48
48
  }
49
- return LIBS_FOR_TARGET.MOBILE
49
+ return this.LIBS_FOR_TARGET.MOBILE
50
50
  }
51
51
 
52
52
  async getLibs() {
@@ -28,6 +28,7 @@ const EitriAppService = require("./EitriAppService");
28
28
  const VegvisirService = require("../modules/vegvisir/VegvisirService");
29
29
  const HuginService = require("./HuginService");
30
30
  const EitriAppType = require("../model/EitriAppType");
31
+ const chalk = require("chalk");
31
32
  const vegvisirService = new VegvisirService()
32
33
  const huginService = new HuginService()
33
34
 
@@ -286,7 +287,7 @@ class Workspace {
286
287
 
287
288
  async checkVersions() {
288
289
  try {
289
- const miniConf = this.getMiniConf();
290
+ const eitriConf = this.getMiniConf();
290
291
  const headers = {
291
292
  accept: this.config.libs.updateLibsEndpointVersion,
292
293
  };
@@ -294,25 +295,33 @@ class Workspace {
294
295
  // somente para garantir que a pasta do usuario existe
295
296
  await this.http.post(
296
297
  `${this.serverUrl}/${this.basePath}/setup`,
297
- miniConf,
298
+ eitriConf,
298
299
  headers
299
300
  );
300
301
  console.log("Preparando ambiente de desenvolvimento");
301
302
  const response = await this.http.put(
302
303
  `${this.serverUrl}/${this.basePath}/version?command=push-version`,
303
- miniConf,
304
+ eitriConf,
304
305
  headers
305
306
  );
306
- miniConf.target = response.target;
307
+ eitriConf.target = response.application;
307
308
  const availableTargets = await this.availableTargets();
308
309
  let libs = TargetService.getLibsFromMiniConf(
309
- miniConf,
310
+ eitriConf,
310
311
  availableTargets
311
312
  );
312
313
  console.log("Ambiente pronto para compilação");
314
+ const eitriConfProperties = Object.getOwnPropertyNames(eitriConf)
315
+ const clientName = eitriConfProperties.find(p => p === libs.bifrost) || TargetService.LIBS_FOR_TARGET.MOBILE_NEW.bifrost
316
+ const componentsName = eitriConfProperties.find(p => p === libs.luminus) || TargetService.LIBS_FOR_TARGET.MOBILE_NEW.luminus
317
+
318
+ const bifrostVersion = eitriConf[clientName]
319
+ const luminusVersion = eitriConf[componentsName]
320
+
321
+ console.log("\nVersão sendo criada a partir das seguintes bibliotecas e suas respectivas versões:")
322
+ console.log(chalk.bold.green(`${clientName} [${bifrostVersion}]`))
313
323
  console.log(
314
- `${libs.components} [${miniConf[libs.components]}]\n${libs.superApp
315
- } [${miniConf[libs.superApp]}]`
324
+ chalk.bold.green(`${componentsName} [${luminusVersion}]`)
316
325
  );
317
326
  return { target: response.target };
318
327
  } catch (error) {