MCPcopy Create free account
hub / github.com/factorapp/factor / populateApp

Function populateApp

cmd/init.go:82–159  ·  view source on GitHub ↗

appPath is the location of the app under the GOPATH

(cwd, appPkg string)

Source from the content-addressed store, hash-verified

80
81// appPath is the location of the app under the GOPATH
82func populateApp(cwd, appPkg string) error {
83 filename := "index.html"
84 filePath := filepath.Join(cwd, appName, "app", filename)
85 err := writeTemplate(filePath, codegen.IndexHTML)
86 if err != nil {
87 return err
88 }
89
90 filename = "wasm_exec.js"
91 filePath = filepath.Join(cwd, appName, "app", filename)
92 err = writeTemplate(filePath, codegen.WasmJS)
93 if err != nil {
94 return err
95 }
96 filename = "global.css"
97 filePath = filepath.Join(cwd, appName, "assets", filename)
98 err = writeTemplate(filePath, codegen.GlobalCSS)
99 if err != nil {
100 return err
101 }
102 filename = "main.go"
103 filePath = filepath.Join(cwd, appName, "client", filename)
104 clientGoMain, err := codegen.ClientGoMain(appPkg)
105 if err != nil {
106 return err
107 }
108 err = writeTemplate(filePath, clientGoMain)
109 if err != nil {
110 return err
111 }
112 filename = "Nav.html"
113 filePath = filepath.Join(cwd, appName, "components", filename)
114 err = writeTemplate(filePath, codegen.NavComponentHTML)
115 if err != nil {
116 return err
117 }
118 filename = "nav.go"
119 filePath = filepath.Join(cwd, appName, "components", filename)
120 err = writeTemplate(filePath, codegen.NavComponentGo)
121 if err != nil {
122 return err
123 }
124 filename = "Index.html"
125 filePath = filepath.Join(cwd, appName, "routes", filename)
126 err = writeTemplate(filePath, codegen.RoutesHTML)
127 if err != nil {
128 return err
129 }
130 filename = "index.go"
131 filePath = filepath.Join(cwd, appName, "routes", filename)
132 err = writeTemplate(filePath, codegen.RoutesGo)
133 if err != nil {
134 return err
135 }
136 filename = "todo.go"
137 filePath = filepath.Join(cwd, appName, "models", filename)
138 err = writeTemplate(filePath, codegen.TodoClient)
139 if err != nil {

Callers 1

init.goFile · 0.85

Calls 3

ClientGoMainFunction · 0.92
ServerGoMainFunction · 0.92
writeTemplateFunction · 0.85

Tested by

no test coverage detected