nazmul 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/index.js +32 -49
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -2,15 +2,11 @@
2
2
 
3
3
  import chalk from "chalk";
4
4
  import boxen from "boxen";
5
- import inquirer from "inquirer";
5
+ import { select } from "@inquirer/prompts"; // ✅ new API
6
6
  import ora from "ora";
7
7
  import open from "open";
8
8
 
9
- // create prompt (fix for inquirer v9+)
10
- const prompt = inquirer.createPromptModule();
11
-
12
9
  const run = async () => {
13
- // spinner
14
10
  const spinner = ora("Loading Nazmul CLI...").start();
15
11
 
16
12
  const data = {
@@ -21,14 +17,10 @@ const run = async () => {
21
17
  web: chalk.cyan("https://nazmul-portfolio-next-beryl.vercel.app/"),
22
18
  };
23
19
 
24
- // delay for UX
25
20
  await new Promise((res) => setTimeout(res, 1200));
26
-
27
- // stop spinner properly
28
21
  spinner.stop();
29
- console.clear(); // 🔥 important fix
22
+ console.clear();
30
23
 
31
- // box output
32
24
  const output = `
33
25
  ${data.name}
34
26
 
@@ -39,52 +31,43 @@ ${chalk.bold("LinkedIn:")} ${data.linkedin}
39
31
  ${chalk.bold("Portfolio:")} ${data.web}
40
32
  `;
41
33
 
42
- const box = boxen(output, {
43
- padding: 1,
44
- margin: 1,
45
- borderStyle: "round",
46
- borderColor: "green",
47
- });
48
-
49
- console.log(box);
34
+ console.log(
35
+ boxen(output, {
36
+ padding: 1,
37
+ margin: 1,
38
+ borderStyle: "round",
39
+ borderColor: "green",
40
+ }),
41
+ );
50
42
 
51
- // interactive loop
52
43
  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
- ]);
61
-
62
- if (action === "❌ Exit") {
44
+ const action = await select({
45
+ // ✅ select() instead of prompt([{type:"list"}])
46
+ message: "What do you want to do?",
47
+ choices: [
48
+ { name: "🚀 Open GitHub", value: "github" },
49
+ { name: "🌐 Open Portfolio", value: "portfolio" },
50
+ { name: "💼 Open LinkedIn", value: "linkedin" },
51
+ { name: "📧 Send Email", value: "email" },
52
+ { name: "❌ Exit", value: "exit" },
53
+ ],
54
+ });
55
+
56
+ const actions = {
57
+ github: () => open("https://github.com/NazmulHasan18"),
58
+ portfolio: () => open("https://nazmul-portfolio-next-beryl.vercel.app/"),
59
+ linkedin: () => open("https://www.linkedin.com/in/nazmul-hasan-shanto-a67041182/"),
60
+ email: () => open("mailto:nazmulhasanshanto13@email.com"),
61
+ };
62
+
63
+ if (action === "exit") {
63
64
  console.log(chalk.yellow("Goodbye 👋"));
64
65
  process.exit(0);
65
66
  }
66
67
 
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
- }
68
+ console.log(chalk.green("Opening..."));
69
+ await actions[action]?.();
86
70
  }
87
71
  };
88
72
 
89
- // run app
90
73
  run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nazmul",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Nazmul CLI Business Card",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -14,6 +14,7 @@
14
14
  "author": "",
15
15
  "license": "ISC",
16
16
  "dependencies": {
17
+ "@inquirer/prompts": "^8.4.1",
17
18
  "boxen": "^8.0.1",
18
19
  "chalk": "^5.6.2",
19
20
  "inquirer": "^13.4.1",