-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.mjs
46 lines (43 loc) · 1 KB
/
index.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import inquirer from "inquirer";
import { AppConfig } from "./lib/config.mjs";
import DeployScript from "./lib/script.mjs";
console.log("\n");
console.log("AppConfig: ");
console.log(AppConfig);
console.log("\n");
let app = null;
inquirer
.prompt([
{
type: "list",
name: "app",
message: "Choose App to deploy:",
choices: AppConfig.map((app) => app.name),
},
{
type: "list",
name: "env",
message: "deploy To",
choices: ["Main", "Test"],
},
])
.then((answers) => {
app = AppConfig.filter((app) => app.name === answers.app)[0];
app.env = answers.env;
return inquirer.prompt([
{
type: "confirm",
name: "deployConfirm",
message: `Deploy ${app.name} to env ${answers.env} at port ${app.port} for sure?`,
},
]);
})
.then((confirm) => {
if (confirm.deployConfirm) {
DeployScript({
...app,
name: app.name.toLowerCase(),
env: app.env.toLowerCase(),
});
}
});