1 |
|
2 | const chalk = require('chalk');
|
3 | const figlet = require('figlet');
|
4 |
|
5 | const printLogo = () => {
|
6 | console.log(
|
7 | chalk.yellow(
|
8 | figlet.textSync(`Component
|
9 | Creator`, { horizontalLayout: 'full' }),
|
10 | ),
|
11 | );
|
12 | };
|
13 |
|
14 | const printOk = () => {
|
15 | console.log(
|
16 | chalk.green(
|
17 | figlet.textSync('OK', { horizontalLayout: 'full' }),
|
18 | ),
|
19 | );
|
20 | };
|
21 |
|
22 | const printConfigSuccess = async (config) => {
|
23 | const configJson = JSON.stringify(config, null, 2);
|
24 | console.log('\n\n');
|
25 | console.log(chalk.green('Configuration file created successfully'));
|
26 | console.log(configJson);
|
27 | console.log('\n\n');
|
28 | };
|
29 |
|
30 | const printConfigError = async (error) => {
|
31 | console.log(chalk.red('An error occurred while creating the configuration file, try again or report a problem.'));
|
32 | console.log(error);
|
33 | };
|
34 |
|
35 | const printAddToGitIgnoreSuccess = () => {
|
36 | console.log(chalk.green('Configuration file was added to .gitignore'));
|
37 | };
|
38 |
|
39 | const printAddToGitIgnoreError = () => {
|
40 | console.log(chalk.red('Configuration file was not added to .gitignore, please add it yourself'));
|
41 | };
|
42 |
|
43 | const printSomeMessage = (text, color = 'red') => {
|
44 | console.log(chalk[color](text));
|
45 | };
|
46 |
|
47 | module.exports = {
|
48 | printLogo,
|
49 | printConfigSuccess,
|
50 | printConfigError,
|
51 | printAddToGitIgnoreSuccess,
|
52 | printAddToGitIgnoreError,
|
53 | printSomeMessage,
|
54 | printOk,
|
55 | };
|