-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
84 lines (78 loc) · 1.78 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
82
83
84
// TODO: Include packages needed for this application
const inquirer = require("inquirer");
const generateMarkdown = require("./utils/generateMarkdown.js");
const fs = require("fs");
// TODO: Create an array of questions for user input
const questions = [
{
// Project Title
type: "input",
name: "title",
message: "What is the title of your project?",
},
{
// Description
type: "input",
name: "description",
message: "Describe your project.",
},
{
// Installation
type: "input",
name: "installation",
message:
"What are the steps required to install your project?",
},
{
// Usage
type: "input",
name: "usage",
message: "Provide instructions and examples for use.",
},
{
// Contributing
type: "input",
name: "contributing",
message: "How can others contribute to your project?",
},
{
// Tests
type: "input",
name: "tests",
message: "How do you run tests for your project?",
},
{
// License
type: "list",
name: "license",
choices: ["MIT", "apache", "mozilla", "no license"],
message: "Choose your license.",
},
{
// Github Username
type: "input",
name: "github",
message: "What is your Github username?",
},
{
// Email Address
type: "input",
name: "email",
message: "What is your email address?",
},
];
// TODO: Create a function to write README file
function writeToFile(fileName, data) {
fs.writeFile(fileName, data, (err) => {
if (err) console.error(err);
});
}
// TODO: Create a function to initialize app
function init() {
inquirer.prompt(questions).then((response) => {
// console.log(response);
writeToFile("./utils/README.md", generateMarkdown(response));
});
}
// Function call to initialize app
init();