-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
77 lines (69 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
const inquirer = require("inquirer");
const fs = require("fs");
const generateMarkdown = require("./utils/generateMarkdown.js");
// array of questions for user
const questions = [
{
type: "input",
message: "What is your GitHub username?",
name: "username"
},
{
type: "input",
message: "What is your email address?",
name: "email"
},
{
type: "input",
message: "What is your project's title?",
name: "title"
},
{
type: "input",
message: "Please enter a brief description of your project",
name: "description"
},
{
type: "list",
message: "What license does this project use?",
default: "( Use arrow keys)",
choices: ["MIT", "APACHE 2.0", "GPL 3.0", "BSD 3", "None"],
name: "license"
},
{
type: "input",
message: "What command should be run to install dependencies?",
default: "npm i",
name: "install"
},
{
type: "input",
message: "How should the user run tests?",
default: "npm test",
name: "test"
},
{
type: "input",
message: "What does the user need to know about using the repo?",
name: "usage"
},
{
type: "input",
message: "What does the user need to know about contributing to the repo?",
name: "contribution"
}
];
// function to initialize program
function init() {
inquirer.prompt(questions).then(function (data) {
const markdown = generateMarkdown(data)
fs.writeFile("ReadMe.md", markdown, function (err) {
if (err) {
return console.log(err);
}
console.log("File written to ReadMe.md");
})
})
}
// function call to initialize program
init();