-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
101 lines (96 loc) · 2.23 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
const fs = require("fs");
const path = require('path');
const inquirer = require("inquirer");
const generateMarkdown = require("./utils/generateMarkdown");
// array of questions for user
const questions = [
{//username
type: "input",
name: "username",
message: "GitHub username:"
},
{//email
type: "input",
name: "email",
message: "GitHub email address:"
},
{//deployment
type: "input",
name: "deployment",
message: "Deployment:"
},
{//demo
type: "input",
name: "link",
message: "Demo:"
},
{//repo
type: "input",
name: "repository",
message: "GitHub repository:"
},
{//title
type: "input",
name: "title",
message: "Project title:"
},
{//description
type: "input",
name: "description",
message: "Brief project description:"
},
{//screenshots
type: "input",
name: "screenshot",
message: "Project images / screenshot:"
},
{//installation
type: "input",
name: "installation",
message: "Required installation/s:"
},
{//Project language
type: "input",
name: "require",
message: "Project language:",
},
{//project purpose
type: "input",
name: "usage",
message: "Project usage/purpose:"
},
{//Project license information
type: "list",
name: "license",
message: "Project license:",
choices: ['None','GNU AGPLv3', 'GNU GPLv3', 'GNU LGPLv3', 'Mozilla Public License 2.0', 'Apache License 2.0', 'MIT License', 'Boost Software License 1.0', 'The Unlicense'],
},
{//contributing
type: "input",
name: "contribute",
message: "Contributor's GitHub username/s:"
},
{//test
type: "input",
name: "tests",
message: "Project tests:"
},
{//question
type: "input",
name: "questions",
message: "Questions:"
},
];
// function to write README file
function writeToFile(fileName, data) {
return fs.writeFileSync(path.join(process.cwd(), fileName), data);
}
// function to initialize program
function init() {
inquirer.prompt(questions).then((responses) => {
console.log ("Generating Professional README.md file... ");
writeToFile("./output/README.md", generateMarkdown ({ ...responses }));
});
}
// function call to initialize program
init();