-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
147 lines (112 loc) · 3.48 KB
/
main.go
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package main
// to build: go build -o scriptname
import (
"fmt"
"os"
generated "sam.crider/boilerplate-script/file_generator/generated_files"
next_boil "sam.crider/boilerplate-script/next"
express_boil "sam.crider/boilerplate-script/express"
"sam.crider/boilerplate-script/utils"
vite_boil "sam.crider/boilerplate-script/vite"
)
func main() {
// get the user's selected stack
stack := utils.Select(
"Select Your Build Stack:",
[]string{
"Vite + Express",
"Next.js",
},
)
// get the user's project name
project_name := utils.Input(
"What's the name of this project?",
)
// get users auth preference
auth_integration := utils.Select(
"Pick an auth integration:",
[]string{
"Firebase",
"Clerk",
"None",
},
)
// get the docker port
docker_port := utils.GetDockerPort()
// TODO: make this a switch case
if stack == "Vite + Express" {
utils.Work_wrapper(func() {
// create a directory for the project, 0755 is the permission bits
err := os.Mkdir(project_name, 0755)
if err != nil {
fmt.Println(err)
return
}
// cd into the new project
err = os.Chdir(project_name)
if err != nil {
fmt.Println(err)
return
}
// initialize git for the project
cmd := utils.BoundCommand("git", "init")
if err := cmd.Run(); err != nil {
fmt.Println(err)
return
}
}, "Initializing project...")()
// TODO: make this a switch case
if auth_integration == "Firebase" {
// add readme
utils.Create_File("README.md", generated.File__viteExpressFirebaseReadme)
// create the frontend
vite_boil.Vite_FirebaseAuth()
// create the backend
express_boil.Express_FirebaseAuth(docker_port)
fmt.Println("Success! Boilerplate created. Check the root directory README.md for further instructions.")
return
} else if auth_integration == "Clerk" {
// add readme
utils.Create_File("README.md", generated.File__viteExpressClerkReadme)
// create the frontend
vite_boil.Vite_ClerkAuth()
// create the backend
express_boil.Express_ClerkAuth(docker_port)
fmt.Println("Success! Boilerplate created. Check the root directory README.md for further instructions.")
return
} else if auth_integration == "None" {
// add readme
utils.Create_File("README.md", generated.File__viteExpressNoAuthReadme)
// create the frontend
vite_boil.Vite_NoAuth()
// create the backend
express_boil.Express_NoAuth(docker_port)
fmt.Println("Success! Boilerplate created. Check the root directory README.md for further instructions.")
return
}
fmt.Println("Failure. Maybe you didn't select an option?")
return
}
if stack == "Next.js" {
// TODO: make this a switch case
if auth_integration == "Firebase" {
// create the app
next_boil.Next_Firebase(project_name, docker_port)
fmt.Println("Success! Boilerplate created. Check the root directory README.md for further instructions.")
return
} else if auth_integration == "Clerk" {
// create the app
next_boil.Next_ClerkAuth(project_name, docker_port)
fmt.Println("Success! Boilerplate created. Check the root directory README.md for further instructions.")
return
} else if auth_integration == "None" {
// create the app
next_boil.Next_NoAuth(project_name, docker_port)
fmt.Println("Success! Boilerplate created. Check the root directory README.md for further instructions.")
return
}
fmt.Println("Failure. Maybe you didn't select an option?")
return
}
fmt.Println("Failure. Maybe you didn't select an option?")
}