-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
128 lines (120 loc) · 4.86 KB
/
Copy pathindex.js
File metadata and controls
128 lines (120 loc) · 4.86 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
const inquirer = require('inquirer');
const fs = require('fs');
const util = require('util');
const generateMarkdown = require('./Assets/generateMarkdown.js');
// create writeFile function using promises instead of a callback function
const writeFileAsync = util.promisify(fs.writeFile);
const promptUser = () => {
return inquirer.prompt([
{
type:'input',
message: "What is the title of your project?",
name: "title",
when: (answer) => answer.content.includes(title)
},
{
type: "input",
message: "What is the description of your project?",
name: "description",
when: (answer) => answer.content.includes(description)
},
{
type: "input",
message: "How do you install your project?",
name: "installation",
when: (answer) => answer.content.includes(installation)
},
{
type: "input",
message: "What are the Usage?",
name: "usage",
when: (answer) => answer.content.includes(usage)
},
{
type: "input",
message: "Contributing?",
name: "contributing",
when: (answer) => answer.content.includes(contributing)
},
{
type: "input",
message: "How do you test this Application?",
name: "tests",
when: (answer) => answer.content.includes(tests)
},
{
type: "list",
message: "Please select a type of license.",
name: "license",
choices: [
"MIT",
"Apache",
"ISC",
"GNU GPLv3"
],
when: (answer) => answer.content.includes(license)
},
{
type: "input",
message: "What is your GitHub username?",
name: "username",
when: (answer) => answer.content.includes(username)
},
{
type: "input",
message: "What is your email address?",
name: "questions",
when: (answer) => answer.content.includes(questions)
},
]);
};
// const generateMarkdown = (answers) =>
// when: (answers) => ${answers.description}
// `<!DOCTYPE html>
// <html lang="en">
// <head>
// <meta charset="UTF-8">
// <meta http-equiv="X-UA-Compatible" content="ie=edge">
// <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
// <link rel="stylesheet" type"text/css" href="/Assets/style.css">
// <title>Document</title>
// </head>
// <body>
// <h1 class="display-4">Title: ${answers.title}</h1>
// <br>
// <div id="toc_container">
// <p class="toc_title">Contents</p>
// <ul class="toc_list">
// <li><a href="#projectDescription"> Project Description</a>
// <li><a href="#installation"> Installation</a>
// <li><a href="#usage"> Usage</a>
// <li><a href="#contributing"> Contributing</a>
// <li><a href="#tests"> Tests</a>
// <li><a href="#license"> License</a>
// <li><a href="#githubUsername"> Github Username</a>
// <li><a href="#questions"> Questions</a>
// </ul>
// </div>
// <div class="jumbotron jumbotron-fluid">
// <div class="container">
// <ul>
// <li><p id="projectDescription"> <strong>Project Description:</strong><br>${answers.description}.</p>
// <li><p id="installation"> <strong>Installation:</strong> <br>${answers.installation}.</p>
// <li><p id="usage"> <strong>Usage:</strong> <br>${answers.usage}.</p>
// <li><p id="contributing"> <strong>Contributing:</strong> <br>${answers.contributing}.</p>
// <li><p id="tests"> <strong>Tests:</strong> <br>${answers.tests}.</p>
// <li><p id="license"> <strong>License:</strong> <br> ${answers.license}.</p>
// <li><p id="githubUsername"> <strong>Github Username:</strong> <br>${answers.username}.</p>
// <li><p id="questions"> <strong>Questions: If you face any issues when using this app please contact me by emailing your issues to:</strong>${answers.questions}.<br> How to install NPM?<br>How to Install "Inqurier: Package </p>
// </ul>
// </div>
// </div>
// </body>
// </html>`;
const init = () => {
promptUser()
.then((answers) => writeFileAsync('README.md', generateMarkdown(answers)))
.then(() => console.log('ReadMe file successfully generated'))
.catch((err) => console.error(err));
};
init();