brianmmaina 1.1.2 → 1.1.5
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 +160 -8
- package/package.json +12 -3
package/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
import
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import open from 'open';
|
|
5
|
+
import figlet from 'figlet';
|
|
4
6
|
import chalk from 'chalk';
|
|
7
|
+
import chalkAnimation from 'chalk-animation';
|
|
8
|
+
import boxen from 'boxen';
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
];
|
|
10
|
+
// Placeholder URLs - replace with actual ones
|
|
11
|
+
const resumeUrl = 'https://drive.google.com/your-resume-link';
|
|
12
|
+
const githubUrl = 'https://github.com/your-github';
|
|
10
13
|
|
|
11
|
-
const
|
|
14
|
+
const intro = chalk.bold.green('Hi, I\'m Brian Maina! I like watching movies, coding and playing video games.');
|
|
12
15
|
|
|
13
16
|
const options = {
|
|
14
17
|
padding: 1,
|
|
@@ -17,6 +20,155 @@ const options = {
|
|
|
17
20
|
borderColor: 'cyan'
|
|
18
21
|
};
|
|
19
22
|
|
|
20
|
-
const
|
|
23
|
+
const mainMenu = async () => {
|
|
24
|
+
console.clear();
|
|
25
|
+
console.log(boxen(intro, options));
|
|
26
|
+
|
|
27
|
+
const { choice } = await inquirer.prompt([
|
|
28
|
+
{
|
|
29
|
+
type: 'list',
|
|
30
|
+
name: 'choice',
|
|
31
|
+
message: 'What would you like to do?',
|
|
32
|
+
choices: [
|
|
33
|
+
'View Resume',
|
|
34
|
+
'View GitHub',
|
|
35
|
+
'Play Song with Dance',
|
|
36
|
+
'Play Ping Pong',
|
|
37
|
+
'Exit'
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
switch (choice) {
|
|
43
|
+
case 'View Resume':
|
|
44
|
+
await open(resumeUrl);
|
|
45
|
+
console.log('Opening resume...');
|
|
46
|
+
break;
|
|
47
|
+
case 'View GitHub':
|
|
48
|
+
await open(githubUrl);
|
|
49
|
+
console.log('Opening GitHub...');
|
|
50
|
+
break;
|
|
51
|
+
case 'Play Song with Dance':
|
|
52
|
+
await playSongWithDance();
|
|
53
|
+
break;
|
|
54
|
+
case 'Play Ping Pong':
|
|
55
|
+
await playPingPong();
|
|
56
|
+
break;
|
|
57
|
+
case 'Exit':
|
|
58
|
+
console.log('Goodbye!');
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// After action, go back to menu
|
|
63
|
+
setTimeout(mainMenu, 2000);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const playSongWithDance = async () => {
|
|
67
|
+
console.clear();
|
|
68
|
+
console.log('Playing your favorite song... (Imagine music playing)');
|
|
69
|
+
|
|
70
|
+
// Simple dancing ASCII art animation
|
|
71
|
+
const frames = [
|
|
72
|
+
`
|
|
73
|
+
o
|
|
74
|
+
/|\\
|
|
75
|
+
/ \\
|
|
76
|
+
`,
|
|
77
|
+
`
|
|
78
|
+
o
|
|
79
|
+
/|\\
|
|
80
|
+
/ \\
|
|
81
|
+
`,
|
|
82
|
+
`
|
|
83
|
+
o
|
|
84
|
+
/|\\
|
|
85
|
+
/ \\
|
|
86
|
+
`,
|
|
87
|
+
`
|
|
88
|
+
o
|
|
89
|
+
/|\\
|
|
90
|
+
/ \\
|
|
91
|
+
`
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
let frame = 0;
|
|
95
|
+
const interval = setInterval(() => {
|
|
96
|
+
console.clear();
|
|
97
|
+
console.log(frames[frame]);
|
|
98
|
+
frame = (frame + 1) % frames.length;
|
|
99
|
+
}, 500);
|
|
100
|
+
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
clearInterval(interval);
|
|
103
|
+
console.log('Song ended!');
|
|
104
|
+
}, 10000);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const playPingPong = async () => {
|
|
108
|
+
console.clear();
|
|
109
|
+
console.log('Ping Pong Game - Use A/D to move paddle, Q to quit');
|
|
110
|
+
|
|
111
|
+
// Simple ping pong implementation
|
|
112
|
+
let paddlePos = 10;
|
|
113
|
+
let ballX = 20;
|
|
114
|
+
let ballY = 10;
|
|
115
|
+
let ballDirX = 1;
|
|
116
|
+
let ballDirY = 1;
|
|
117
|
+
const width = 40;
|
|
118
|
+
const height = 20;
|
|
119
|
+
|
|
120
|
+
process.stdin.setRawMode(true);
|
|
121
|
+
process.stdin.resume();
|
|
122
|
+
|
|
123
|
+
const render = () => {
|
|
124
|
+
console.clear();
|
|
125
|
+
for (let y = 0; y < height; y++) {
|
|
126
|
+
let line = '';
|
|
127
|
+
for (let x = 0; x < width; x++) {
|
|
128
|
+
if (y === ballY && x === ballX) {
|
|
129
|
+
line += 'O';
|
|
130
|
+
} else if (y === height - 1 && x >= paddlePos && x < paddlePos + 5) {
|
|
131
|
+
line += '=';
|
|
132
|
+
} else {
|
|
133
|
+
line += ' ';
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
console.log(line);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const gameLoop = setInterval(() => {
|
|
141
|
+
ballX += ballDirX;
|
|
142
|
+
ballY += ballDirY;
|
|
143
|
+
|
|
144
|
+
if (ballX <= 0 || ballX >= width - 1) ballDirX *= -1;
|
|
145
|
+
if (ballY <= 0) ballDirY *= -1;
|
|
146
|
+
if (ballY >= height - 2 && ballX >= paddlePos && ballX < paddlePos + 5) {
|
|
147
|
+
ballDirY *= -1;
|
|
148
|
+
}
|
|
149
|
+
if (ballY >= height - 1) {
|
|
150
|
+
console.log('Game Over!');
|
|
151
|
+
clearInterval(gameLoop);
|
|
152
|
+
process.stdin.setRawMode(false);
|
|
153
|
+
process.stdin.pause();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
render();
|
|
158
|
+
}, 100);
|
|
159
|
+
|
|
160
|
+
process.stdin.on('data', (key) => {
|
|
161
|
+
if (key[0] === 97) { // 'a'
|
|
162
|
+
paddlePos = Math.max(0, paddlePos - 1);
|
|
163
|
+
} else if (key[0] === 100) { // 'd'
|
|
164
|
+
paddlePos = Math.min(width - 5, paddlePos + 1);
|
|
165
|
+
} else if (key[0] === 113) { // 'q'
|
|
166
|
+
clearInterval(gameLoop);
|
|
167
|
+
process.stdin.setRawMode(false);
|
|
168
|
+
process.stdin.pause();
|
|
169
|
+
console.log('Game quit!');
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
};
|
|
21
173
|
|
|
22
|
-
|
|
174
|
+
mainMenu();
|
package/package.json
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brianmmaina",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "My terminal business card",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"bin":
|
|
7
|
+
"bin": {
|
|
8
|
+
"brianmmaina": "index.js"
|
|
9
|
+
},
|
|
8
10
|
"scripts": {
|
|
9
11
|
"setup": "npm install",
|
|
10
12
|
"start": "node index.js"
|
|
11
13
|
},
|
|
12
14
|
"keywords": [],
|
|
13
15
|
"author": "",
|
|
14
|
-
"license": "ISC"
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"boxen": "^8.0.1",
|
|
19
|
+
"chalk-animation": "^2.0.3",
|
|
20
|
+
"figlet": "^1.10.0",
|
|
21
|
+
"inquirer": "^13.2.5",
|
|
22
|
+
"open": "^11.0.0"
|
|
23
|
+
}
|
|
15
24
|
}
|