-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
120 lines (109 loc) · 3.18 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
#!/usr/bin/env node
const figlet = require('figlet');
const ask = require('./lib/askGithub');
const Githubinfo = require('./lib/GithubInfo');
const mark = require('./lib/GenerateMarkdown');
const inquirer = require('inquirer');
const info = require('./lib/NoGithubInfo');
const questionsGithub = [
{
name: 'GitHub-Ask',
type: 'confirm',
message: 'Have you already a Github Repo',
}
];
const description = [
{
name: 'GitHub-description',
type: 'input',
message: 'Short Description of your Project',
validate: function( value ) {
if (value.length) {
return true;
} else {
return 'Please enter a Description';
}
}
}
];
const installation = [
{
name: 'GitHub-install',
type: 'input',
message: 'Installation Instruction for your Project',
validate: function( value ) {
if (value.length) {
return true;
} else {
return 'Please enter your Installation Instruction';
}
}
}
];
const Requirements = [
{
name: 'GitHub-Requirements',
type: 'input',
message: 'Requirements for Install your Project',
validate: function( value ) {
if (value.length) {
return true;
} else {
return 'Please enter your Requirements Instruction';
}
}
}
];
const testing = [
{
name: 'GitHub-Test',
type: 'input',
message: 'Command for test your project',
}
];
console.log(
figlet.textSync('SimplyReadMe', { horizontalLayout: 'full' })
);
const run = async () => {
const git = await inquirer.prompt(questionsGithub)
if (git["GitHub-Ask"] == true){
const credentials = await ask.ask();
const repo = await Githubinfo.gethub(credentials["GitHub-Url"]);
if (repo == "error")
{
console.log("Repository not found please check Username/RepoName");
return
}
if (repo.description == null){
const descriptionASK = await inquirer.prompt(description)
repo.description = descriptionASK["GitHub-description"];
}
if (repo.license == null){
console.log("License not Found. Add a Licence on Github");
}
const GR = await inquirer.prompt(Requirements)
repo.require = GR["GitHub-Requirements"];
const install = await inquirer.prompt(installation)
repo.install = install["GitHub-install"];
const test = await inquirer.prompt(testing)
repo.test = test["GitHub-Test"];
const markd = await mark.gethub(credentials["GitHub-Url"],repo);
}
else {
const getInfo = await info.ask();
const GR = await inquirer.prompt(Requirements)
const install = await inquirer.prompt(installation)
const test = await inquirer.prompt(testing)
const obj = new Object();
obj.name = getInfo["Name"];
obj.description = getInfo["Description"];
obj.username = getInfo["Username"];
obj.license = getInfo["License"];
obj.website = getInfo["Website"];
obj.test = test["GitHub-Test"];
obj.install = install["GitHub-install"];
obj.require = GR["GitHub-Requirements"];
const result = await mark.getReadMe(obj);
}
};
run();