Skip to content

Commit 1bc3ee6

Browse files
committed
[Fix] Validate advanced features in non-interactive mode and streamline project creation flow
1 parent 5350285 commit 1bc3ee6

2 files changed

Lines changed: 6 additions & 16 deletions

File tree

cmd/create.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ var createCmd = &cobra.Command{
212212
}
213213
}
214214
} else if flagAdvanced {
215+
if flagNoInteractive {
216+
cobra.CheckErr(textinput.CreateErrorInputModel(fmt.Errorf("advanced features must be provided with --feature when --no-interactive is set")).Err())
217+
}
215218
step := steps.Steps["advanced"]
216219
tprogram = tea.NewProgram((multiSelection.InitialModelMultiSelect(step.Options, options.Advanced, step.Headers, project)))
217220
if _, err := tprogram.Run(); err != nil {
@@ -225,9 +228,6 @@ var createCmd = &cobra.Command{
225228
log.Fatal("failed to set the feature flag value", err)
226229
}
227230
}
228-
if err != nil {
229-
log.Fatal("failed to set the htmx option", err)
230-
}
231231
}
232232

233233
collectFrontendFramework(cmd, project, options, steps, flagFrontendFramework, flagNoInteractive)
@@ -267,14 +267,6 @@ var createCmd = &cobra.Command{
267267
project.SkipInstall = true
268268
}
269269

270-
if spec.Execution.Output == scaffold.OutputJSON {
271-
result := scaffold.PlannedResult(scaffold.BuildPlan(spec, currentWorkingDir))
272-
result.Mode = "apply"
273-
if err := scaffold.WriteApplyResult(os.Stdout, result, spec.Execution.Output); err != nil {
274-
cobra.CheckErr(err)
275-
}
276-
}
277-
278270
frontendFramework := flags.FrontendFramework(cmd.Flag("frontend").Value.String())
279271
executeProjectCreation(project, frontendFramework, flagSvelteKitTemplate, flagSvelteKitTypes, flagSvelteKitPackageManager, !flagNoInteractive)
280272
if spec.Execution.Output != scaffold.OutputJSON {
@@ -559,7 +551,9 @@ func executeProjectCreation(project *program.Project, frontendFramework flags.Fr
559551
}
560552
}
561553

562-
runOptionalBootstrap(project, frontendFramework, template, types, packageManager)
554+
if !project.SkipInstall {
555+
runOptionalBootstrap(project, frontendFramework, template, types, packageManager)
556+
}
563557
}
564558

565559
func printNextSteps(project *program.Project, frontendFramework flags.FrontendFramework, supabaseMode flags.SupabaseMode) {

internal/scaffold/spec.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ func (s CreateSpec) HasFeature(feature string) bool {
9898
}
9999

100100
func ValidateSpec(spec CreateSpec) error {
101-
if spec.ProjectType == "" {
102-
spec.ProjectType = flags.Gin
103-
}
104-
105101
if spec.ProjectName == "" {
106102
if spec.Execution.NoInteractive {
107103
return fmt.Errorf("project name is required when --no-interactive is set")

0 commit comments

Comments
 (0)