Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
76 lines (72 loc) · 2.4 KB
/
Copy pathindex.js
File metadata and controls
76 lines (72 loc) · 2.4 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Packages and files required for this project
const inquirer = require("inquirer");
const fs = require("fs");
const util = require('util');
const generateMD = require('./scripts/generateMarkdown.js');
// Creates file Asynchronously (we used this structure in class)
const writeFileAsync = util.promisify(fs.writeFile);
// Questions awaiting user input
const questions = () => {
return inquirer.prompt([
{
type: 'input',
name: 'welcome',
message: 'Welcome to my automated README.md Generator. \n I\'m going to ask you some questions that will help me complete your customized README.md. \n Let\'s get started! Press ENTER to continue.',
},
{
type: 'input',
name: 'title',
message: 'What is the title of your project, exactly as it appears on GitHub?',
},
{
type: 'input',
name: 'description',
message: 'Input your project description.',
},
{
type: 'input',
name: 'installation',
message: 'Input your project installation instructions.',
},
{
type: 'input',
name: 'usage',
message: 'Input your project usage information.',
},
{
type: 'input',
name: 'contributing',
message: 'Input your project contribution guidelines.',
},
{
type: 'input',
name: 'tests',
message: 'Input your project test instructions.',
},
{
type: 'list',
name: 'license',
message: 'Which license applies to your project?',
choices: ['Apache-2.0', 'BSD-2-Clause', 'BSD-3-Clause', 'CDDL-1.0', 'EPL-2.0', 'GPL-2.0', 'LGPL-3.0', 'MIT', 'MPL-2.0', 'N/A'],
},
{
type: 'input',
name: 'github',
message: 'Enter your GitHub username.',
},
{
type: 'input',
name: 'email',
message: 'Enter your email address.',
},
]);
};
// Function to initialize app
const init = () => {
questions()
.then((answers) => writeFileAsync('./output/README.md', generateMD(answers)))
.then(() => console.log('Successfully wrote READMD.md to your output folder'))
.catch((err) => console.error(err));
};
// Function call to initialize app
init();