-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
58 lines (50 loc) · 1.97 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
package main
import (
"fmt"
"os"
"sync"
"superkoders.com/intl/constants"
"superkoders.com/intl/operations"
"superkoders.com/intl/utils"
)
func main() {
userIntention := operations.AskUserIntention()
srcFolderPath := ""
rootPath := constants.ROOT_PATH
projectName := ""
if userIntention == constants.FROM_SCRATCH {
projectName = operations.AskProjectName()
operations.CloneNextStarterKitRepo(projectName)
srcFolderPath = projectName + "/src"
rootPath = rootPath + "/" + projectName
} else {
utils.Alert("This functionality is not implemented yet!")
os.Exit(1)
}
defaultLocale := operations.AskDefaultLocale()
otherLocales := operations.AskOtherLocales(defaultLocale.Code)
var otherLocalesCodes []string = []string{}
for _, loc := range otherLocales {
otherLocalesCodes = append(otherLocalesCodes, loc.Code)
}
operations.HandlePOEditorProjectCreation(projectName, defaultLocale.Code, otherLocalesCodes)
utils.Warn("🚀 Creating project...")
operations.CreateFilesForIntlMessages(defaultLocale, otherLocales, srcFolderPath)
var wg sync.WaitGroup
wg.Add(13)
go operations.CreateLocalesTsConfig(&wg, rootPath)
go operations.CreateIntlHelperFunctions(&wg, srcFolderPath)
go operations.CreatePackageJson(&wg, projectName, defaultLocale, rootPath)
go operations.CreateSupportedLocalesFile(defaultLocale, otherLocales, &wg, srcFolderPath)
go operations.CreateBabelrcFile(&wg, rootPath)
go operations.CreateNextConfigFile(&wg, rootPath)
go operations.AddToGitIgnore(&wg, rootPath)
go operations.AddEnvFile(&wg, rootPath)
go operations.CreateLocaleProvider(&wg, srcFolderPath)
go operations.WrapAppInLocaleContext(&wg, srcFolderPath)
go operations.EditIndexFile(&wg, srcFolderPath)
go operations.CreateDummyLangPicker(&wg, srcFolderPath)
go operations.AppendToReadMeFile(&wg, rootPath)
wg.Wait()
utils.Warn2(fmt.Sprintf("\n\n👍 Your project is ready! To start working on it, run: \n\n✔️ cd %s \n✔️ npm install \n✔️ npm run dev\n\n", projectName))
}