eitri-cli 1.1.0-beta → 1.1.0-beta.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/package.json +1 -1
- package/src/cmd/create.js +2 -1
- package/src/cmd/push-version.js +0 -1
- package/src/modules/vegvisir/cmd/current.js +5 -3
- package/src/modules/vegvisir/cmd/use.js +1 -1
- package/src/service/Workspace.js +21 -17
- package/src/service/factories/WoodCoffeeFactory.js +32 -26
- package/src/util/getWorkspace.js +4 -2
- package/test/_fixtures/woodcoffee/miniapp.conf.js +3 -1
package/package.json
CHANGED
package/src/cmd/create.js
CHANGED
|
@@ -93,7 +93,8 @@ async function askClientApplication() {
|
|
|
93
93
|
{ name: ITEM_DOUBT, label: "Dúvidas? Veja documentação no browser" },
|
|
94
94
|
];
|
|
95
95
|
const createLabel = (tgt) => {
|
|
96
|
-
|
|
96
|
+
const orgLabel = tgt.organization?.name ? `(${tgt.organization?.name})`: ''
|
|
97
|
+
return `${tgt.label || tgt.name} ${orgLabel}`;
|
|
97
98
|
};
|
|
98
99
|
|
|
99
100
|
const res = await inquirer.prompt([
|
package/src/cmd/push-version.js
CHANGED
|
@@ -78,7 +78,6 @@ ${await targetService.getAppConfExampleSnippet()}
|
|
|
78
78
|
await miniLog.connect(userWorkspace.id)
|
|
79
79
|
console.log(separator)
|
|
80
80
|
console.log('Analisando versões')
|
|
81
|
-
await workspace.checkVersions()
|
|
82
81
|
|
|
83
82
|
// Verificar se precisamos dessa parte
|
|
84
83
|
const {target} = await workspace.checkVersions()
|
|
@@ -8,13 +8,15 @@ module.exports = async function current(cmdObj) {
|
|
|
8
8
|
console.log("====================================================")
|
|
9
9
|
} catch (error) {
|
|
10
10
|
if (error.code === "ENOENT") {
|
|
11
|
-
|
|
11
|
+
console.error(
|
|
12
12
|
"Você não tem nenhum workspace definido para desenvolvimento, execute o comando 'eitri workspace use' para definir um workspace."
|
|
13
13
|
);
|
|
14
|
+
return process.exit(1)
|
|
14
15
|
}
|
|
15
|
-
console.
|
|
16
|
-
throw new Error(
|
|
16
|
+
console.error(
|
|
17
17
|
"Houve um erro inesperado ao tentar ler o workspace atual."
|
|
18
18
|
);
|
|
19
|
+
|
|
20
|
+
return process.exit(1)
|
|
19
21
|
}
|
|
20
22
|
};
|
|
@@ -48,7 +48,7 @@ async function writeGlobalWorkspaceConfig(selectedWorkspace) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
async function writeLocalWorkspaceConfig(selectedWorkspace) {
|
|
51
|
-
const miniAppConfPath = path.resolve(process.cwd(), "
|
|
51
|
+
const miniAppConfPath = path.resolve(process.cwd(), "eitri-app.conf.js");
|
|
52
52
|
if (!existsSync(miniAppConfPath)) {
|
|
53
53
|
console.error(
|
|
54
54
|
"Você só pode selecionar um workspace como local dentro de um eitri-app"
|
package/src/service/Workspace.js
CHANGED
|
@@ -143,18 +143,26 @@ class Workspace {
|
|
|
143
143
|
|
|
144
144
|
getMiniConf() {
|
|
145
145
|
if (!this._miniConf) {
|
|
146
|
-
const
|
|
146
|
+
const eitriAppConfPath = path.resolve(
|
|
147
147
|
this.folder2watch,
|
|
148
|
-
"../
|
|
148
|
+
"../eitri-app.conf.js"
|
|
149
149
|
);
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
if (fs.existsSync(eitriAppConfPath)) {
|
|
151
|
+
this._miniConf = require(eitriAppConfPath);
|
|
152
|
+
} else {
|
|
153
|
+
const miniAppConfPath = path.resolve(
|
|
154
|
+
this.folder2watch,
|
|
155
|
+
"../miniapp.conf.js"
|
|
153
156
|
);
|
|
157
|
+
if (!fs.existsSync(miniAppConfPath)) {
|
|
158
|
+
throw new Error(
|
|
159
|
+
"Por favor, verifique se você está dentro da pasta de um projeto eitri-app."
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
this._miniConf = require(miniAppConfPath);
|
|
154
163
|
}
|
|
155
|
-
this._miniConf = require(miniAppConfPath);
|
|
156
164
|
if (!this._miniConf.version) {
|
|
157
|
-
throw Error("Arquivo
|
|
165
|
+
throw Error("Arquivo eitri-app.conf.js sem version");
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
168
|
return this._miniConf;
|
|
@@ -266,8 +274,7 @@ class Workspace {
|
|
|
266
274
|
);
|
|
267
275
|
console.log("Ambiente pronto para compilação");
|
|
268
276
|
console.log(
|
|
269
|
-
`${libs.components} [${miniConf[libs.components]}]\n${
|
|
270
|
-
libs.superApp
|
|
277
|
+
`${libs.components} [${miniConf[libs.components]}]\n${libs.superApp
|
|
271
278
|
} [${miniConf[libs.superApp]}]`
|
|
272
279
|
);
|
|
273
280
|
return { target: response.target };
|
|
@@ -340,9 +347,8 @@ class Workspace {
|
|
|
340
347
|
|
|
341
348
|
let miniAppUrl = `${this.getBootstrapURL(
|
|
342
349
|
targetConfig.bootstrapBaseUrl
|
|
343
|
-
)}/${
|
|
344
|
-
|
|
345
|
-
}/user/${(await getWorkspace()).id}/${viewHtml}?data=${encodedData}${paramOrderId}${paramShareId}&devmode=true`;
|
|
350
|
+
)}/${this.config.basePath || "workspace"
|
|
351
|
+
}/user/${(await getWorkspace()).id}/${viewHtml}?data=${encodedData}${paramOrderId}${paramShareId}&devmode=true`;
|
|
346
352
|
|
|
347
353
|
if (cid) {
|
|
348
354
|
miniAppUrl = miniAppUrl + "&cid=" + cid;
|
|
@@ -371,10 +377,9 @@ class Workspace {
|
|
|
371
377
|
const qrCodeConfig = await this.getQrCodeConfig(args, targetConfig);
|
|
372
378
|
const stateData = await this.saveShareState(qrCodeConfig);
|
|
373
379
|
const stateId = stateData.id;
|
|
374
|
-
const miniAppUrl = `${this.qrCodeUrl}/${stateId}?environment=${
|
|
375
|
-
(process.env.NODE_ENV === "hmlv2" ? "hml" : process.env.NODE_ENV) ||
|
|
380
|
+
const miniAppUrl = `${this.qrCodeUrl}/${stateId}?environment=${(process.env.NODE_ENV === "hmlv2" ? "hml" : process.env.NODE_ENV) ||
|
|
376
381
|
"hml"
|
|
377
|
-
|
|
382
|
+
}`;
|
|
378
383
|
return {
|
|
379
384
|
miniAppConf: {
|
|
380
385
|
...qrCodeConfig,
|
|
@@ -1191,8 +1196,7 @@ class Workspace {
|
|
|
1191
1196
|
`File preview: ${code.substring(
|
|
1192
1197
|
0,
|
|
1193
1198
|
previewLength
|
|
1194
|
-
)}, Before compression: ${codeLength}, After compression: ${
|
|
1195
|
-
compressedCode.length
|
|
1199
|
+
)}, Before compression: ${codeLength}, After compression: ${compressedCode.length
|
|
1196
1200
|
}`
|
|
1197
1201
|
);
|
|
1198
1202
|
}
|
|
@@ -4,8 +4,8 @@ const AdmZip = require("adm-zip");
|
|
|
4
4
|
const tmp = require("tmp");
|
|
5
5
|
const util = require("util");
|
|
6
6
|
const exec = util.promisify(require("child_process").exec);
|
|
7
|
-
const rm =
|
|
8
|
-
const
|
|
7
|
+
const { writeFile, rm } = require("fs/promises");
|
|
8
|
+
const axios = require("axios");
|
|
9
9
|
|
|
10
10
|
class WoodCoffee {
|
|
11
11
|
static COMPONENTS_LIBRARY_VERSION_HIGHLIGHTER =
|
|
@@ -233,35 +233,41 @@ class WoodCoffee {
|
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
writeEitriAppConf(project, conf) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
);
|
|
254
|
-
});
|
|
236
|
+
async writeEitriAppConf(project, conf) {
|
|
237
|
+
const versions = await this._getLatestLibVersions();
|
|
238
|
+
conf["version"] = "0.1.0";
|
|
239
|
+
conf["eitri-app-components"] = versions.componentsVersion;
|
|
240
|
+
conf["eitri-app-client"] = versions.appClientVersion;
|
|
241
|
+
|
|
242
|
+
let confString = `module.exports = ${JSON.stringify(conf, null, 4)}`;
|
|
243
|
+
await writeFile(
|
|
244
|
+
path.join(project.projectPath, "eitri-app.conf.js"),
|
|
245
|
+
confString,
|
|
246
|
+
"utf8"
|
|
247
|
+
);
|
|
248
|
+
const oldColfPath = path.join(project.projectPath, "miniapp.conf.js");
|
|
249
|
+
if(fs.existsSync(oldColfPath)) {
|
|
250
|
+
await rm(oldColfPath, {force: true})
|
|
251
|
+
}
|
|
255
252
|
}
|
|
256
253
|
|
|
257
|
-
|
|
254
|
+
async _getLatestLibVersions() {
|
|
258
255
|
try {
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
256
|
+
const { data: eitriAppComponents } = await axios.get(
|
|
257
|
+
"https://cdn.83io.com.br/library/luminus-ui/versions/index.json"
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
const { data: eitriAppClient } = await axios.get(
|
|
261
|
+
"https://cdn.83io.com.br/library/eitri-app-client/versions/index.json"
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
return {
|
|
265
|
+
componentsVersion: eitriAppComponents.versions[0],
|
|
266
|
+
appClientVersion: eitriAppClient.versions[0],
|
|
267
|
+
};
|
|
262
268
|
} catch (error) {
|
|
263
269
|
console.error(
|
|
264
|
-
`Não foi possível recuperar a última versão
|
|
270
|
+
`Não foi possível recuperar a última versão das bibliotecas.`
|
|
265
271
|
);
|
|
266
272
|
throw error;
|
|
267
273
|
}
|
package/src/util/getWorkspace.js
CHANGED
|
@@ -29,8 +29,10 @@ module.exports = async function getWorkspace() {
|
|
|
29
29
|
return workspace;
|
|
30
30
|
} catch (error) {
|
|
31
31
|
if(error.code === "ENOENT") {
|
|
32
|
-
|
|
32
|
+
console.error("Você não tem nenhum workspace definido para desenvolvimento, execute o comando 'eitri workspace use' para definir um workspace.")
|
|
33
|
+
return process.exit(1)
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
console.error("Houve um erro inesperado ao tentar ler o workspace atual.")
|
|
36
|
+
return process.exit(1)
|
|
35
37
|
}
|
|
36
38
|
};
|