UNPKG

1.34 kBJavaScriptView Raw
1/* eslint-disable no-console */
2const chalk = require('chalk');
3const figlet = require('figlet');
4
5const printLogo = () => {
6 console.log(
7 chalk.yellow(
8 figlet.textSync(`Component
9 Creator`, { horizontalLayout: 'full' }),
10 ),
11 );
12};
13
14const printOk = () => {
15 console.log(
16 chalk.green(
17 figlet.textSync('OK', { horizontalLayout: 'full' }),
18 ),
19 );
20};
21
22const 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
30const 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
35const printAddToGitIgnoreSuccess = () => {
36 console.log(chalk.green('Configuration file was added to .gitignore'));
37};
38
39const printAddToGitIgnoreError = () => {
40 console.log(chalk.red('Configuration file was not added to .gitignore, please add it yourself'));
41};
42
43const printSomeMessage = (text, color = 'red') => {
44 console.log(chalk[color](text));
45};
46
47module.exports = {
48 printLogo,
49 printConfigSuccess,
50 printConfigError,
51 printAddToGitIgnoreSuccess,
52 printAddToGitIgnoreError,
53 printSomeMessage,
54 printOk,
55};