Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add emoji to outputs #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const detectInstalled = require("detect-installed");
const fs = require("fs");
const figlet = require("figlet");
const chalk = require("chalk");
const emoji = require("node-emoji");
const path = "./.nc.config.js";

/**
Expand Down Expand Up @@ -37,9 +38,15 @@ let logofied = text => {
*/
let logger = (data, error) => {
if (error) {
console.log(chalk.red(`${JSON.stringify(data, null, 2)}`));
console.log(
emoji.get("white_check_mark"),
chalk.red(emoji.emojify(`${JSON.stringify(data, null, 2)}`))
);
} else {
console.log(chalk.green(`${JSON.stringify(data, null, 2)}`));
console.log(
emoji.get("grey_exclamation"),
chalk.green(emoji.emojify(`${JSON.stringify(data, null, 2)}`))
);
}
};

Expand Down
21 changes: 16 additions & 5 deletions lib/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require("fs");
const npm = require("npm-programmatic");
const inquirer = require("inquirer");
const emoji = require("node-emoji");
const { getRegion } = require("./regions");
const { checkPlugin, logofied } = require("./helper");

Expand Down Expand Up @@ -81,22 +82,30 @@ class Init {
.then(function(response) {
if (response.state) {
if (response.exists) {
instance._spinner.warn("Configuration file exist");
instance._spinner.warn(
emoji.emojify(":warning: Configuration file exist")
);
} else {
instance._spinner.succeed(
"Configuration file generated successfully"
emoji.emojify(
":file_folder: Configuration file generated successfully"
)
);
}
instance
.installPlugin(providers)
.then(status => {
if (!status) {
instance._spinner.fail(
`Installing package ${providers.package} failed`
emoji.emojify(
`:warning: Installing package ${providers.package} failed`
)
);
}
instance._spinner.succeed(
`Installed ${providers.package} successfully`
emoji.emojify(
`:package: Installed ${providers.package} successfully`
)
);
})
.catch(err => {
Expand All @@ -105,7 +114,9 @@ class Init {
}
})
.catch(function(err) {
instance._spinner.fail("Configuration file generation Failed");
instance._spinner.fail(
emoji.emojify(":x: Configuration file generation Failed")
);
});
}

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
},
"private": false,
"dependencies": {
"@types/node-emoji": "^1.8.1",
"chalk": "^2.4.2",
"commander": "^2.20.0",
"detect-installed": "^2.0.4",
"figlet": "^1.2.3",
"inquirer": "^6.4.1",
"node-emoji": "^1.10.0",
"nodecloud": "^1.0.0-beta.1",
"npm-programmatic": "^0.0.12",
"ora": "^3.4.0",
Expand Down