package cmd import ( "fmt" "os" "path/filepath" "github.com/spf13/cobra" ) func init() { newCmd.AddCommand(monorepoCmd) } var monorepoCmd = &cobra.Command{ Use: "monorepo", Short: "Create a new Draft Monorepo project", Long: `Create a new Draft Monorepo project with the necessary structure and files.`, Run: genMonorepo, } func genMonorepo(cmd *cobra.Command, args []string) { runNewProject(scaffoldRecipe{ label: "monorepo", destSubdir: "apps/api", preScaffold: func(projectDir string) error { if err := os.MkdirAll(projectDir, 0755); err != nil { return fmt.Errorf("error creating project directory: %w", err) } return copyEmbeddedDir("embedded/monorepo-root", projectDir, nil) }, postScaffold: func(projectDir string) error { if err := requirePnpmAndNpx(); err != nil { return fmt.Errorf("error checking for pnpm and npx: %w", err) } isVue, resultLabel, err := promptClientFramework() if err != nil { return fmt.Errorf("prompt failed: %w", err) } clientDir := filepath.Join(projectDir, "apps/client") serviceName := toPascalCase(filepath.Base(projectDir)) fmt.Printf("🚀 Scaffolding %s client app...\n", resultLabel) if isVue { return scaffoldClientVue(clientDir, serviceName) } return scaffoldClientNuxt(clientDir, serviceName) }, }) }