brianmmaina 1.1.10 → 1.1.12

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 +190 -177
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -56,31 +56,36 @@ const questions = [
56
56
  name: "action",
57
57
  message: "What would you like to explore?",
58
58
  choices: [
59
- {
60
- name: `šŸ“„ View Resume`,
61
- value: async () => {
62
- const spinner = createSpinner('Opening resume...').start();
63
- await sleep(1000);
64
- await open(resumeUrl);
65
- spinner.success({ text: 'Resume opened in browser!' });
66
- }
67
- },
68
- {
69
- name: `šŸ™ View GitHub`,
70
- value: async () => {
71
- const spinner = createSpinner('Opening GitHub...').start();
72
- await sleep(1000);
73
- await open(githubUrl);
74
- spinner.success({ text: 'GitHub opened in browser!' });
75
- }
76
- },
77
- {
78
- name: `šŸŽµ Play Song with Dance`,
79
- value: async () => {
80
- console.log(gradient.fruit('šŸŽµ Now playing: "Your Favorite Song" šŸŽµ\n'));
81
-
82
- const frames = [
83
- `
59
+ { name: `šŸ“„ View Resume`, value: 'resume' },
60
+ { name: `šŸ™ View GitHub`, value: 'github' },
61
+ { name: `šŸŽµ Play Song with Dance`, value: 'song' },
62
+ { name: `šŸ“ Play Ping Pong`, value: 'pingpong' },
63
+ { name: `šŸ’¼ View Skills & Portfolio`, value: 'portfolio' },
64
+ { name: `šŸ“ž Contact Info`, value: 'contact' },
65
+ { name: `🚪 Exit`, value: 'exit' }
66
+ ]
67
+ }
68
+ ];
69
+
70
+ const handleResume = async () => {
71
+ const spinner = createSpinner('Opening resume...').start();
72
+ await sleep(1000);
73
+ await open(resumeUrl);
74
+ spinner.success({ text: 'Resume opened in browser!' });
75
+ };
76
+
77
+ const handleGitHub = async () => {
78
+ const spinner = createSpinner('Opening GitHub...').start();
79
+ await sleep(1000);
80
+ await open(githubUrl);
81
+ spinner.success({ text: 'GitHub opened in browser!' });
82
+ };
83
+
84
+ const handleSong = async () => {
85
+ console.log(gradient.fruit('šŸŽµ Now playing: "Your Favorite Song" šŸŽµ\n'));
86
+
87
+ const frames = [
88
+ `
84
89
  šŸŽø
85
90
  /|\\
86
91
  / | \\
@@ -90,7 +95,7 @@ const questions = [
90
95
  / | \\
91
96
  / | \\
92
97
  `,
93
- `
98
+ `
94
99
  šŸŽø
95
100
  /|\\
96
101
  / | \\
@@ -103,7 +108,7 @@ const questions = [
103
108
  / \\
104
109
  / \\
105
110
  `,
106
- `
111
+ `
107
112
  šŸŽø
108
113
  /|\\
109
114
  / | \\
@@ -118,7 +123,7 @@ const questions = [
118
123
  \\ /
119
124
  \\___/
120
125
  `,
121
- `
126
+ `
122
127
  šŸŽø
123
128
  /|\\
124
129
  / | \\
@@ -135,156 +140,139 @@ const questions = [
135
140
  | |
136
141
  | |
137
142
  `
138
- ];
139
-
140
- let frame = 0;
141
- const lyrics = [
142
- "♪ La la la la ♪",
143
- "♪ Your favorite tune ♪",
144
- "♪ Dancing in the terminal ♪",
145
- "♪ So much fun! ♪"
146
- ];
147
-
148
- const interval = setInterval(() => {
149
- console.clear();
150
- console.log(gradient.fruit(frames[frame]));
151
- console.log(gradient.pastel(lyrics[frame % lyrics.length]));
152
- frame = (frame + 1) % frames.length;
153
- }, 800);
154
-
155
- await sleep(10000);
156
- clearInterval(interval);
157
- console.log(gradient.cristal('\nšŸŽ‰ Song ended! Hope you enjoyed the dance! šŸŽ‰'));
158
- }
159
- },
160
- {
161
- name: `šŸ“ Play Ping Pong`,
162
- value: async () => {
163
- console.log(gradient.fruit('šŸ“ Ping Pong Championship! šŸ“\n'));
164
- console.log('Controls: A/D to move paddle, Q to quit\n');
165
-
166
- let paddlePos = 15;
167
- let ballX = 20;
168
- let ballY = 10;
169
- let ballDirX = 1;
170
- let ballDirY = 1;
171
- const width = 40;
172
- const height = 20;
173
- let score = 0;
174
-
175
- process.stdin.setRawMode(true);
176
- process.stdin.resume();
177
-
178
- const render = () => {
179
- console.clear();
180
- console.log(gradient.fruit(`Score: ${score}`));
181
- for (let y = 0; y < height; y++) {
182
- let line = '';
183
- for (let x = 0; x < width; x++) {
184
- if (y === ballY && x === ballX) {
185
- line += gradient.fruit('ā—');
186
- } else if (y === height - 1 && x >= paddlePos && x < paddlePos + 8) {
187
- line += gradient.cristal('ā–ˆ');
188
- } else if (y === 0 || y === height - 1 || x === 0 || x === width - 1) {
189
- line += '│';
190
- } else {
191
- line += ' ';
192
- }
193
- }
194
- console.log(line);
195
- }
196
- };
197
-
198
- const gameLoop = setInterval(() => {
199
- ballX += ballDirX;
200
- ballY += ballDirY;
201
-
202
- if (ballX <= 1 || ballX >= width - 2) ballDirX *= -1;
203
- if (ballY <= 1) ballDirY *= -1;
204
- if (ballY >= height - 2 && ballX >= paddlePos && ballX < paddlePos + 8) {
205
- ballDirY *= -1;
206
- score++;
207
- }
208
- if (ballY >= height - 1) {
209
- console.log(gradient.pastel(`\nGame Over! Final Score: ${score}`));
210
- clearInterval(gameLoop);
211
- process.stdin.setRawMode(false);
212
- process.stdin.pause();
213
- return;
214
- }
215
-
216
- render();
217
- }, 150);
218
-
219
- process.stdin.on('data', (key) => {
220
- if (key[0] === 97) { // 'a'
221
- paddlePos = Math.max(1, paddlePos - 2);
222
- } else if (key[0] === 100) { // 'd'
223
- paddlePos = Math.min(width - 9, paddlePos + 2);
224
- } else if (key[0] === 113) { // 'q'
225
- clearInterval(gameLoop);
226
- process.stdin.setRawMode(false);
227
- process.stdin.pause();
228
- console.log(gradient.pastel('\nGame quit!'));
229
- }
230
- });
231
- }
232
- },
233
- {
234
- name: `šŸ’¼ View Skills & Portfolio`,
235
- value: async () => {
236
- console.log(gradient.fruit('šŸ’¼ My Skills & Portfolio šŸ’¼\n'));
237
-
238
- const table = new Table({
239
- head: [gradient.cristal('Skill'), gradient.cristal('Level')],
240
- colWidths: [20, 20],
241
- style: { head: [], border: [] }
242
- });
243
-
244
- table.push(
245
- ['JavaScript', '⭐⭐⭐⭐⭐'],
246
- ['Node.js', '⭐⭐⭐⭐⭐'],
247
- ['React', '⭐⭐⭐⭐'],
248
- ['Python', '⭐⭐⭐⭐'],
249
- ['Terminal Magic', '⭐⭐⭐⭐⭐']
250
- );
251
-
252
- console.log(table.toString());
253
-
254
- console.log('\n' + gradient.pastel('Projects:'));
255
- console.log('• Terminal Business Card (You\'re using it!)');
256
- console.log('• Awesome CLI Tools');
257
- console.log('• Web Applications');
258
- }
259
- },
260
- {
261
- name: `šŸ“ž Contact Info`,
262
- value: async () => {
263
- console.log(gradient.fruit('šŸ“ž Contact Information šŸ“ž\n'));
264
-
265
- const contactTable = new Table({
266
- style: { head: [], border: [] }
267
- });
268
-
269
- contactTable.push(
270
- { 'Email': 'brian@example.com' },
271
- { 'LinkedIn': 'linkedin.com/in/brianmaina' },
272
- { 'Twitter': 'twitter.com/brianmaina' }
273
- );
274
-
275
- console.log(contactTable.toString());
276
- }
277
- },
278
- {
279
- name: `🚪 Exit`,
280
- value: () => {
281
- console.log(gradient.pastel("Have a nice day!\n"));
282
- process.exit();
143
+ ];
144
+
145
+ let frame = 0;
146
+ const lyrics = [
147
+ "♪ La la la la ♪",
148
+ "♪ Your favorite tune ♪",
149
+ "♪ Dancing in the terminal ♪",
150
+ "♪ So much fun! ♪"
151
+ ];
152
+
153
+ const interval = setInterval(() => {
154
+ console.clear();
155
+ console.log(gradient.fruit(frames[frame]));
156
+ console.log(gradient.pastel(lyrics[frame % lyrics.length]));
157
+ frame = (frame + 1) % frames.length;
158
+ }, 800);
159
+
160
+ await sleep(10000);
161
+ clearInterval(interval);
162
+ console.log(gradient.cristal('\nšŸŽ‰ Song ended! Hope you enjoyed the dance! šŸŽ‰'));
163
+ };
164
+
165
+ const handlePingPong = async () => {
166
+ console.log(gradient.fruit('šŸ“ Ping Pong Championship! šŸ“\n'));
167
+ console.log('Controls: A/D to move paddle, Q to quit\n');
168
+
169
+ let paddlePos = 15;
170
+ let ballX = 20;
171
+ let ballY = 10;
172
+ let ballDirX = 1;
173
+ let ballDirY = 1;
174
+ const width = 40;
175
+ const height = 20;
176
+ let score = 0;
177
+
178
+ process.stdin.setRawMode(true);
179
+ process.stdin.resume();
180
+
181
+ const render = () => {
182
+ console.clear();
183
+ console.log(gradient.fruit(`Score: ${score}`));
184
+ for (let y = 0; y < height; y++) {
185
+ let line = '';
186
+ for (let x = 0; x < width; x++) {
187
+ if (y === ballY && x === ballX) {
188
+ line += gradient.fruit('ā—');
189
+ } else if (y === height - 1 && x >= paddlePos && x < paddlePos + 8) {
190
+ line += gradient.cristal('ā–ˆ');
191
+ } else if (y === 0 || y === height - 1 || x === 0 || x === width - 1) {
192
+ line += '│';
193
+ } else {
194
+ line += ' ';
283
195
  }
284
196
  }
285
- ]
286
- }
287
- ];
197
+ console.log(line);
198
+ }
199
+ };
200
+
201
+ const gameLoop = setInterval(() => {
202
+ ballX += ballDirX;
203
+ ballY += ballDirY;
204
+
205
+ if (ballX <= 1 || ballX >= width - 2) ballDirX *= -1;
206
+ if (ballY <= 1) ballDirY *= -1;
207
+ if (ballY >= height - 2 && ballX >= paddlePos && ballX < paddlePos + 8) {
208
+ ballDirY *= -1;
209
+ score++;
210
+ }
211
+ if (ballY >= height - 1) {
212
+ console.log(gradient.pastel(`\nGame Over! Final Score: ${score}`));
213
+ clearInterval(gameLoop);
214
+ process.stdin.setRawMode(false);
215
+ process.stdin.pause();
216
+ return;
217
+ }
218
+
219
+ render();
220
+ }, 150);
221
+
222
+ process.stdin.on('data', (key) => {
223
+ if (key[0] === 97) { // 'a'
224
+ paddlePos = Math.max(1, paddlePos - 2);
225
+ } else if (key[0] === 100) { // 'd'
226
+ paddlePos = Math.min(width - 9, paddlePos + 2);
227
+ } else if (key[0] === 113) { // 'q'
228
+ clearInterval(gameLoop);
229
+ process.stdin.setRawMode(false);
230
+ process.stdin.pause();
231
+ console.log(gradient.pastel('\nGame quit!'));
232
+ }
233
+ });
234
+ };
235
+
236
+ const handlePortfolio = async () => {
237
+ console.log(gradient.fruit('šŸ’¼ My Skills & Portfolio šŸ’¼\n'));
238
+
239
+ const table = new Table({
240
+ head: [gradient.cristal('Skill'), gradient.cristal('Level')],
241
+ colWidths: [20, 20],
242
+ style: { head: [], border: [] }
243
+ });
244
+
245
+ table.push(
246
+ ['JavaScript', '⭐⭐⭐⭐⭐'],
247
+ ['Node.js', '⭐⭐⭐⭐⭐'],
248
+ ['React', '⭐⭐⭐⭐'],
249
+ ['Python', '⭐⭐⭐⭐'],
250
+ ['Terminal Magic', '⭐⭐⭐⭐⭐']
251
+ );
252
+
253
+ console.log(table.toString());
254
+
255
+ console.log('\n' + gradient.pastel('Projects:'));
256
+ console.log('• Terminal Business Card (You\'re using it!)');
257
+ console.log('• Awesome CLI Tools');
258
+ console.log('• Web Applications');
259
+ };
260
+
261
+ const handleContact = async () => {
262
+ console.log(gradient.fruit('šŸ“ž Contact Information šŸ“ž\n'));
263
+
264
+ const contactTable = new Table({
265
+ style: { head: [], border: [] }
266
+ });
267
+
268
+ contactTable.push(
269
+ { 'Email': 'brian@example.com' },
270
+ { 'LinkedIn': 'linkedin.com/in/brianmaina' },
271
+ { 'Twitter': 'twitter.com/brianmaina' }
272
+ );
273
+
274
+ console.log(contactTable.toString());
275
+ };
288
276
 
289
277
  const prompt = inquirer.createPromptModule();
290
278
 
@@ -302,7 +290,32 @@ const followup = [
302
290
  async function init() {
303
291
  clear();
304
292
  console.log(card);
305
- await prompt(questions).then(answer => answer.action());
293
+ await prompt(questions).then(async answer => {
294
+ switch(answer.action) {
295
+ case 'resume':
296
+ await handleResume();
297
+ break;
298
+ case 'github':
299
+ await handleGitHub();
300
+ break;
301
+ case 'song':
302
+ await handleSong();
303
+ break;
304
+ case 'pingpong':
305
+ await handlePingPong();
306
+ break;
307
+ case 'portfolio':
308
+ await handlePortfolio();
309
+ break;
310
+ case 'contact':
311
+ await handleContact();
312
+ break;
313
+ case 'exit':
314
+ console.log(gradient.pastel("Have a nice day!\n"));
315
+ process.exit();
316
+ }
317
+ });
318
+
306
319
  await Enquirer.prompt(followup).then(answer => {
307
320
  if (!answer.exit) {
308
321
  init();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brianmmaina",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "My terminal business card",
5
5
  "main": "index.js",
6
6
  "type": "module",