-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
54 lines (46 loc) · 1.53 KB
/
index.js
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
const chalk = require('chalk');
const inquirer = require('inquirer');
const path = require('path');
const MENU_MSGS = require('./utils/json/menuMsgs.json');
const generateBasicReadme = require('./lib/generators/generateBasicReadme');
const generateStandardReadme = require('./lib/generators/generateStandardReadme');
const generateProfessionalReadme = require('./lib/generators/generateProfessionalReadme');
const generateLicensesJsonFile = require('./lib/generators/generateLicensesJsonFile');
const generateLicensesOption = require('./lib/generators/generateLicensesOption');
const mainMenu = async () => {
const distDir = path.join(__dirname, '../..', 'dist');
console.log(chalk.green(MENU_MSGS.welcome));
const choices = [
{ name: 'Basic Readme', value: 'basic' },
{ name: 'Custom Readme', value: 'custom' },
{ name: 'Professional Readme', value: 'professional' },
new inquirer.Separator(),
{ name: chalk.red('Exit'), value: 'exit' },
];
const { option } = await inquirer.prompt([
{
type: 'list',
name: 'option',
message: MENU_MSGS.mainMenu,
choices: choices,
},
]);
switch (option) {
case 'basic':
await generateBasicReadme();
break;
case 'custom':
await generateStandardReadme();
break;
case 'professional':
await generateProfessionalReadme();
break;
case 'exit':
console.log(MENU_MSGS.exitMessage);
process.exit(0);
default:
console.log(MENU_MSGS.invalidOption);
}
};
generateLicensesJsonFile();
mainMenu();