-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
86 lines (82 loc) · 2.02 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
import fs from "fs";
import inquirer from 'inquirer';
import path from "path";
import { generateMarkdown } from "./utils/generateMarkdown.js";
const questions = [
{
type: "input",
name: "title",
message: "Please name your Project.",
},
{
type: "input",
name: "description",
message: "Please describe the purpose and functionality of this project.",
},
{
type: "input",
name: "screenshot",
message: "Please provide the relative path to the image you want to use as the screenshot."
},
{
type: "input",
name: "link",
message: "Please provide a URL where a user can access your deployed application."
},
{
type: "checkbox",
name: "license",
message: "Please select a license applicable to this project.",
choices: ["MIT", "APACHE2.0", "Boost1.0", "MPL2.0", "BSD2", "BSD3", "none"],
},
{
type: "input",
name: "require",
message: "List any project dependencies here.",
},
{
type: "input",
name: "features",
message: "List some cool features about this project here.",
},
{
type: "input",
name: "usage",
message:
"State the languages or technologies associated with this project.",
},
{
type: "input",
name: "creator",
message: "Write your GitHub username.",
},
{
type: "input",
name: "email",
message: "Provide a valid email address.",
},
{
type: "input",
name: "contributors",
message: "Please list any contributors.",
default: "",
},
{
type: "input",
name: "test",
message: "Provide walkthrough of required tests if applicable.",
},
];
function writeToFile(fileName, data) {
fs.writeFile(fileName, data, (err) =>
err ? console.error(err) : console.log("Success! Your README.md file has been generated.")
);
}
function init() {
inquirer.prompt(questions).then((responses) => {
console.log("Generating README.md...");
const markdown = generateMarkdown(responses);
writeToFile("dist/README.md", markdown);
});
}
init();