-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
146 lines (131 loc) · 3.36 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
const fs = require('fs');
const generateReadMe = require('./src/template.js')
const inquirer = require('inquirer');
const readMeContent = () => {
return inquirer.prompt([
{
type: 'input',
name: 'github',
message: 'What is your github username?',
validate: githubInput => {
if (githubInput) {
return true;
} else {
console.log('You need a github username!');
return false;
}
}
},
{
type: 'input',
name: 'email',
message: 'What is your email?',
validate: emailInput => {
if (emailInput) {
return true;
} else {
console.log('You need an email!');
return false;
}
}
},
{
type: 'input',
name: 'projectTitle',
message: 'What is the title of your project? (Required, No Spaces)',
validate: titleInput => {
if (titleInput) {
return true;
} else {
console.log('Project title needed!');
return false;
}
}
},
{
type: 'input',
name: 'description',
message: 'Enter a brief description of this app. (Required)',
validate: descriptionInput => {
if (descriptionInput) {
return true;
} else {
console.log('Enter a description!');
return false;
}
}
},
{
type: 'input',
name: 'installation',
message: 'Explain the installation instructions for this app. (Required)',
validate: installationInput => {
if (installationInput) {
return true;
} else {
console.log('Enter instructions!');
return false;
}
}
},
{
type: 'input',
name: 'usage',
message: 'Usage explanation (Required)',
validate: installationInput => {
if (installationInput) {
return true;
} else {
console.log('Enter instructions!');
return false;
}
}
},
{
type: 'input',
name: 'test',
message: 'How do you test the app?',
validate: testInput => {
if (testInput) {
return true;
} else {
console.log('Test needed!');
return false;
}
}
},
{
type: 'input',
name: 'contribution',
message: 'How should other developers contact you if they wish to contribute to this project?.',
validate: contributionInput => {
if (contributionInput) {
return true;
} else {
console.log('Enter contribution!');
return false;
}
}
},
{
type: 'list',
name: 'licenses',
message: 'What licenses did you use? (Check all that apply)',
choices: ['Apache', 'Boost Software', 'MIT', 'Mozilla Public']
},
{
type: 'input',
name: 'questions',
message: 'This will be your "Questions" part, which already includes your GitHub page and E-mail as contact, what else would you like to add to this section if a developer wishes to reach you with questions?'
},
])
}
readMeContent()
.then(answers => {
console.log(answers);
const indexContent = generateReadMe(answers);
fs.writeFile('./generated-README.md', indexContent, err => {
if (err) throw new Error(err);
console.log('Success!');
});
})