1
+ #!/usr/bin/env node
2
+ import chalk from "chalk" ;
3
+ import inquirer from 'inquirer' ;
4
+ import gradient from "gradient-string" ;
5
+ import chalkAnimation from 'chalk-animation' ;
6
+ import figlet from "figlet" ;
7
+ import { createSpinner } from "nanospinner" ;
8
+ import util from "util" ;
9
+
10
+ const sleep = ( ms = 2000 ) => new Promise ( ( r ) => setTimeout ( r , ms ) ) ;
11
+ const figletPromise = util . promisify ( figlet ) ;
12
+
13
+ async function welcome ( ) {
14
+ const rainbowTitle = chalkAnimation . rainbow (
15
+ "Welcome to my portfolio, Nice meeting you !!"
16
+ ) ;
17
+ await sleep ( ) ;
18
+ rainbowTitle . stop ( ) ;
19
+ console . log (
20
+ `Hi, I am ${ chalk . cyan . bold ( " Aditya Singh." ) }
21
+ I am a Software Engineer and builder with multiple interests.
22
+ I like to code out my ideas but sometimes they may be ${ chalk . redBright ( "deadly." ) }
23
+ So go ahead with utmost caution.
24
+ ${ chalk . greenBright ( 'Would you like to see some of my projects? 😉 ' ) }
25
+ ${ chalk . yellowBright ( "Fun fact:" ) } try pressing ${ chalk . redBright ( "Ctrl + Click" ) } on the links.
26
+ `
27
+ )
28
+ }
29
+
30
+ async function farewell ( ) {
31
+ await sleep ( ) ;
32
+ const data = await figletPromise ( 'Good Bye, Sayonara !!' ) ;
33
+ console . log ( gradient . retro . multiline ( data ) + '\n' ) ;
34
+ }
35
+
36
+ async function handleAnswer ( optionChoosen ) {
37
+ const spinner = createSpinner ( 'Bringing projects...' ) . start ( ) ;
38
+ await sleep ( ) ;
39
+
40
+ if ( optionChoosen === 'FrontEnd' ) {
41
+ spinner . success ( { text : `You can see the projects here " https://github.com/Adityasinghvats/Web-Frontend "` } )
42
+ } else if ( optionChoosen === 'Backend' ) {
43
+ spinner . success ( { text : `You can see the projects here " https://github.com/Adityasinghvats?tab=repositories "` } )
44
+ } else if ( optionChoosen === 'Android' ) {
45
+ spinner . success ( { text : `You can see the projects here " https://github.com/Adityasinghvats?tab=repositories "` } )
46
+ } else if ( optionChoosen === 'Games' ) {
47
+ spinner . success ( { text : `You can see the projects here " https://github.com/Adityasinghvats?tab=repositories "` } )
48
+ }
49
+ else if ( optionChoosen === 'Nah, Show me your problem solving skills' ) {
50
+ spinner . success ( { text : `Take a look at my Leetcode profile " https://leetcode.com/u/adityasinghvats/ "` } )
51
+ } else {
52
+ spinner . error ( { text : `Now you have entered the unchartered territory, Go Back!!` } ) ;
53
+ }
54
+
55
+ await farewell ( ) ;
56
+ process . exit ( 0 ) ;
57
+ }
58
+
59
+
60
+ async function question ( params ) {
61
+ const options = await inquirer . prompt ( {
62
+ name : 'skill' ,
63
+ type : 'list' ,
64
+ message : 'What kind of project would to like to see ?\n' ,
65
+ choices : [
66
+ 'FrontEnd' ,
67
+ 'Backend' ,
68
+ 'Android' ,
69
+ 'Games' ,
70
+ 'Nah, Show me your problem solving skills' ,
71
+ 'I am not interested' ,
72
+ ] ,
73
+ } ) ;
74
+
75
+ return handleAnswer ( options . skill ) ;
76
+ }
77
+
78
+
79
+ async function main ( ) {
80
+ await welcome ( ) ;
81
+ await question ( ) ;
82
+ }
83
+ main ( ) ;
0 commit comments