-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
179 lines (161 loc) · 5.43 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!/usr/bin/env node
"use strict";
import boxen from "boxen";
import chalk from "chalk";
import inquirer from "inquirer";
import clear from "clear";
import open from "open";
import Ora from "ora";
clear();
// User Data.
const user_data = {
"name": "Jayant Goel",
"email": "jgoel92@gmail.com",
"job_title": "Assosiate Software Developer Engineer-1",
"workplace": "Publicis Sapient",
"npx_card_handle": "jayantgoel001",
"twitter": "JayantGoel001",
"website": "https://jayantgoel001.github.io/",
"linkedin": "JayantGoel001",
"github": "JayantGoel001"
};
const {
name,
email,
twitter,
linkedin,
github,
website,
npx_card_handle,
job_title,
workplace
} = user_data;
const prompt = inquirer.createPromptModule();
const questions = [
{
type: "list",
name: "action",
message: "What you want to do?",
choices: [
// Share Your profile Card
{
name: `Share Your ${chalk.cyanBright.bold("Profile Card")} and Tell Others: `,
value: () => {
open(`https://twitter.com/intent/tweet?text=I created my Profile Card. Run npx @${npx_card_handle}/${npx_card_handle} to view. Make Your own at: https://github.com/${github}/ProfileCard Made with Love by @${npx_card_handle}` );
console.log("\nRedirecting You...\n");
},
},
// Send an email
{
name: `Say 👋, on my ${chalk.green.bold("Email")}?`,
value: () => {
open(`mailto:${email}`);
console.log("\nOpening your Email application. See you at my Inbox\n");
},
},
// Here you can add your Projects or Portfolio.
{
name: `Open ${chalk.yellow.bold("My Personal Portfolio")}?`,
value: () => {
open(website);
console.log("\nLoading my Portfolio...\n");
},
},
//// Quit
{
name: "Quit.",
value: () => {
console.log(" Have a nice Day. Although You can support the project by giving a Star ⭐.\n");
},
},
],
},
];
const data = {
name: chalk.bold.green(` ${name} / ${npx_card_handle}`),
// You can Style the Job titile if You can, As I did.
// You can also keep it simple by replacing the Line 65 by:
work: `${chalk.white(job_title)} @ ${chalk.bold.hex("#2b82b2").bold(workplace)}`,
twitter: chalk.gray("https://twitter.com/") + chalk.yellowBright(twitter),
github: chalk.gray("https://github.com/") + chalk.green(github),
linkedin: chalk.gray("https://linkedin.com/in/") + chalk.blueBright(linkedin),
Website: chalk.redBright(website),
npx: chalk.green("npx") + " " + chalk.white(npx_card_handle),
labelWork: chalk.white.bold(" Work:"),
labelTwitter: chalk.white.bold(" Twitter:"),
labelGitHub: chalk.white.bold(" GitHub:"),
labelLinkedIn: chalk.white.bold(" LinkedIn:"),
labelWebsite: chalk.white.bold(" Website:"),
labelCard: chalk.white.bold(" Card:"),
};
const me = boxen(
[
data.name,
``,
`${data.labelWork} ${data.work}`,
``,
`${data.labelTwitter} ${data.twitter}`,
`${data.labelGitHub} ${data.github}`,
`${data.labelLinkedIn} ${data.linkedin}`,
`${data.labelWebsite} ${data.Website}`,
``,
`${data.labelCard} ${data.npx}`,
``,
chalk.italic(`Hey! I'm ${name}, I am working with ${workplace} as a ${job_title}`),
chalk.italic("I love to connect with new people, Say 'Hii' via Social Media or E-mail")
].join("\n"),
{
margin: 1,
float: "center",
padding: 1,
borderStyle: "singleDouble",
borderColor: "blue",
align:"left",
backgroundColor: "#660033",
}
);
const CardPrinter = () => {
return new Promise(resolve => {
setTimeout(() => {
resolve(console.log(me));
}, 12000);
});
}
// Animation
const Loaded = () => {
const spinner = Ora(`Welcome to ${npx_card_handle}'s CLI World`).start();
setTimeout(() => {
spinner.indent = 30;
spinner.spinner = 'soccerHeader';
spinner.text = chalk.green('Support Project by giving a Star ⭐ ');
}, 2000);
setTimeout(() => {
spinner.indent = 30;
spinner.spinner = 'soccerHeader';
spinner.text = chalk.yellow('Card sent to Press...');
}, 4000);
setTimeout(() => {
spinner.indent = 30;
spinner.spinner = 'soccerHeader';
spinner.text = chalk.magentaBright('Card is Ready for Printing...');
}, 6000);
setTimeout(() => {
spinner.indent = 30;
spinner.spinner = 'soccerHeader';
spinner.text = 'Your Card is About to Ready...';
}, 8000);
setTimeout(() => {
spinner.indent = 30;
spinner.spinner = 'soccerHeader';
spinner.text = chalk.blueBright('Printing Done, Here We go:');
}, 10000);
setTimeout(() => {
spinner.succeed(chalk.greenBright(`Congratulations, Now you are in ${npx_card_handle} in CLI World.😄`));
}, 12000);
};
const Card = async() => {
Loaded();
const card = await CardPrinter();
prompt(questions).then(answer => answer.action());
}
Card();