-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
81 lines (76 loc) · 1.83 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
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
// TODO: Include packages needed for this application
const fs = require("fs");
const inquirer = require("inquirer");
const generateMarkdown = require("./utils/generateMarkdown");
// User input .
// make a string of the user data in markdown format.
// TODO: Create an array of questions for user input
const questions = [
{
type: "input",
name: "title",
message: "What is the name of your project?",
},
{
type: "input",
name: "description",
message: "Write a description of your project: ",
},
{
type: "input",
name: "installation",
message: "What is the command to install dependencies: ",
},
{
type: "input",
name: "usage",
message: "What can this project be used for?",
},
{
type: "list",
name: "license",
message: "Chose the appropriate license for this project: ",
choices: ["Apache", "GNU", "MIT", "Open", "None"],
},
{
type: "input",
name: "contribution",
message: "List the contributors:",
},
{
type: "input",
name: "tests",
message: "Enter the command to run tests?",
},
{
type: "input",
name: "questions",
message: "What do I do if I have an issue?",
},
{
type: "input",
name: "username",
message: "Please enter your GitHub username: ",
},
{
type: "input",
name: "email",
message: "Please enter your email: ",
},
];
// TODO: Create a function to write README file
function createMarkdownFile(fileName, data) {
fs.writeFile(fileName, data, (error) => {
if (error) throw error;
console.log("File Created");
});
}
// TODO: Create a function to initialize app
function init() {
inquirer.prompt(questions).then((response) => {
const markdownString = generateMarkdown(response);
createMarkdownFile("README.md", markdownString);
});
}
// Function call to initialize app
init();