-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmenu.js
More file actions
57 lines (54 loc) · 1.25 KB
/
Copy pathmenu.js
File metadata and controls
57 lines (54 loc) · 1.25 KB
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
47
48
49
50
51
52
53
54
55
56
57
const inquirer = require("inquirer");
const chalk = require("chalk");
const figlet = require("figlet");
const init = () => {
console.log(
chalk.cyanBright(
figlet.textSync("React +", {
font: "Impossible",
horizontalLayout: "default",
verticalLayout: "default",
})
)
);
console.log(chalk.yellowBright('With contribution from: thealpha93'))
};
const askQuestions = () => {
const questions = [
{
name: "appName",
type: "input",
message: "Enter the name of the app: ",
validate: function (text) {
if (!text) {
return 'Must Provide an app name';
}
return true;
},
},
{
type: "list",
name: "boilerPlate",
message: "Choose a template",
choices: ["Default", "Redux Saga"],
filter: function (val) {
return val;
},
},
];
return inquirer.prompt(questions);
};
module.exports = async (error) => {
// show script introduction
init();
if(error){
console.log(
chalk.redBright("Missing required argument 'what'")
);
console.log("\nTo generate an app type:")
console.log(chalk.cyan("\treact-alpha generate app"))
process.exit()
}
// ask questions
return await askQuestions();
};