nazmul 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +67 -51
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import boxen from "boxen";
|
|
@@ -6,23 +6,30 @@ import inquirer from "inquirer";
|
|
|
6
6
|
import ora from "ora";
|
|
7
7
|
import open from "open";
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
const
|
|
9
|
+
// create prompt (fix for inquirer v9+)
|
|
10
|
+
const prompt = inquirer.createPromptModule();
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const run = async () => {
|
|
13
|
+
// spinner
|
|
14
|
+
const spinner = ora("Loading Nazmul CLI...").start();
|
|
15
|
+
|
|
16
|
+
const data = {
|
|
17
|
+
name: chalk.bold.greenBright("Nazmul Hasan Shanto"),
|
|
18
|
+
work: chalk.white("['Fullstack Developer', 'Backend Developer', 'Next.js Developer']"),
|
|
19
|
+
github: chalk.cyan("https://github.com/NazmulHasan18"),
|
|
20
|
+
linkedin: chalk.cyan("https://www.linkedin.com/in/nazmul-hasan-shanto-a67041182/"),
|
|
21
|
+
web: chalk.cyan("https://nazmul-portfolio-next-beryl.vercel.app/"),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// delay for UX
|
|
25
|
+
await new Promise((res) => setTimeout(res, 1200));
|
|
19
26
|
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
// stop spinner properly
|
|
28
|
+
spinner.stop();
|
|
29
|
+
console.clear(); // 🔥 important fix
|
|
23
30
|
|
|
24
|
-
// box output
|
|
25
|
-
const output = `
|
|
31
|
+
// box output
|
|
32
|
+
const output = `
|
|
26
33
|
${data.name}
|
|
27
34
|
|
|
28
35
|
${chalk.bold("Work:")} ${data.work}
|
|
@@ -32,43 +39,52 @@ ${chalk.bold("LinkedIn:")} ${data.linkedin}
|
|
|
32
39
|
${chalk.bold("Portfolio:")} ${data.web}
|
|
33
40
|
`;
|
|
34
41
|
|
|
35
|
-
const box = boxen(output, {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
console.log(box);
|
|
43
|
-
|
|
44
|
-
// 🔁 interactive loop
|
|
45
|
-
while (true) {
|
|
46
|
-
const { action } = await inquirer.prompt([
|
|
47
|
-
{
|
|
48
|
-
type: "list",
|
|
49
|
-
name: "action",
|
|
50
|
-
message: "What do you want to do?",
|
|
51
|
-
choices: ["🚀 Open GitHub", "🌐 Open Portfolio", "📧 Send Email", "❌ Exit"],
|
|
52
|
-
},
|
|
53
|
-
]);
|
|
54
|
-
|
|
55
|
-
if (action === "❌ Exit") {
|
|
56
|
-
console.log(chalk.yellow("Goodbye 👋"));
|
|
57
|
-
process.exit(0);
|
|
58
|
-
}
|
|
42
|
+
const box = boxen(output, {
|
|
43
|
+
padding: 1,
|
|
44
|
+
margin: 1,
|
|
45
|
+
borderStyle: "round",
|
|
46
|
+
borderColor: "green",
|
|
47
|
+
});
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
console.log(chalk.green("Opening GitHub..."));
|
|
62
|
-
await open("https://github.com/NazmulHasan18");
|
|
63
|
-
}
|
|
49
|
+
console.log(box);
|
|
64
50
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
await
|
|
68
|
-
|
|
51
|
+
// interactive loop
|
|
52
|
+
while (true) {
|
|
53
|
+
const { action } = await prompt([
|
|
54
|
+
{
|
|
55
|
+
type: "list",
|
|
56
|
+
name: "action",
|
|
57
|
+
message: "What do you want to do?",
|
|
58
|
+
choices: ["🚀 Open GitHub", "🌐 Open Portfolio", "💼 Open LinkedIn", "📧 Send Email", "❌ Exit"],
|
|
59
|
+
},
|
|
60
|
+
]);
|
|
69
61
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
if (action === "❌ Exit") {
|
|
63
|
+
console.log(chalk.yellow("Goodbye 👋"));
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (action === "🚀 Open GitHub") {
|
|
68
|
+
console.log(chalk.green("Opening GitHub..."));
|
|
69
|
+
await open("https://github.com/NazmulHasan18");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (action === "🌐 Open Portfolio") {
|
|
73
|
+
console.log(chalk.green("Opening Portfolio..."));
|
|
74
|
+
await open("https://nazmul-portfolio-next-beryl.vercel.app/");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (action === "💼 Open LinkedIn") {
|
|
78
|
+
console.log(chalk.green("Opening LinkedIn..."));
|
|
79
|
+
await open("https://www.linkedin.com/in/nazmul-hasan-shanto-a67041182/");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (action === "📧 Send Email") {
|
|
83
|
+
console.log(chalk.blue("Opening Email..."));
|
|
84
|
+
await open("mailto:nazmulhasanshanto13@email.com");
|
|
85
|
+
}
|
|
73
86
|
}
|
|
74
|
-
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// run app
|
|
90
|
+
run();
|