eitri-cli 1.0.2
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/README.md +54 -0
- package/bitbucket-pipelines.toBeChanged.yml +64 -0
- package/boilerplate/mini-app-cafe-madeira.zip +0 -0
- package/check-version.js +12 -0
- package/config/default-eitri.js +1 -0
- package/config/dev.js +91 -0
- package/config/k8s-eitri.js +92 -0
- package/config/loc-eitri.js +92 -0
- package/config/prod-eitri.js +92 -0
- package/config/test-eitri.js +2 -0
- package/index-eitri.js +6 -0
- package/index.js +182 -0
- package/install-dev.bat +1 -0
- package/install-dev.sh +1 -0
- package/jest.config.js +6 -0
- package/jsconfig.json +9 -0
- package/package.json +80 -0
- package/publisher.js +53 -0
- package/src/cmd/clean.js +179 -0
- package/src/cmd/create.js +281 -0
- package/src/cmd/credentials.js +105 -0
- package/src/cmd/invite.js +87 -0
- package/src/cmd/list.js +36 -0
- package/src/cmd/login.js +51 -0
- package/src/cmd/manage-env.js +129 -0
- package/src/cmd/open-share.js +6 -0
- package/src/cmd/order-details.js +6 -0
- package/src/cmd/push-version.js +182 -0
- package/src/cmd/show-message-if-outdated-package.js +32 -0
- package/src/cmd/signup.js +69 -0
- package/src/cmd/start.js +171 -0
- package/src/cmd/tail-logs.js +26 -0
- package/src/cmd/test-initialization-params.js +6 -0
- package/src/cmd/validate.js +170 -0
- package/src/cmd/version.js +29 -0
- package/src/enum/WatcherOpts.js +3 -0
- package/src/enum/target.js +6 -0
- package/src/helpers/request-listener-helper.js +55 -0
- package/src/model/Payload.js +45 -0
- package/src/model/Target.js +76 -0
- package/src/model/User.js +11 -0
- package/src/service/AuthConfig.js +88 -0
- package/src/service/BlindGuardian.js +134 -0
- package/src/service/CliLogin.js +47 -0
- package/src/service/ConfigService.js +16 -0
- package/src/service/CredentialsService.js +47 -0
- package/src/service/GATrackingStrategy.js +16 -0
- package/src/service/HashFolder.js +79 -0
- package/src/service/Http.js +234 -0
- package/src/service/InviteService.js +45 -0
- package/src/service/ManageEnvService.js +10 -0
- package/src/service/MiniLog.js +132 -0
- package/src/service/QRCodeFactory.js +43 -0
- package/src/service/Server.js +239 -0
- package/src/service/StarterService.js +31 -0
- package/src/service/TagTree.js +101 -0
- package/src/service/TargetService.js +97 -0
- package/src/service/TrackService.js +11 -0
- package/src/service/TrackingEitriAnalytics.js +32 -0
- package/src/service/TrackingService.js +183 -0
- package/src/service/ValidateResult.js +57 -0
- package/src/service/Watcher.js +119 -0
- package/src/service/Workspace.js +1069 -0
- package/src/service/WorkspaceManager.js +74 -0
- package/src/service/factories/DoubtsStarterFactory.js +25 -0
- package/src/service/factories/MiniWebAppFactory.js +43 -0
- package/src/service/factories/QRCodeStarterFactory.js +78 -0
- package/src/service/factories/WebStarterFactory.js +88 -0
- package/src/service/factories/WoodCoffeeFactory.js +230 -0
- package/src/util/AboutTemplate.jsx +14 -0
- package/src/util/UrlUtils.js +12 -0
- package/src/util/UserLocalCredential.js +122 -0
- package/src/util/error-messages/error-messages.js +24 -0
- package/src/util/error-messages/invite/invite-error-messages.js +14 -0
- package/src/util/getCliVersion.js +13 -0
- package/src/util/getCreateFactory.js +9 -0
- package/src/util/ipv4.js +19 -0
- package/src/util/manage-env.js +65 -0
- package/src/util/open-docs.js +7 -0
- package/src/util/os.js +39 -0
- package/src/util/server-url.js +15 -0
- package/src/util/template-utils.js +21 -0
- package/src/view/index.html +19 -0
- package/targetMobileStickyness.md +47 -0
- package/targetWebStickyness.md +40 -0
- package/test/_fixtures/factory.js +30 -0
- package/test/_fixtures/miniWebApp/miniapp.conf.js +4 -0
- package/test/_fixtures/miniapp.conf.js +5 -0
- package/test/_fixtures/server/HelloWorldBackend.js +7 -0
- package/test/_fixtures/src/Home.js +5 -0
- package/test/_fixtures/src/Home2.js +5 -0
- package/test/_fixtures/src/commons/util.js +3 -0
- package/test/_fixtures/src/components/TagA.jsx +4 -0
- package/test/_fixtures/src/components/TagB.jsx +4 -0
- package/test/_fixtures/src/components/TagC.jsx +3 -0
- package/test/_fixtures/src/components/TagD.jsx +3 -0
- package/test/_fixtures/src/server/foo.js +7 -0
- package/test/_fixtures/src/views/AboutTemplate.jsx +14 -0
- package/test/_fixtures/woodcoffee/miniapp.conf.js +3 -0
- package/test/ame.conf.js +3 -0
- package/test/cmd/clean.test.js +66 -0
- package/test/cmd/create.test.js +252 -0
- package/test/cmd/credentials.test.js +159 -0
- package/test/cmd/list.test.js +74 -0
- package/test/cmd/manage-env.test.js +168 -0
- package/test/cmd/signup.test.js +20 -0
- package/test/cmd/start.test.js +5 -0
- package/test/miniapp.conf.js +3 -0
- package/test/model/Payload.test.js +35 -0
- package/test/service/BlindGuardian.test.js +84 -0
- package/test/service/CheckAmeConf.test.js +313 -0
- package/test/service/Http.test.js +312 -0
- package/test/service/InviteService.test.js +117 -0
- package/test/service/MiniWebAppFactory.test.js +40 -0
- package/test/service/TagTree.test.js +81 -0
- package/test/service/TargetService.test.js +48 -0
- package/test/service/TrackingService.test.js +105 -0
- package/test/service/UserAmeConf.test.js +47 -0
- package/test/service/WoodCoffeeFactory.test.js +148 -0
- package/test/service/Workspace.test.js +364 -0
- package/thinQrCode.md +58 -0
- package/v1.5.0.md +3 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const inviteErrorMessage = require('./invite/invite-error-messages')
|
|
2
|
+
|
|
3
|
+
class ErrorMessages {
|
|
4
|
+
constructor(action, status) {
|
|
5
|
+
this.inviteErrorMessage = inviteErrorMessage
|
|
6
|
+
this.message = this.getErrorMessage(action, status)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getErrorMessage(action, status) {
|
|
10
|
+
let message
|
|
11
|
+
|
|
12
|
+
switch (action) {
|
|
13
|
+
case 'invite':
|
|
14
|
+
message = this.inviteErrorMessage(status)
|
|
15
|
+
break
|
|
16
|
+
default:
|
|
17
|
+
message = null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return message
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = ErrorMessages
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = function inviteErrorMessages(status) {
|
|
2
|
+
let message
|
|
3
|
+
|
|
4
|
+
switch (status) {
|
|
5
|
+
case 403:
|
|
6
|
+
message =
|
|
7
|
+
'Você precisa de permissão para enviar convites nesse miniapp'
|
|
8
|
+
break
|
|
9
|
+
default:
|
|
10
|
+
message = 'Ocorreu um erro'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return message
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
/**
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
function getCliVersion() {
|
|
7
|
+
const pkgJsonPath = path.join(__dirname, '..', '..', 'package.json')
|
|
8
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath).toString('utf8'))
|
|
9
|
+
|
|
10
|
+
return pkgJson.version
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = getCliVersion
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const MiniWebAppFactory = require('../service/factories/MiniWebAppFactory')
|
|
2
|
+
const WookCoffee = require('../service/factories/WoodCoffeeFactory')
|
|
3
|
+
|
|
4
|
+
module.exports = function getCreateFactory(platform) {
|
|
5
|
+
if(platform === 'mobile') {
|
|
6
|
+
return new WookCoffee()
|
|
7
|
+
}
|
|
8
|
+
return new MiniWebAppFactory()
|
|
9
|
+
}
|
package/src/util/ipv4.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const os = require('os')
|
|
2
|
+
const ifaces = os.networkInterfaces()
|
|
3
|
+
|
|
4
|
+
module.exports = function findIps() {
|
|
5
|
+
const ips = []
|
|
6
|
+
Object.keys(ifaces).forEach(function(ifname) {
|
|
7
|
+
let alias = 0
|
|
8
|
+
|
|
9
|
+
ifaces[ifname].forEach(function(iface) {
|
|
10
|
+
if ('IPv4' !== iface.family || iface.internal !== false) {
|
|
11
|
+
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
ips.push(iface.address)
|
|
15
|
+
++alias
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
return ips
|
|
19
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
getEnvPattern: function () {
|
|
3
|
+
const pattern = /^[A-Z][A-Z0-9_]+$/
|
|
4
|
+
return pattern
|
|
5
|
+
},
|
|
6
|
+
buildEnvFile: function (envCode, fileNames, envVars, slug, miniAppVersion) {
|
|
7
|
+
if (!fileNames || fileNames.length === 0) {
|
|
8
|
+
throw new Error('Não existe aquivo na pasta server.')
|
|
9
|
+
}
|
|
10
|
+
const envFile = { envCode, fileNames, envVars, slug, miniAppVersion }
|
|
11
|
+
return envFile
|
|
12
|
+
},
|
|
13
|
+
createKeyAndValue: function (str) {
|
|
14
|
+
const separatorIndex = str.indexOf('=')
|
|
15
|
+
const key = str.substring(0, separatorIndex)
|
|
16
|
+
const val = str.substring(separatorIndex + 1)
|
|
17
|
+
return { key, val }
|
|
18
|
+
},
|
|
19
|
+
environmentVariable: function (envList) {
|
|
20
|
+
const { getEnvPattern, createKeyAndValue } = require('./manage-env')
|
|
21
|
+
const initialValue = {}
|
|
22
|
+
const environmentVariables = envList.reduce((envVariables, value) => {
|
|
23
|
+
const { key, val } = createKeyAndValue(value)
|
|
24
|
+
const envPattren = getEnvPattern()
|
|
25
|
+
const isValidKey = envPattren.test(key)
|
|
26
|
+
|
|
27
|
+
if (!isValidKey) {
|
|
28
|
+
throw new Error(`A chave ${key} é inválida`)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
envVariables[key] = val
|
|
32
|
+
|
|
33
|
+
return envVariables
|
|
34
|
+
|
|
35
|
+
}, initialValue)
|
|
36
|
+
|
|
37
|
+
return environmentVariables
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
panicCheckEnvList: function (envList) {
|
|
41
|
+
if (!envList || envList.length === 0) {
|
|
42
|
+
throw new Error('Nenhuma variavel de ambiente foi fornecida.')
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
sendEnvfile: async function (workspace, url, envFile) {
|
|
47
|
+
const result = await workspace.http.post(`${url}/env`, envFile)
|
|
48
|
+
return result
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
getEnvName: function(cmd) {
|
|
52
|
+
// por default configura o workspace
|
|
53
|
+
let envName = 'ws'
|
|
54
|
+
if (cmd.prod) {
|
|
55
|
+
envName = 'prd'
|
|
56
|
+
} else if (cmd.hml) {
|
|
57
|
+
envName = 'hml'
|
|
58
|
+
} else if (cmd.dev) {
|
|
59
|
+
envName = 'dev'
|
|
60
|
+
}
|
|
61
|
+
return envName
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
package/src/util/os.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const util = require('util')
|
|
2
|
+
const exec = util.promisify(require('child_process').exec)
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const macTempDir = require('temp-dir')
|
|
5
|
+
const tempDir = require('os').tmpdir()
|
|
6
|
+
|
|
7
|
+
const MAC_ZIP_PATH = macTempDir
|
|
8
|
+
const LINUX_ZIP_PATH = tempDir
|
|
9
|
+
const WINDOWS_ZIP_PATH = tempDir
|
|
10
|
+
|
|
11
|
+
const macStrategy = async () => {
|
|
12
|
+
if (!fs.existsSync(MAC_ZIP_PATH)) {
|
|
13
|
+
await exec(`mkdir ${MAC_ZIP_PATH}`)
|
|
14
|
+
}
|
|
15
|
+
return MAC_ZIP_PATH
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const linuxStrategy = async () => {
|
|
19
|
+
if (!fs.existsSync(LINUX_ZIP_PATH)) {
|
|
20
|
+
await exec(`mkdir ${LINUX_ZIP_PATH}`)
|
|
21
|
+
}
|
|
22
|
+
return LINUX_ZIP_PATH
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const windowsStrategy = async () => {
|
|
26
|
+
if (!fs.existsSync(WINDOWS_ZIP_PATH)) {
|
|
27
|
+
await exec(`mkdir ${WINDOWS_ZIP_PATH}`)
|
|
28
|
+
}
|
|
29
|
+
return WINDOWS_ZIP_PATH
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const OS_MAPPER = {
|
|
33
|
+
linux: linuxStrategy,
|
|
34
|
+
win32: windowsStrategy,
|
|
35
|
+
darwin: macStrategy,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = { OS_MAPPER }
|
|
39
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const ipv4 = require('./ipv4')
|
|
2
|
+
|
|
3
|
+
function getServerUrl(cmdObj) {
|
|
4
|
+
if (cmdObj.local) {
|
|
5
|
+
return `http://${ipv4()[0]}:3000`
|
|
6
|
+
} else if (cmdObj.hml) {
|
|
7
|
+
return 'https://miniapps.hml.amedigital.com'
|
|
8
|
+
} else if (cmdObj.dev) {
|
|
9
|
+
return 'https://dev.eitri.calindra.com.br'
|
|
10
|
+
} else {
|
|
11
|
+
return 'https://workspace.lab.calindra.com.br'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = getServerUrl
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
|
|
3
|
+
getTemplateName: function(){
|
|
4
|
+
return {
|
|
5
|
+
serverless: 'servless-backend-template',
|
|
6
|
+
persistere: 'persistere-template'
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
getTemplateDescription: function(){
|
|
12
|
+
return [
|
|
13
|
+
{name: 'serverless', description:'Gera um exemplo de um projeto miniapp, integrado com serverless backend'},
|
|
14
|
+
{name: 'persistere', description:'Gera um exemplo de um projeto miniapp, integrado com o persistere'}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
getTemplateUrl: function(templateUrl){
|
|
19
|
+
return `${templateUrl}.git`
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<style>
|
|
5
|
+
body {
|
|
6
|
+
background-image: url('qrcode.png');
|
|
7
|
+
background-repeat: no-repeat;
|
|
8
|
+
background-attachment: fixed;
|
|
9
|
+
background-position: center;
|
|
10
|
+
background-color: #ffffff;
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
</head>
|
|
14
|
+
|
|
15
|
+
<body>
|
|
16
|
+
|
|
17
|
+
</body>
|
|
18
|
+
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
```plantuml
|
|
2
|
+
@startuml
|
|
3
|
+
autonumber
|
|
4
|
+
title Fluxo de Stickyness para mobile
|
|
5
|
+
|
|
6
|
+
participant Developer
|
|
7
|
+
participant SuperApp
|
|
8
|
+
participant AmeAppTools
|
|
9
|
+
participant ALB
|
|
10
|
+
participant AmeCliReloader1
|
|
11
|
+
participant AmeCliReloader2
|
|
12
|
+
participant AmeCliReloader3
|
|
13
|
+
participant ShareApi
|
|
14
|
+
|
|
15
|
+
Developer->AmeAppTools: start()
|
|
16
|
+
AmeAppTools->AmeAppTools: cookie = loadCookie('~/.ame.cookie.json')
|
|
17
|
+
AmeAppTools->AmeAppTools: bootstrapUrl = bootstrapUrl.append(cookie)
|
|
18
|
+
AmeAppTools->AmeAppTools: data = buildQrCodeData(bootstrapUrl)
|
|
19
|
+
AmeAppTools->ALB: saveQrCodeData(data, cookie)
|
|
20
|
+
ALB->ALB: chooseWorkspaceInstance(cookie)
|
|
21
|
+
note over ALB
|
|
22
|
+
Se o Cookie veio vazio o ALB seleciona o AmeCliReloader1
|
|
23
|
+
Se o Cookie veio preenchido o ALB seleciona a instancia definida no cookie
|
|
24
|
+
end note
|
|
25
|
+
ALB->AmeCliReloader1: saveQrCodeData(data)
|
|
26
|
+
AmeCliReloader1->ShareApi: saveQrCodeData(data)
|
|
27
|
+
ShareApi-->AmeCliReloader1:
|
|
28
|
+
AmeCliReloader1-->ALB:
|
|
29
|
+
ALB-->AmeAppTools: cookie
|
|
30
|
+
AmeAppTools->ALB: uploadSourceCode(cookie, 'foo.js')
|
|
31
|
+
ALB->ALB: chooseWorkspaceInstance(cookie)
|
|
32
|
+
ALB->AmeCliReloader1: uploadSourceCode()
|
|
33
|
+
ALB<--AmeCliReloader1
|
|
34
|
+
ALB->ALB: Se o cookie expirou um novo será gerado
|
|
35
|
+
ALB-->AmeAppTools: cookie
|
|
36
|
+
AmeAppTools->AmeAppTools: save(cookie, '~/.ame.cookie.json')
|
|
37
|
+
AmeAppTools->AmeAppTools: showQrCode()
|
|
38
|
+
Developer->SuperApp: scanQrCode()
|
|
39
|
+
SuperApp->ShareApi: data = getQrCodeData()
|
|
40
|
+
SuperApp->ALB: getMiniApp(data.bootstrapUrl)
|
|
41
|
+
ALB->ALB: chooseWorkpaceInstance(bootstrapUrl.query('cid'))
|
|
42
|
+
ALB->AmeCliReloader1: getMiniApp(data.bootstrapUrl)
|
|
43
|
+
AmeCliReloader1-->ALB: html do miniapp
|
|
44
|
+
ALB-->SuperApp: html do miniapp
|
|
45
|
+
SuperApp->SuperApp: Exibe miniapp
|
|
46
|
+
@enduml
|
|
47
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
```plantuml
|
|
2
|
+
@startuml
|
|
3
|
+
autonumber
|
|
4
|
+
title Fluxo de Stickyness para Web
|
|
5
|
+
|
|
6
|
+
participant Developer
|
|
7
|
+
participant SuperApp
|
|
8
|
+
participant AmeAppTools
|
|
9
|
+
participant Emulator
|
|
10
|
+
participant ALB
|
|
11
|
+
participant AmeCliReloader1
|
|
12
|
+
participant AmeCliReloader2
|
|
13
|
+
participant AmeCliReloader3
|
|
14
|
+
|
|
15
|
+
Developer->AmeAppTools: start()
|
|
16
|
+
AmeAppTools->AmeAppTools: cookie = loadCookie('~/.ame.cookie.json')
|
|
17
|
+
AmeAppTools->AmeAppTools: bootstrapUrl = bootstrapUrl.append(cookie)
|
|
18
|
+
AmeAppTools->ALB: uploadSourceCode(cookie, 'foo.js')
|
|
19
|
+
ALB->ALB: chooseWorkspaceInstance(cookie)
|
|
20
|
+
note over ALB
|
|
21
|
+
Se o Cookie veio vazio o ALB seleciona o AmeCliReloader1
|
|
22
|
+
Se o Cookie veio preenchido o ALB seleciona a instancia definida no cookie
|
|
23
|
+
end note
|
|
24
|
+
ALB->AmeCliReloader1: uploadSourceCode()
|
|
25
|
+
AmeCliReloader1-->ALB:
|
|
26
|
+
ALB->ALB: Se o cookie expirou um novo será gerado
|
|
27
|
+
ALB-->AmeAppTools: cookie
|
|
28
|
+
AmeAppTools->AmeAppTools: save(cookie, '~/.ame.cookie.json')
|
|
29
|
+
AmeAppTools->Emulator: openEmulator(bootstrapUrl)
|
|
30
|
+
Emulator->Emulator: abre url no iframe
|
|
31
|
+
Emulator->AmeAppTools: request pelo próprio localhost
|
|
32
|
+
AmeAppTools->AmeAppTools: troca o host
|
|
33
|
+
AmeAppTools->ALB: getMiniApp(cookie, bootstrapUrl)
|
|
34
|
+
ALB->AmeCliReloader1: getMiniApp(bootstrapUrl)
|
|
35
|
+
AmeCliReloader1-->ALB: html do miniapp
|
|
36
|
+
ALB-->AmeAppTools: html do miniapp + cookie
|
|
37
|
+
AmeAppTools-->Emulator: html do miniapp
|
|
38
|
+
Emulator->Emulator: Exibe miniapp
|
|
39
|
+
@enduml
|
|
40
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
const getTarget = () => {
|
|
3
|
+
return {
|
|
4
|
+
id: 7,
|
|
5
|
+
name: 'CALINDRA_MOBILE',
|
|
6
|
+
minimumCliVersion: '1.16.5',
|
|
7
|
+
boilerplateUrl: 'https://github.com/Calindra/eitri-mobile-mini-app-template',
|
|
8
|
+
superAppClientLibName: 'eitri-app-client',
|
|
9
|
+
componentsLibName: 'eitri-app-components',
|
|
10
|
+
description: 'CALINDRA_MOBILE',
|
|
11
|
+
status: 'ACTIVE',
|
|
12
|
+
platform: 'mobile',
|
|
13
|
+
targetConfig: [],
|
|
14
|
+
bodyClass: 'eitri-mobile',
|
|
15
|
+
sdkSupport: 'eitri-mini-app-sdk-support',
|
|
16
|
+
default: true,
|
|
17
|
+
miniAppBoilerplateList: [
|
|
18
|
+
{
|
|
19
|
+
name: 'serverless',
|
|
20
|
+
boilerplateUrl: 'https://github.com/Calindra/eitri-mobile-mini-app-template',
|
|
21
|
+
description: 'Para uso de miniapp com serverless'
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
getTarget
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<Window>
|
|
2
|
+
<Group>
|
|
3
|
+
<Circle icon={require('../assets/images/icon_ame.svg')} />
|
|
4
|
+
<Spacing size="sm" />
|
|
5
|
+
<Subtitle fontSize="xs" textAlign="center" color="neutralcolor-darkest">Detalhes desta versão</Subtitle>
|
|
6
|
+
<View>
|
|
7
|
+
<Subtitle textAlign="center" fontSize="xxxs" color="neutralcolor-darkest">Este mini-app foi desenvolvido utilizando as seguintes versões:</Subtitle>
|
|
8
|
+
<Spacing size="sm" />
|
|
9
|
+
<Paragraph textAlign="center">Versão da biblioteca de componentes: ###COMPONENTS_LIBRARY_VERSION_HIGHLIGHTER###</Paragraph>
|
|
10
|
+
<Spacing size="sm" />
|
|
11
|
+
<Paragraph textAlign="center">Versão da API de Super Client: ###SUPER_APP_CLIENT_VERSION_HIGHLIGHTER###</Paragraph>
|
|
12
|
+
</View>
|
|
13
|
+
</Group>
|
|
14
|
+
</Window>
|
package/test/ame.conf.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
|
+
|
|
3
|
+
const nock = require('nock')
|
|
4
|
+
const MOCK = true
|
|
5
|
+
const HOST = 'https://dev.eitri.calindra.com.br'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
describe('clean', () => {
|
|
9
|
+
|
|
10
|
+
let workspace
|
|
11
|
+
// let developerToken
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
nock.cleanAll()
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
workspace = require('../../src/service/Workspace').workspace
|
|
17
|
+
// workspace.setFolder2Watch(folder2watch)
|
|
18
|
+
workspace.setServerUrl(HOST)
|
|
19
|
+
workspace.setMiniConf({ version: '0.1.0' })
|
|
20
|
+
workspace.blindGuardian.getToken = async () => {
|
|
21
|
+
return { accessToken: 'xpto' }
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('should successfully clean remote workspace', async () => {
|
|
26
|
+
if (MOCK) {
|
|
27
|
+
nock(HOST)
|
|
28
|
+
.delete('/workspace/sources')
|
|
29
|
+
.matchHeader('authorization', 'Bearer xpto')
|
|
30
|
+
.reply(204)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const error = await workspace.clean().catch(e => e)
|
|
34
|
+
|
|
35
|
+
expect(error).toBeUndefined()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('should successfully finish operation workspace fails with ENOENT error', async () => {
|
|
39
|
+
if (MOCK) {
|
|
40
|
+
nock(HOST)
|
|
41
|
+
.delete('/workspace/sources')
|
|
42
|
+
.matchHeader('authorization', 'Bearer xpto')
|
|
43
|
+
.reply(500, {
|
|
44
|
+
'req_id': 'b7fc6b22-c6e3-4025-b0c4-96bb7eafc826',
|
|
45
|
+
'error': 'Error: ENOENT: no such file or directory, rename \'/home/node/app/storage/fulano@gmail.com\' -> \'/home/node/app/storage/fulano@gmail.com_expired_1663767068880\''
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const error = await workspace.clean().catch(e => e)
|
|
50
|
+
|
|
51
|
+
expect(error.response.data.error).toMatch(/.+ENOENT: no such file or directory.+/)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('should throw an error when workspace fails with forbidden error', async () => {
|
|
55
|
+
if (MOCK) {
|
|
56
|
+
nock(HOST)
|
|
57
|
+
.delete('/workspace/sources')
|
|
58
|
+
.matchHeader('authorization', 'Bearer xpto')
|
|
59
|
+
.reply(403, '403 Acesso Negado')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const error = await workspace.clean().catch(e => e)
|
|
63
|
+
|
|
64
|
+
expect(error.response.data).toBe('403 Acesso Negado')
|
|
65
|
+
})
|
|
66
|
+
})
|