-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
118 lines (110 loc) · 4.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
const figlet = require("figlet");
import chalk from "chalk";
const { exec } = require("child_process");
const prompt = require('multiselect-prompt')
let logo = "";
figlet("Reach Systems", (err, data) => {
if (err) {
console.log(err)
}
logo = chalk.blue(data)
})
await Bun.sleep(100);
const colors = [
{title: 'UI', value: 'UI'},
{title: 'Auth Proxy', value: 'auth'},
{title: 'Kanban', value: 'kanban'},
{title: 'Page', value: 'page'},
{title: 'Page server', value: 'pageServer'},
{title: 'Storage server', value: 'storage'},
{title: 'Page Analytics', value: 'pageAnalytics'},
{title: 'Landing', value: 'landing'},
{title: 'Mailing Server', value: 'mailing'},
{title: 'Mail Template', value: 'templates'},
]
const selected = (items) => items
.filter((item) => item.selected)
.map((item) => item.value)
// All these options are optional
const opts = {
// The message to display as hint if enabled, below is the default value
hint: '– Space to select. Return to submit.'
}
const handleRunner = (e) => {
switch (e) {
case 'UI':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/Documents/reach-io/reach@v2 && bun dev"
end tell'
`)
break
case 'auth':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/GolandProjects/awesomeProject && source .env && go run cmd/main.go"
end tell'
`)
break
case 'kanban':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/Documents/pythonProject && source venv/bin/activate && source .env && python3 main.py"
end tell'
`)
break
case 'mailing':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/Documents/flaskProject && source venv/bin/activate && source .env && python3 app.py"
end tell'
`)
break
case 'pageServer':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/Documents/reach-io/reach-page-server && bun dev"
end tell'
`)
break
case 'pageAnalytics':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/Documents/reach-page-analytics && source .venv/bin/activate && source .env && python3 app.py "
end tell'
`)
break
case 'page':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/GolandProjects/Reach-page && source .env && go run cmd/main.go"
end tell'
`)
break
case 'templates':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/Documents/reach-io/react-email-starter && bun dev"
end tell'
`)
break
case 'landing':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/Documents/reach-io/temp-landing && bun dev"
end tell'
`)
break
case 'storage':
exec(`
osascript -e 'tell app "Terminal"
do script "cd /Users/iresharma/Documents/reach-file-server && source .venv/bin/activate && source .env && python3 app.py"
end tell'
`)
break
}
}
prompt("\n" + logo + '\nWhich colors do you like?', colors, opts)
.on('data', (data) => console.log('Changed to', selected(data.value)))
.on('abort', (items) => console.log('Aborted with', selected(items)))
.on('submit', (items) => console.log('Submitted with', selected(items).forEach(e => handleRunner(e))))