eitri-cli 1.4.0-beta.4 → 1.4.0-beta.6
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/index.js +1 -0
- package/package.json +2 -1
- package/src/cmd/push-version.js +44 -1
- package/src/service/Workspace.js +32 -13
- package/test/e2e/cli.test.js +1 -1
package/index.js
CHANGED
|
@@ -77,6 +77,7 @@ const run = async () => {
|
|
|
77
77
|
)
|
|
78
78
|
.option("-l, --local", "Aponta para o servidor local")
|
|
79
79
|
.option("-v, --verbose", "Exibe mais logs")
|
|
80
|
+
.option("-r, --release", "Gera uma nova release baseado nos commits. Um arquivo CHANGELOG.md será gerado automaticamente.")
|
|
80
81
|
.option(
|
|
81
82
|
"-c, --components",
|
|
82
83
|
"Publica o Eitri-App como biblioteca de components"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eitri-cli",
|
|
3
|
-
"version": "1.4.0-beta.
|
|
3
|
+
"version": "1.4.0-beta.6",
|
|
4
4
|
"description": "Command Line Interface to make \"Eitri-App\" with code and fire.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"semver": "^7.1.3",
|
|
58
58
|
"slugify": "^1.4.0",
|
|
59
59
|
"socket.io-client": "^4.5.2",
|
|
60
|
+
"standard-version": "^9.5.0",
|
|
60
61
|
"temp-dir": "^2.0.0",
|
|
61
62
|
"tmp": "^0.1.0",
|
|
62
63
|
"tough-cookie": "^3.0.1",
|
package/src/cmd/push-version.js
CHANGED
|
@@ -11,11 +11,12 @@ const TrackingEitriAnalytics = require('../service/TrackingEitriAnalytics')
|
|
|
11
11
|
const UserLocalCredential = require('../util/UserLocalCredential')
|
|
12
12
|
const VegvisirService = require('../modules/vegvisir/VegvisirService')
|
|
13
13
|
const {randomUUID} = require('crypto')
|
|
14
|
-
|
|
14
|
+
const childProcess = require('child_process')
|
|
15
15
|
const blindGuardian = workspace.blindGuardian
|
|
16
16
|
const trackingService = new TrackingService(blindGuardian)
|
|
17
17
|
const targetService = new TargetService(workspace)
|
|
18
18
|
const vegvisirService = new VegvisirService()
|
|
19
|
+
const standardVersion = require('standard-version')
|
|
19
20
|
|
|
20
21
|
module.exports = async function pushVersion(cmdObj) {
|
|
21
22
|
try {
|
|
@@ -40,6 +41,28 @@ module.exports = async function pushVersion(cmdObj) {
|
|
|
40
41
|
workspace.publishing = true
|
|
41
42
|
const miniConf = workspace.getMiniConf()
|
|
42
43
|
|
|
44
|
+
if (cmdObj?.release) {
|
|
45
|
+
console.log("Iniciando geração de versão com CI")
|
|
46
|
+
try {
|
|
47
|
+
await releaseGenerator(cmdObj)
|
|
48
|
+
const lastTag = childProcess.execSync('git describe --tags --abbrev=0').toString().trim();
|
|
49
|
+
const newVersion = lastTag?.replace(/^v/, "");
|
|
50
|
+
console.log(`Nova versão preparada: ${newVersion}`)
|
|
51
|
+
|
|
52
|
+
miniConf.version = newVersion
|
|
53
|
+
const newMiniConf = {
|
|
54
|
+
...miniConf,
|
|
55
|
+
version: newVersion
|
|
56
|
+
}
|
|
57
|
+
workspace.setMiniConf(newMiniConf)
|
|
58
|
+
|
|
59
|
+
const miniConfUpdated = workspace.getMiniConf()
|
|
60
|
+
console.log(`Versão [${miniConfUpdated?.version}] atualizada no eitri-app.conf.js`)
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error("Erro ao gerar a nova versão: ", error?.message)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
43
66
|
let validateResult = checkErros(miniConf)
|
|
44
67
|
|
|
45
68
|
if (!validateResult.isSuccess()) {
|
|
@@ -194,3 +217,23 @@ async function logPermissionsAndOpenPrompt(addedPermissions, removedPermissions,
|
|
|
194
217
|
}
|
|
195
218
|
}
|
|
196
219
|
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
async function releaseGenerator(cmdObj) {
|
|
223
|
+
return new Promise((resolve, reject) => {
|
|
224
|
+
standardVersion({
|
|
225
|
+
noVerify: true,
|
|
226
|
+
silent: true,
|
|
227
|
+
releaseCommitMessageFormat: "[skip ci]"
|
|
228
|
+
}).then(() => {
|
|
229
|
+
resolve()
|
|
230
|
+
}).catch(err => {
|
|
231
|
+
if (cmdObj?.verbose) {
|
|
232
|
+
console.error(`standard-version failed with message: ${err?.message}`)
|
|
233
|
+
}
|
|
234
|
+
const errorMessage = "Ocorreu um erro ao gerar a versão. Por favor, verifique se a versão foi gerada no Console."
|
|
235
|
+
reject(errorMessage)
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
})
|
|
239
|
+
}
|
package/src/service/Workspace.js
CHANGED
|
@@ -189,22 +189,41 @@ class Workspace {
|
|
|
189
189
|
setMiniConf(miniConf) {
|
|
190
190
|
this._miniConf = miniConf;
|
|
191
191
|
return new Promise((resolve, reject) => {
|
|
192
|
-
const
|
|
192
|
+
const eitriAppConfPath = path.resolve(
|
|
193
193
|
this.folder2watch,
|
|
194
|
-
"../
|
|
194
|
+
"../eitri-app.conf.js"
|
|
195
195
|
);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
196
|
+
if (fs.existsSync(eitriAppConfPath)) {
|
|
197
|
+
const jsonContent = JSON.stringify(miniConf, null, 4);
|
|
198
|
+
fs.writeFile(
|
|
199
|
+
eitriAppConfPath,
|
|
200
|
+
`module.exports = ${jsonContent}`,
|
|
201
|
+
(err) => {
|
|
202
|
+
if (err) {
|
|
203
|
+
console.log(err);
|
|
204
|
+
return reject(err);
|
|
205
|
+
}
|
|
206
|
+
resolve();
|
|
204
207
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
+
);
|
|
209
|
+
} else {
|
|
210
|
+
const miniAppConfPath = path.resolve(
|
|
211
|
+
this.folder2watch,
|
|
212
|
+
"../miniapp.conf.js"
|
|
213
|
+
);
|
|
214
|
+
const jsonContent = JSON.stringify(miniConf, null, 4);
|
|
215
|
+
fs.writeFile(
|
|
216
|
+
miniAppConfPath,
|
|
217
|
+
`module.exports = ${jsonContent}`,
|
|
218
|
+
(err) => {
|
|
219
|
+
if (err) {
|
|
220
|
+
console.log(err);
|
|
221
|
+
return reject(err);
|
|
222
|
+
}
|
|
223
|
+
resolve();
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}
|
|
208
227
|
});
|
|
209
228
|
}
|
|
210
229
|
|
package/test/e2e/cli.test.js
CHANGED
|
@@ -117,7 +117,7 @@ describe("eitri-cli", () => {
|
|
|
117
117
|
inputPassword.type(String(loginVars.EITRI_TEST_LOGIN_PASSWORD));
|
|
118
118
|
|
|
119
119
|
const buttonElement = await page.waitForXPath(
|
|
120
|
-
"/
|
|
120
|
+
'//*[@id="root"]/div/div/div[2]/div/div/div/form/div/button'
|
|
121
121
|
);
|
|
122
122
|
console.log("Clicando no botão");
|
|
123
123
|
buttonElement.click();
|