eitri-cli 1.38.0-beta.9 → 1.39.0-beta.1

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.
Files changed (95) hide show
  1. package/.husky/pre-commit +0 -0
  2. package/eitri-cli-v2/eitri-cli-v2.darwin-arm64.node +0 -0
  3. package/eitri-cli-v2/eitri-cli-v2.darwin-x64.node +0 -0
  4. package/eitri-cli-v2/eitri-cli-v2.linux-x64-gnu.node +0 -0
  5. package/eitri-cli-v2/eitri-cli-v2.win32-x64-msvc.node +0 -0
  6. package/eitri-cli-v2/index.d.ts +11 -1
  7. package/index.js +4 -21
  8. package/package.json +3 -49
  9. package/src/modules/app/AppCommand.js +1 -1
  10. package/src/modules/vegvisir/VegvisirCommand.js +7 -13
  11. package/.eslintrc.json +0 -26
  12. package/.prettierrc +0 -6
  13. package/src/cmd/clean.js +0 -144
  14. package/src/cmd/create.js +0 -332
  15. package/src/cmd/credentials.js +0 -105
  16. package/src/cmd/doctor.js +0 -70
  17. package/src/cmd/invite.js +0 -87
  18. package/src/cmd/list.js +0 -36
  19. package/src/cmd/login.js +0 -70
  20. package/src/cmd/loginV2.js +0 -89
  21. package/src/cmd/manage-env.js +0 -129
  22. package/src/cmd/open-share.js +0 -6
  23. package/src/cmd/order-details.js +0 -6
  24. package/src/cmd/push-version.js +0 -260
  25. package/src/cmd/show-message-if-outdated-package.js +0 -32
  26. package/src/cmd/signup.js +0 -71
  27. package/src/cmd/start.js +0 -181
  28. package/src/cmd/tail-logs.js +0 -26
  29. package/src/cmd/test-initialization-params.js +0 -6
  30. package/src/cmd/validate.js +0 -164
  31. package/src/cmd/version.js +0 -18
  32. package/src/enum/WatcherOpts.js +0 -3
  33. package/src/enum/target.js +0 -6
  34. package/src/helpers/request-listener-helper.js +0 -55
  35. package/src/model/EitriAppType.js +0 -4
  36. package/src/model/Payload.js +0 -45
  37. package/src/model/Target.js +0 -61
  38. package/src/model/User.js +0 -11
  39. package/src/service/AuthConfig.js +0 -85
  40. package/src/service/BlindGuardian.js +0 -131
  41. package/src/service/CliLogin.js +0 -52
  42. package/src/service/ConfigService.js +0 -9
  43. package/src/service/CredentialsService.js +0 -47
  44. package/src/service/EitriAppManager.js +0 -32
  45. package/src/service/EitriAppService.js +0 -49
  46. package/src/service/Emulator/AndroidEmulatorService.js +0 -132
  47. package/src/service/Emulator/IOSEmulatorService.js +0 -71
  48. package/src/service/EmulatorService.js +0 -17
  49. package/src/service/GATrackingStrategy.js +0 -16
  50. package/src/service/HashFolder.js +0 -79
  51. package/src/service/Http.js +0 -300
  52. package/src/service/HuginService.js +0 -38
  53. package/src/service/InviteService.js +0 -45
  54. package/src/service/LibsService.js +0 -191
  55. package/src/service/ManageEnvService.js +0 -10
  56. package/src/service/MiniLog.js +0 -166
  57. package/src/service/PrerequisitesValidator.js +0 -99
  58. package/src/service/QRCodeFactory.js +0 -81
  59. package/src/service/ReleaseService.js +0 -126
  60. package/src/service/Server.js +0 -220
  61. package/src/service/StarterService.js +0 -31
  62. package/src/service/TagTree.js +0 -101
  63. package/src/service/TargetService.js +0 -97
  64. package/src/service/TrackService.js +0 -11
  65. package/src/service/TrackingEitriAnalytics.js +0 -26
  66. package/src/service/TrackingService.js +0 -183
  67. package/src/service/ValidateResult.js +0 -57
  68. package/src/service/Watcher.js +0 -118
  69. package/src/service/Workspace.js +0 -1045
  70. package/src/service/WorkspaceManager.js +0 -76
  71. package/src/service/factories/DoubtsStarterFactory.js +0 -25
  72. package/src/service/factories/MiniWebAppFactory.js +0 -44
  73. package/src/service/factories/QRCodeStarterFactory.js +0 -154
  74. package/src/service/factories/WebStarterFactory.js +0 -88
  75. package/src/service/factories/WoodCoffeeFactory.js +0 -292
  76. package/src/util/AboutTemplate.jsx +0 -14
  77. package/src/util/FileUtils.js +0 -25
  78. package/src/util/GenericUtils.js +0 -41
  79. package/src/util/LibUtil.js +0 -32
  80. package/src/util/LogUtil.js +0 -14
  81. package/src/util/UrlUtils.js +0 -12
  82. package/src/util/UserLocalCredential.js +0 -128
  83. package/src/util/convertKeysToCamelCase.js +0 -26
  84. package/src/util/error-messages/error-messages.js +0 -24
  85. package/src/util/error-messages/invite/invite-error-messages.js +0 -14
  86. package/src/util/getCliVersion.js +0 -13
  87. package/src/util/getCreateFactory.js +0 -9
  88. package/src/util/getWorkspace.js +0 -37
  89. package/src/util/ipv4.js +0 -19
  90. package/src/util/manage-env.js +0 -65
  91. package/src/util/open-docs.js +0 -7
  92. package/src/util/os.js +0 -39
  93. package/src/util/server-url.js +0 -15
  94. package/src/util/template-utils.js +0 -21
  95. package/src/view/index.html +0 -19
package/.husky/pre-commit CHANGED
File without changes
@@ -18,11 +18,15 @@ export interface StartArguments {
18
18
  playground?: boolean
19
19
  initializationParams?: string
20
20
  }
21
+ export interface SelectArgs {
22
+ name?: string
23
+ local?: boolean
24
+ }
21
25
  export interface CreateArguments {
22
26
  projectName: string
23
27
  application?: string
24
28
  yes?: boolean
25
- bundle?: boolean
29
+ template?: boolean
26
30
  }
27
31
  export interface EitriLibsArguments {
28
32
  bifrost?: boolean
@@ -65,4 +69,10 @@ export declare namespace app {
65
69
  export declare namespace workspace {
66
70
  export function clean(): Promise<void>
67
71
  export function current(): Promise<void>
72
+ export function create(): Promise<void>
73
+ export function list(): Promise<void>
74
+ /**
75
+ * Use is a reserved word in Rust
76
+ */
77
+ export function select(args: SelectArgs): Promise<void>
68
78
  }
package/index.js CHANGED
@@ -3,8 +3,6 @@ const commander = require("commander");
3
3
  const program = new commander.Command();
4
4
  const emoji = require("emojilib");
5
5
  const path = require("path");
6
- const { workspace } = require("./src/service/Workspace");
7
- const configService = require("./src/service/ConfigService");
8
6
  const VegvisirCommand = require("./src/modules/vegvisir/VegvisirCommand");
9
7
  const AppCommand = require("./src/modules/app/AppCommand");
10
8
  const debug = require("debug")("eitri:run");
@@ -32,17 +30,7 @@ const run = async () => {
32
30
  // Temporariamente necessário por conta de no contexto do Rust não saber o diretório atual, dessa forma exportando o fullPath do config é possível.
33
31
  // Quando se tornar uma CLI somente em rust no processo de instalação podemos declarar o caminho, como é via NPM pode ter caminhos variados de acordo com sistema de versionamento, NVM, Volta, ASDF é necessário a variável abaixo.
34
32
  process.env.CONFIG_DIR_PATH = path.join(__dirname, "eitri-cli-v2", "config");
35
- try {
36
- const srcFolder2watch = path.join(process.cwd(), "src");
37
- workspace.setFolder2Watch(srcFolder2watch);
38
- workspace.setServerUrl(`${configService.get("workspace").url}`);
39
- } catch (e) {
40
- debug("Erro no set da pasta", { message: e?.message, error: e });
41
- if (process.env.LOG_LEVEL === "full") {
42
- console.log("Current directory listening has failed", e);
43
- }
44
- // Continuando como antes...
45
- }
33
+
46
34
 
47
35
 
48
36
  try {
@@ -72,14 +60,9 @@ const run = async () => {
72
60
  .option("--yes", "Aceita o redirecionamento para o console")
73
61
  .option("-v, --verbose", "Exibe mais logs")
74
62
  .action(async (cmdObj) => {
75
- const isLoginV3 = process.env.FT_LOGIN_V3
76
- if (isLoginV3 === 'true') {
77
- await globalEitriCLIV2.login(cmdObj)
78
- return
79
- }
63
+ await globalEitriCLIV2.login(cmdObj)
64
+ return
80
65
 
81
- console.log("\n\n Iniciando login \n");
82
- require("./src/cmd/loginV2")(cmdObj);
83
66
  });
84
67
 
85
68
  program
@@ -90,7 +73,7 @@ const run = async () => {
90
73
  "--application <application>",
91
74
  "Define o application de execução do Eitri-App"
92
75
  )
93
- .option("-b, --bundle", "Fornece um select de qual bundle deseja utilizar para criar o Eitri-App")
76
+ .option("-t, --template", "Fornece uma variedade de templates para utilizar ao criar o Eitri-App")
94
77
  .option("-v, --verbose", "Exibe mais logs")
95
78
  .action(async (projectName, cmdObj) => {
96
79
  return await globalEitriCLIV2.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eitri-cli",
3
- "version": "1.38.0-beta.9",
3
+ "version": "1.39.0-beta.1",
4
4
  "description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -24,43 +24,11 @@
24
24
  "author": "Calindra",
25
25
  "license": "ISC",
26
26
  "dependencies": {
27
- "adm-zip": "^0.5.9",
28
27
  "axios": "^1.7.2",
29
- "axios-cookiejar-support": "^5.0.2",
30
- "base-64": "^0.1.0",
31
- "base64url": "^3.0.1",
32
- "camelcase": "^6.3.0",
33
- "chalk": "^3.0.0",
34
- "cheerio": "^1.0.0-rc.3",
35
- "cli-progress": "^3.4.0",
36
28
  "commander": "^9.2.0",
37
- "config": "^3.3.0",
38
- "cors": "^2.8.5",
39
29
  "emojilib": "^2.4.0",
40
- "express": "^4.17.3",
41
- "express-rate-limit": "^6.3.0",
42
- "figlet": "^1.2.4",
43
- "folder-hash": "^3.3.0",
44
- "form-data": "^4.0.0",
45
- "get-folder-size": "^2.0.1",
46
- "inquirer": "^7.0.0",
47
- "js-yaml": "^4.1.0",
48
- "jsonwebtoken": "^9.0.2",
49
- "lz-string": "^1.5.0",
50
- "node-watch": "^0.6.3",
51
- "open": "^7.0.0",
52
- "ps-node": "^0.1.6",
53
- "qrcode": "^1.5.3",
54
- "semver": "^7.1.3",
55
- "slugify": "^1.4.0",
56
- "socket.io-client": "^4.5.2",
57
- "standard-version": "^9.5.0",
58
- "temp-dir": "^2.0.0",
59
- "tmp": "^0.1.0",
60
- "tough-cookie": "^4.1.4",
61
- "tough-cookie-file-store": "^2.0.2",
62
- "uuid": "^7.0.2",
63
- "yaml": "^2.4.2"
30
+ "semver": "^7.7.0",
31
+ "uuid": "^7.0.2"
64
32
  },
65
33
  "devDependencies": {
66
34
  "@commitlint/cli": "^17.7.2",
@@ -68,24 +36,10 @@
68
36
  "@faker-js/faker": "^7.6.0",
69
37
  "@semantic-release/changelog": "^6.0.3",
70
38
  "@semantic-release/git": "^10.0.1",
71
- "eslint": "^9.5.0",
72
- "eslint-config-google": "^0.14.0",
73
- "eslint-plugin-jest": "^28.6.0",
74
- "eslint-plugin-prettier": "^5.1.3",
75
39
  "husky": "^8.0.3",
76
40
  "jest": "^29.7.0",
77
41
  "lint-staged": "^9.5.0",
78
- "nock": "^13.3.0",
79
- "prettier": "^3.3.2",
80
42
  "puppeteer": "22.12.1",
81
43
  "semantic-release": "^22.0.8"
82
- },
83
- "resolutions": {
84
- "lodash": "4.17.21",
85
- "minimist": "1.2.6",
86
- "ansi-regex": "5.0.1",
87
- "merge": "2.1.1",
88
- "tar": "6.1.9",
89
- "handlebars": "4.7.7"
90
44
  }
91
45
  }
@@ -35,7 +35,7 @@ module.exports = function AppCommand() {
35
35
  app
36
36
  .command("create <application-name>")
37
37
  .description(
38
- "Cria múltiplos Eitri-Apps para um Aplicativo, baseado em um bundle selecionado."
38
+ "Cria múltiplos Eitri-Apps para um Aplicativo, baseado em um Template selecionado."
39
39
  )
40
40
  .option("-v, --verbose", "Exibe mais logs")
41
41
  .action(async (applicationName, cmdObj) => {
@@ -1,7 +1,6 @@
1
1
  const commander = require("commander");
2
-
2
+ const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
3
3
  module.exports = function VegvisirCommand() {
4
- const NEW_CLI_VERSION = process.env.CLI_VERSION === "v2";
5
4
 
6
5
  const workspaceCommand = commander
7
6
  .command("workspace")
@@ -13,7 +12,7 @@ module.exports = function VegvisirCommand() {
13
12
  .command("list")
14
13
  .description("Lista os workspaces do usuário")
15
14
  .action(async (cmdObj) => {
16
- require("./cmd/list")(cmdObj);
15
+ await eitriCLIV2.workspace.list()
17
16
  });
18
17
 
19
18
  workspaceCommand
@@ -28,14 +27,14 @@ module.exports = function VegvisirCommand() {
28
27
  "Permite selecionar um workspace previamente criado pelo nome"
29
28
  )
30
29
  .action(async (cmdObj) => {
31
- require("./cmd/use.js")(cmdObj);
30
+ return await eitriCLIV2.workspace.select(cmdObj)
32
31
  });
33
32
 
34
33
  workspaceCommand
35
34
  .command("create")
36
35
  .description("Cria um workspace para desenvolvimento de Eitri-Apps")
37
- .action((cmdObj) => {
38
- require("./cmd/create")(cmdObj);
36
+ .action(async () => {
37
+ await eitriCLIV2.workspace.create();
39
38
  });
40
39
 
41
40
  workspaceCommand
@@ -43,13 +42,9 @@ module.exports = function VegvisirCommand() {
43
42
  .description(
44
43
  "Exibe o workspace atual, obedecendo a prioridade Local > Global."
45
44
  )
46
- .action(async (cmdObj) => {
47
- if (NEW_CLI_VERSION) {
48
- const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
49
- return await eitriCLIV2.workspace.current();
50
- }
45
+ .action(async () => {
46
+ return await eitriCLIV2.workspace.current();
51
47
 
52
- require("./cmd/current")(cmdObj);
53
48
  });
54
49
 
55
50
  workspaceCommand
@@ -58,7 +53,6 @@ module.exports = function VegvisirCommand() {
58
53
  "Realiza a limpeza do workspace remoto do desenvolvedor. Útil quando há mal funcionamento na compilação em nuvem do Eitri-App. Obedece a prioridade Local > Global."
59
54
  )
60
55
  .action(async () => {
61
- const eitriCLIV2 = require("../../../eitri-cli-v2/index.js");
62
56
  await eitriCLIV2.workspace.clean();
63
57
  });
64
58
 
package/.eslintrc.json DELETED
@@ -1,26 +0,0 @@
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 DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "printWidth": 130,
3
- "tabWidth": 4,
4
- "singleQuote": false,
5
- "semi": false
6
- }
package/src/cmd/clean.js DELETED
@@ -1,144 +0,0 @@
1
- const { workspace } = require('../service/Workspace')
2
- const validator = require('./validate')
3
- const TrackingService = require('../service/TrackingService')
4
- const config = require('../service/ConfigService')
5
- const TargetService = require('../service/TargetService')
6
- const inquirer = require('inquirer')
7
- const TrackingEitriAnalytics = require('../service/TrackingEitriAnalytics')
8
- const UserLocalCredential = require('../util/UserLocalCredential')
9
-
10
- const blindGuardian = workspace.blindGuardian
11
- const trackingService = new TrackingService(blindGuardian)
12
- const targetService = new TargetService(workspace)
13
-
14
- module.exports = async function clean(cmdObj) {
15
- try {
16
- UserLocalCredential.checkForCredentials()
17
- } catch (error) {
18
- const errorMessage = cmdObj?.verbose ? error : error?.message
19
- console.error("\n", errorMessage, "\n")
20
- return
21
- }
22
-
23
- try {
24
- await validator.assertCommandNotRunning('clean')
25
-
26
- blindGuardian.readConf()
27
- workspace.setServerUrl(config.get('workspace').url)
28
- await workspace.init()
29
-
30
- console.log('Limpando compilador')
31
-
32
- await workspace.clean()
33
-
34
- console.log('[1] Limpo.')
35
-
36
- TrackingEitriAnalytics.sendEvent({
37
- eventName: "clean",
38
- userId: workspace?.userEmail
39
- })
40
- process.exit(0)
41
- } catch (e) {
42
- TrackingEitriAnalytics.sendEvent({
43
- eventName: "clean.error",
44
- userId: workspace?.userEmail,
45
- data: {
46
- errorMessage: e?.message || ""
47
- }
48
- })
49
-
50
- if(!e) {
51
- console.error('Erro desconhecido')
52
- process.exit(1)
53
- }
54
-
55
- if (cmdObj.verbose) {
56
- console.error('Falha deletando workspace remoto', e)
57
- }
58
-
59
- const exit = async () => {
60
- await trackingService.sendError(e)
61
- process.exit(1)
62
- }
63
-
64
- const { httpStatus, response } = e
65
-
66
- if(response){
67
- const { data } = response
68
-
69
- const transactionId = data.req_id
70
-
71
- const printError = (message) => console.error(`${transactionId}: ${message}`)
72
-
73
- const tryExitWithFriendlyMessage = async () => {
74
- if(data && data.friendlyMessage) {
75
- const {friendlyMessage} = data
76
- printError(friendlyMessage)
77
- await exit()
78
- }
79
- }
80
-
81
- if(httpStatus === 403) {
82
- await tryExitWithFriendlyMessage()
83
- printError('Acesso negado! Confira se você está registrado como desenvolvedor deste Eitri-App.')
84
- await exit()
85
- }
86
- if(httpStatus === 500) {
87
- if(data && data.error.includes('ENOENT: no such file or directory')) {
88
- // O workspace remoto ja nao existe, portanto nada fazemos.
89
- console.log('[2] Limpeza finalizada com sucesso.')
90
- await exit()
91
- }
92
- await tryExitWithFriendlyMessage()
93
- printError('Erro interno!')
94
- await exit()
95
- }
96
- printError('Ops: ocorreu um erro inesperado realizar a limpeza :-(')
97
- }
98
- console.error(`Ops: ocorreu um erro durante a limpeza: ${e.message}`)
99
- await exit()
100
- }
101
- }
102
-
103
- async function track(miniConf, start) {
104
- let libs = await targetService.getLibs()
105
- let event = {
106
- superClientVersion: miniConf[libs.superAppClientLibName],
107
- componentsVersion: miniConf[libs.componentsLibName],
108
- miniAppSlug: miniConf.slug,
109
- miniAppVersion: miniConf.version,
110
- timeMs: Date.now() - start,
111
- }
112
- await trackingService.sendPushedVersion(event)
113
- }
114
-
115
- function checkErros(miniConf) {
116
- let validateResult = validator.validate(miniConf)
117
- validateResult.errors.forEach(message => console.log(message))
118
- return validateResult
119
- }
120
-
121
- async function logPermissionsAndOpenPrompt(addedPermissions, removedPermissions, cmdObj) {
122
- const GREEN_COLOR = '\x1b[32m'
123
- const RED_COLOR = '\x1b[31m'
124
- const MINIMAL_LENGTH = 0
125
- if(addedPermissions.length > MINIMAL_LENGTH) {
126
- console.log(`${GREEN_COLOR}\nPermissões adicionadas: ${addedPermissions}${GREEN_COLOR}`)
127
- }
128
- if(removedPermissions.length > MINIMAL_LENGTH) {
129
- console.log(`${RED_COLOR}Permissões removidas: ${removedPermissions}\n${RED_COLOR}`)
130
- }
131
- if(!cmdObj.yes && (addedPermissions.length > MINIMAL_LENGTH || removedPermissions.length > MINIMAL_LENGTH)) {
132
- const answer = await inquirer.prompt([
133
- {
134
- name: 'option',
135
- message: 'Houve uma alteração nas permissões em relação a versão publicada. Deseja Continuar?',
136
- type: 'rawlist',
137
- choices: ['Sim', 'Não']
138
- }
139
- ])
140
- if(answer.option === 'Não') {
141
- process.exit(0)
142
- }
143
- }
144
- }