eitri-cli 1.4.0-beta.1 → 1.4.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
CHANGED
|
@@ -18,6 +18,10 @@ module.exports = function VegvisirCommand() {
|
|
|
18
18
|
"--local",
|
|
19
19
|
"Seleciona um workspace para um diretório de Eitri-App específico"
|
|
20
20
|
)
|
|
21
|
+
.option(
|
|
22
|
+
"--name <workspace-name>",
|
|
23
|
+
"Permite selecionar um workspace previamente criado pelo nome"
|
|
24
|
+
)
|
|
21
25
|
.action(async (cmdObj) => {
|
|
22
26
|
require("./cmd/use.js")(cmdObj);
|
|
23
27
|
});
|
|
@@ -11,18 +11,28 @@ module.exports = async function use(cmdArgs) {
|
|
|
11
11
|
const workspaces = await vegvisirService.listMyWorkspaces();
|
|
12
12
|
if (!workspaces) return;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
let workspaceNameSelected = cmdArgs?.name
|
|
15
|
+
|
|
16
|
+
if(!cmdArgs?.name){
|
|
17
|
+
const { workspaceName } = await inquirer.prompt([
|
|
18
|
+
{
|
|
19
|
+
name: "workspaceName",
|
|
20
|
+
type: "rawlist",
|
|
21
|
+
message: "Selecione qual workspace você deseja utilizar:",
|
|
22
|
+
choices: workspaces,
|
|
23
|
+
},
|
|
24
|
+
]);
|
|
25
|
+
workspaceNameSelected = workspaceName
|
|
26
|
+
}
|
|
22
27
|
|
|
23
28
|
const selectedWorkspace = workspaces.find(
|
|
24
|
-
(work) => work
|
|
29
|
+
(work) => work?.name === workspaceNameSelected
|
|
25
30
|
);
|
|
31
|
+
if(!selectedWorkspace){
|
|
32
|
+
const workspacesNames = Array.isArray(workspaces) && workspaces?.length > 0 ? workspaces?.map(w => w.name) : [];
|
|
33
|
+
console.warn(`O workspace [${cmdArgs?.name}] não existe. Workspaces existentes: `, JSON.stringify(workspacesNames));
|
|
34
|
+
return;
|
|
35
|
+
};
|
|
26
36
|
|
|
27
37
|
if (cmdArgs.local) {
|
|
28
38
|
await writeLocalWorkspaceConfig(selectedWorkspace);
|
package/test/e2e/cli.test.js
CHANGED
|
@@ -190,6 +190,27 @@ describe("eitri-cli", () => {
|
|
|
190
190
|
2 * minutes
|
|
191
191
|
);
|
|
192
192
|
|
|
193
|
+
it(
|
|
194
|
+
"should select workspace by name",
|
|
195
|
+
async () => {
|
|
196
|
+
try {
|
|
197
|
+
await execAsync(
|
|
198
|
+
`cd ${EITRI_WORK_DIR} && rm -rf ./eitri-test-*`,
|
|
199
|
+
{ env: process.env }
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
const executor = new Executor({ env: devEnv });
|
|
203
|
+
await executor
|
|
204
|
+
.exec("eitri workspace use --name DEFAULT")
|
|
205
|
+
.waitFor(/Workspace configurado com sucesso!/);
|
|
206
|
+
} catch (e) {
|
|
207
|
+
console.error(e);
|
|
208
|
+
throw e;
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
2 * minutes
|
|
212
|
+
);
|
|
213
|
+
|
|
193
214
|
const getPublishedVersion = async (version, eitriAppId) => {
|
|
194
215
|
const blindGuardian = new BlindGuardian();
|
|
195
216
|
const http = new Http(blindGuardian);
|