Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed nondbMakeFile #273

Merged
merged 2 commits into from
Jul 10, 2024
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
19 changes: 5 additions & 14 deletions cmd/program/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,20 +356,11 @@ func (p *Project) CreateMainFile() error {

defer makeFile.Close()

if p.DBDriver == "sqlite" || p.DBDriver == "none" {
// inject makefile template
makeFileTemplate := template.Must(template.New("makefile").Parse(string(framework.NonDbMakeFileTemplate())))
err = makeFileTemplate.Execute(makeFile, p)
if err != nil {
return err
}
} else {
// inject makefile template for database excluding sqlite
makeFileTemplate := template.Must(template.New("makefile").Parse(string(framework.MakeTemplate())))
err = makeFileTemplate.Execute(makeFile, p)
if err != nil {
return err
}
// inject makefile template
makeFileTemplate := template.Must(template.New("makefile").Parse(string(framework.MakeTemplate())))
err = makeFileTemplate.Execute(makeFile, p)
if err != nil {
return err
}

readmeFile, err := os.Create(filepath.Join(projectPath, "README.md"))
Expand Down
4 changes: 3 additions & 1 deletion cmd/template/framework/files/makefile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ all: build

build:
@echo "Building..."
{{if .AdvancedOptions.htmx}}@templ generate{{end}}
{{if or ( .AdvancedOptions.htmx ) ( .AdvancedOptions.tailwind )}}@templ generate{{end}}
Ujstor marked this conversation as resolved.
Show resolved Hide resolved
{{if .AdvancedOptions.tailwind}}@tailwindcss -i cmd/web/assets/css/input.css -o cmd/web/assets/css/output.css{{end}}
@go build -o main cmd/api/main.go

# Run the application
run:
@go run cmd/api/main.go

{{if and (ne .DBDriver "none") (ne .DBDriver "sqlite")}}
# Create DB container
docker-run:
@if docker compose up 2>/dev/null; then \
Expand All @@ -30,6 +31,7 @@ docker-down:
echo "Falling back to Docker Compose V1"; \
docker-compose down; \
fi
{{end}}

# Test the application
test:
Expand Down
42 changes: 0 additions & 42 deletions cmd/template/framework/files/nondbMakeFile.tmpl

This file was deleted.

7 changes: 0 additions & 7 deletions cmd/template/framework/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
//go:embed files/main/main.go.tmpl
var mainTemplate []byte

//go:embed files/nondbMakeFile.tmpl
var nondbMakeFileTemplate []byte

//go:embed files/air.toml.tmpl
var airTomlTemplate []byte

Expand Down Expand Up @@ -43,7 +40,3 @@ func AirTomlTemplate() []byte {
func ReadmeTemplate() []byte {
return readmeTemplate
}

func NonDbMakeFileTemplate() []byte {
return nondbMakeFileTemplate
}
1 change: 1 addition & 0 deletions xs
Submodule xs added at d08e56
Loading