-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.js
executable file
·41 lines (33 loc) · 951 Bytes
/
generate.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
#!/usr/bin/env node
const fs = require('fs');
const { prompt } = require('inquirer');
const ora = require('ora');
const chalk = require("chalk");
const figlet = require("figlet");
const { questions } = require('./src/questions');
const { generateReadMe } = require('./src/generateReadme');
const init = () => {
console.log(
chalk.green(
figlet.textSync("ezreadme", {
horizontalLayout: "default",
verticalLayout: "default"
})
)
);
};
init();
prompt(questions).then(answers => {
const spinner = ora('dots');
spinner.color = 'yellow';
spinner.text = 'Generating Readme';
spinner.start();
const readme = generateReadMe(answers);
fs.writeFile("./README.md", readme, function(err) {
if(err) {
spinner.fail('Please try again');
return console.log(err);
}
spinner.succeed('Generated readme successfully');
});
});