Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ on:
pull_request:
branches: [main]
paths:
- 'backend/**' # Triggers only when changes are made inside the backend folder
- '.github/workflows/backend.yml' # Also trigger if the workflow file itself changes
- 'cmd/server/**'
- 'internal/**'
- '.github/workflows/backend.yml'
push:
branches: [main]
paths:
- 'backend/**' # Triggers only when changes are made inside the backend folder
- '.github/workflows/backend.yml' # Also trigger if the workflow file itself changes
- 'cmd/server/**'
- 'internal/**'
- '.github/workflows/backend.yml'

jobs:
build_and_test_backend:
name: Build Backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
working-directory: .
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -29,4 +31,4 @@ jobs:
- name: Install dependencies
run: go mod download
- name: Build backend
run: go build -v ./...
run: go build -v ./cmd/server/...
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ jobs:
frontend:
- 'frontend/**'
backend:
- 'backend/**'
- 'cmd/server/**'
- 'internal/**'

# Step 2: Build and push Frontend (If only frontend is changed)
build-frontend:
Expand Down Expand Up @@ -106,7 +107,8 @@ jobs:
- name: Build and push backend
uses: docker/build-push-action@v5
with:
context: ./backend
context: .
file: cmd/server/Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/goinitializer:latest
Expand Down
77 changes: 0 additions & 77 deletions backend/README.md

This file was deleted.

69 changes: 0 additions & 69 deletions backend/config.go

This file was deleted.

Empty file.
40 changes: 0 additions & 40 deletions backend/go.mod

This file was deleted.

6 changes: 0 additions & 6 deletions backend/main.go

This file was deleted.

104 changes: 104 additions & 0 deletions cmd/goini/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package main

import (
"fmt"
"os"
"sort"
"text/tabwriter"

"github.com/spf13/cobra"

"github.com/neo7337/go-initializer/internal/generator"
)

func newListCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "List supported project types, frameworks, or addons",
}
cmd.AddCommand(newListTypesCmd())
cmd.AddCommand(newListFrameworksCmd())
cmd.AddCommand(newListAddonsCmd())
return cmd
}

func newListTypesCmd() *cobra.Command {
return &cobra.Command{
Use: "types",
Short: "Print all supported project types",
Run: func(cmd *cobra.Command, args []string) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)
fmt.Fprintln(w, "TYPE\tLABEL")
fmt.Fprintln(w, "----\t-----")
keys := make([]string, 0, len(generator.SupportedProjectTypesLabelsMap))
for k := range generator.SupportedProjectTypesLabelsMap {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
fmt.Fprintf(w, "%s\t%s\n", k, generator.SupportedProjectTypesLabelsMap[k])
}
w.Flush()
},
}
}

func newListFrameworksCmd() *cobra.Command {
var projectType string
cmd := &cobra.Command{
Use: "frameworks",
Short: "Print supported frameworks for a project type",
RunE: func(cmd *cobra.Command, args []string) error {
if projectType == "" {
return fmt.Errorf("--type is required (e.g. --type microservice)")
}
frameworks, ok := generator.SupportedFrameworksMap[projectType]
if !ok {
return fmt.Errorf("unknown project type %q; run 'goini list types' to see valid values", projectType)
}
w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)
fmt.Fprintln(w, "FRAMEWORK")
fmt.Fprintln(w, "---------")
keys := make([]string, 0, len(frameworks))
for k := range frameworks {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
fmt.Fprintln(w, k)
}
w.Flush()
return nil
},
}
cmd.Flags().StringVarP(&projectType, "type", "t", "", "Project type (e.g. microservice, api-server, cli-app, simple-project)")
return cmd
}

func newListAddonsCmd() *cobra.Command {
return &cobra.Command{
Use: "addons",
Short: "Print all supported addons",
Run: func(cmd *cobra.Command, args []string) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)
fmt.Fprintln(w, "CATEGORY\tADDON")
fmt.Fprintln(w, "--------\t-----")
categories := make([]string, 0, len(generator.SupportedAddonsMap))
for k := range generator.SupportedAddonsMap {
categories = append(categories, k)
}
sort.Strings(categories)
for _, cat := range categories {
addons := make([]string, 0, len(generator.SupportedAddonsMap[cat]))
for a := range generator.SupportedAddonsMap[cat] {
addons = append(addons, a)
}
sort.Strings(addons)
for _, a := range addons {
fmt.Fprintf(w, "%s\t%s\n", cat, a)
}
}
w.Flush()
},
}
}
Loading
Loading