@@ -10,6 +10,7 @@ import (
1010 "github.com/major-technology/cli/clients/api"
1111 "github.com/major-technology/cli/clients/git"
1212 mjrToken "github.com/major-technology/cli/clients/token"
13+ "github.com/major-technology/cli/constants"
1314 "github.com/major-technology/cli/errors"
1415 "github.com/major-technology/cli/middleware"
1516 "github.com/major-technology/cli/singletons"
@@ -169,8 +170,8 @@ func runCreate(cobraCmd *cobra.Command) error {
169170 cobraCmd .Printf (" Clone URL: %s\n " , cloneURL )
170171
171172 // If Vite template and resources were selected, add them using major-client
172- if templateName == "Vite" && len (selectedResources ) > 0 {
173- if err := utils .AddResourcesToViteProject (cobraCmd , targetDir , selectedResources , createResp .ApplicationID ); err != nil {
173+ if len (selectedResources ) > 0 {
174+ if err := utils .AddResourcesToProject (cobraCmd , targetDir , selectedResources , createResp .ApplicationID , templateName ); err != nil {
174175 return errors .ErrorFailedToSelectResources
175176 }
176177 }
@@ -258,7 +259,7 @@ func printSuccessMessage(cobraCmd *cobra.Command, appName string) {
258259
259260// selectTemplate prompts the user to select a template for the application
260261// Returns the template URL, name, and ID
261- func selectTemplate (cobraCmd * cobra.Command , apiClient * api.Client ) (string , string , string , error ) {
262+ func selectTemplate (cobraCmd * cobra.Command , apiClient * api.Client ) (string , constants. TemplateName , string , error ) {
262263 // Fetch available templates
263264 templatesResp , err := apiClient .GetTemplates ()
264265 if err != nil {
@@ -293,7 +294,7 @@ func selectTemplate(cobraCmd *cobra.Command, apiClient *api.Client) (string, str
293294 // Create options for the select
294295 options := make ([]huh.Option [string ], len (orderedTemplates ))
295296 for i , template := range orderedTemplates {
296- options [i ] = huh .NewOption (template .Name , template .TemplateURL )
297+ options [i ] = huh .NewOption (string ( template .Name ) , template .TemplateURL )
297298 }
298299
299300 // Prompt user to select a template
@@ -313,7 +314,8 @@ func selectTemplate(cobraCmd *cobra.Command, apiClient *api.Client) (string, str
313314 }
314315
315316 // Find the template name and ID for the selected URL
316- var selectedTemplateName , selectedTemplateID string
317+ var selectedTemplateName constants.TemplateName
318+ var selectedTemplateID string
317319 for _ , template := range orderedTemplates {
318320 if template .TemplateURL == selectedTemplateURL {
319321 selectedTemplateName = template .Name
0 commit comments