Public Access
- draft new now offers API, Client, or Full Stack (monorepo) project shapes - draft new client scaffolds a Nuxt or Vue app via the official nuxi/create-vue tooling, with a Draft-maintained auth/API overlay layered on top - draft new monorepo combines a scaffolded API and client under one root with go.work, pnpm-workspace.yaml, and docker-compose wiring - assets/embedded restructured into api/monorepo-root/client-nuxt/client-vue zones, synced via a generalized, job-based sync tool
52 lines
904 B
Go
52 lines
904 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/manifoldco/promptui"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
const oldModuleName = "app_tmpl"
|
|
|
|
type MainTemplateData struct {
|
|
ModuleName string
|
|
ServiceName string
|
|
UseGRPC bool
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(newCmd)
|
|
}
|
|
|
|
var newCmd = &cobra.Command{
|
|
Use: "new",
|
|
Short: "Create a new Draft project",
|
|
Long: `Create a new Draft project with the necessary structure and files.`,
|
|
Run: genProject,
|
|
}
|
|
|
|
func genProject(cmd *cobra.Command, args []string) {
|
|
projType := promptui.Select{
|
|
Label: "Select Project Type",
|
|
Items: []string{"API", "Client", "Full Stack"},
|
|
}
|
|
|
|
_, result, err := projType.Run()
|
|
if err != nil {
|
|
fmt.Printf("Prompt failed %v\n", err)
|
|
return
|
|
}
|
|
|
|
switch result {
|
|
case "API":
|
|
genAPI(cmd, args)
|
|
case "Client":
|
|
genClient(cmd, args)
|
|
case "Full Stack":
|
|
genMonorepo(cmd, args)
|
|
default:
|
|
fmt.Println("Invalid selection")
|
|
}
|
|
}
|