-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
76 lines (72 loc) · 2.15 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
const fs = require("fs");
const inquirer = require("inquirer");
const generateMarkdown = require("./utils/generateMarkdown")
// function to write README file
function writeToFile(fileName, data) {
fs.writeFile(fileName, data, function(err) {
if (err) {
return console.log(err);
}
console.log("Writing your README...")
})
}
// array of questions for user
function init() {inquirer.prompt([
{
type: "input",
name: "title",
message: "What is the name of your project?"
},
{
type: "input",
name: "description",
message: "Please enter a description of your project"
},
{ type: "input",
name: "installInstructions",
message: "What steps should users follow to install your project?"
},
{
type: "input",
name: "usage",
message: "Please enter instructions for using your project"
},
{
type: "input",
name: "credits",
message: "Please list any individuals or third parties you would like to credit in your README"
},
{
type: "list",
name: "license",
message: "What kind of license would you like to use for your project?",
choices: ["None", "Apache", "GNU", "MIT", "BSD2", "BSD3", "Boost", "Eclipse", "GNU3", "GNU2", "GNU-2.1", "Mozilla", "Unlicense"]
},
{
type: "input",
name: "contributors",
message: "What guidelines should users follow when contributing to this repository?"
},
{
type: "input",
name: "testing",
message: "Please provide instructions or examples for users who would like to run tests on your project"
},
{
type: "input",
name: "email",
message: "What is your email address?"
},
{
type: "input",
name: "ghUserName",
message: "What is your GitHub username?"
}
]).then(function(response) {
const inqAnswers = generateMarkdown({...response});
// call writeToFile function with "README.md" and inqAnswers as arguments
writeToFile("README.md", inqAnswers);
});
};
// function call to initialize program
init();