Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f402c46
WIP: tailwindcss v4
arafays Jan 29, 2025
5aec066
WIP: react + tailwindcss done
arafays Jan 29, 2025
a9997b5
fix: correct path
arafays Jan 29, 2025
a1f55e4
update docs
arafays Jan 29, 2025
829a14d
Fixed a bug where the interupt signal was still being captured and no…
joncalhoun Feb 27, 2025
1651f2c
Fix Melkeydev#115 Pull request missing pq driver replacement
DLTADragonHawk Mar 5, 2025
e478069
more transparent error message when executing command
gnoega Mar 13, 2025
0625a01
docs actions update (#389)
Ujstor Apr 18, 2025
e7af940
go 1.23.0 (#390)
Ujstor Apr 18, 2025
99288d3
fix: dont install less than v4 (#391)
arafays Apr 24, 2025
d68f777
fix typos/grammar and remove duplicate text (#393)
0x4D5352 May 3, 2025
83092ca
feat: add flag completions (#395)
Ethanol48 May 3, 2025
99ce129
Fixed no git on system panic even if git flag is skip (#396)
ScaryFrogg May 17, 2025
6a229b7
added builder flag
eggplannt May 22, 2025
cb487f2
added added make and just option to TUI
eggplannt May 22, 2025
56d9a81
fixed some typos and added templates
eggplannt May 22, 2025
9a43458
updated readme
eggplannt May 22, 2025
d81559e
updated build git
eggplannt May 22, 2025
4fc25e5
removed main (oops)
eggplannt May 22, 2025
f10b97c
updated image (again (oops))
eggplannt May 22, 2025
a675005
Delete public/build.gif:Zone.Identifier
eggplannt May 22, 2025
9d26f2d
Update steps.go
eggplannt May 22, 2025
fbf09cd
Dummy commit
eggplannt May 22, 2025
40975b5
fixed the linter
eggplannt May 22, 2025
927a28a
:Merge branch 'main' of https://github.com/eggplannt/go-blueprint
eggplannt May 22, 2025
0ff99c2
removed make test in linter
eggplannt May 22, 2025
7b91ff4
updated docs, fixed some bugs, removed test project (oops), and added…
eggplannt May 22, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/generate-linter-advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ jobs:
framework_matrix:
strategy:
matrix:
framework: [chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo]
framework:
[chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo]
driver: [postgres]
git: [commit]
builder: [just, make]
advanced: [htmx, githubaction, websocket, tailwind, docker, react]

runs-on: ubuntu-latest
Expand All @@ -20,7 +22,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
go-version: "1.23.x"

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4
Expand All @@ -35,16 +37,16 @@ jobs:
run: echo "PROJECT_DIRECTORY=${{ matrix.framework }}" | sed 's/\//-/g' >> $GITHUB_ENV

- name: build templates
run: script -q /dev/null -c "go run main.go create -n ${{ env.PROJECT_DIRECTORY }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} -g ${{ matrix.git}} --advanced --feature ${{ matrix.advanced }}"
run: script -q /dev/null -c "go run main.go create -n ${{ env.PROJECT_DIRECTORY }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} -g ${{ matrix.git}} -br ${{ matrix.builder}} --advanced --feature ${{ matrix.advanced }}"

- if: ${{ matrix.advanced == 'htmx' || matrix.advanced == 'tailwind' }}
name: Install Templ & gen templates
run: |
run: |
go install github.com/a-h/templ/cmd/templ@latest
/home/runner/go/bin/templ generate -path ${{ env.PROJECT_DIRECTORY }}

- name: golangci-lint
run: |
run: |
cd ${{ env.PROJECT_DIRECTORY }}
golangci-lint run

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/generate-linter-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ jobs:
framework_matrix:
strategy:
matrix:
framework: [chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo]
framework:
[chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo]
driver: [mysql, postgres, sqlite, mongo, redis, scylla, none]
git: [commit, stage, skip]
builder: [just]

runs-on: ubuntu-latest
steps:
Expand All @@ -19,7 +21,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
go-version: "1.23.x"

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4
Expand All @@ -34,10 +36,10 @@ jobs:
run: echo "PROJECT_DIRECTORY=${{ matrix.framework }}" | sed 's/\//-/g' >> $GITHUB_ENV

- name: build templates
run: script -q /dev/null -c "go run main.go create -n ${{ env.PROJECT_DIRECTORY }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} -g ${{ matrix.git}}"
run: script -q /dev/null -c "go run main.go create -n ${{ env.PROJECT_DIRECTORY }} -f ${{ matrix.framework}} -d ${{ matrix.driver }} -g ${{ matrix.git}} -br ${{ matrix.builder}}"

- name: golangci-lint
run: |
run: |
cd ${{ env.PROJECT_DIRECTORY }}
golangci-lint run

Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/testcontainers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ jobs:
itests_matrix:
strategy:
matrix:
driver:
[mysql, postgres, mongo, redis, scylla]
driver: [mysql, postgres, mongo, redis, scylla]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
go-version: "1.23.x"

- name: Commit report
run: |
git config --global user.name 'testname'
git config --global user.email 'testemail@users.noreply.github.com'

- name: build ${{ matrix.driver }} template
run: script -q /dev/null -c "go run main.go create -n ${{ matrix.driver }} -g commit -f fiber -d ${{matrix.driver}}"
run: script -q /dev/null -c "go run main.go create -n ${{ matrix.driver }} -g commit -b just -f fiber -d ${{matrix.driver}}"

- name: run ${{ matrix.driver }} integration tests
working-directory: ${{ matrix.driver }}
Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ See `go-blueprint create -h` for all the options and shorthands.
- [Gorilla/mux](https://github.com/gorilla/mux)
- [Echo](https://github.com/labstack/echo)

<a id="builders-supported"></a>

<h2>
<picture>
<img src="./public/build.gif?raw=true" width="60px" style="margin-right: 1px;">
</picture>
Builders Supported
</h2>

- [GNU Make](https://www.gnu.org/software/make/)
- [Just](https://github.com/casey/just)

<a id="database-support"></a>

<h2>
Expand Down Expand Up @@ -152,7 +164,7 @@ Blueprint UI is a web application that allows you to create commands for the CLI
Here's an example of setting up a project with a specific database driver:

```bash
go-blueprint create --name my-project --framework gin --driver postgres --git commit
go-blueprint create --name my-project --framework gin --driver postgres --git commit --builder just
```

<p align="center">
Expand Down Expand Up @@ -206,7 +218,7 @@ go-blueprint create --advanced --feature react
Or all features at once:

```bash
go-blueprint create --name my-project --framework chi --driver mysql --advanced --feature htmx --feature githubaction --feature websocket --feature tailwind --feature docker --git commit --feature react
go-blueprint create --name my-project --framework chi --driver mysql --advanced --feature htmx --feature githubaction --feature websocket --feature tailwind --feature docker --git commit --builder just --feature react
```

<p align="center">
Expand Down
30 changes: 29 additions & 1 deletion cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func init() {
var flagDBDriver flags.Database
var advancedFeatures flags.AdvancedFeatures
var flagGit flags.Git
var flagBuilder flags.Builder
rootCmd.AddCommand(createCmd)

createCmd.Flags().StringP("name", "n", "", "Name of project to create")
Expand All @@ -52,6 +53,13 @@ func init() {
createCmd.Flags().BoolP("advanced", "a", false, "Get prompts for advanced features")
createCmd.Flags().Var(&advancedFeatures, "feature", fmt.Sprintf("Advanced feature to use. Allowed values: %s", strings.Join(flags.AllowedAdvancedFeatures, ", ")))
createCmd.Flags().VarP(&flagGit, "git", "g", fmt.Sprintf("Git to use. Allowed values: %s", strings.Join(flags.AllowedGitsOptions, ", ")))
createCmd.Flags().VarP(&flagBuilder, "builder", "br", fmt.Sprintf("Builder to use. Allowed values: %s", strings.Join(flags.AllowedBuilders, ", ")))

utils.RegisterStaticCompletions(createCmd, "framework", flags.AllowedProjectTypes)
utils.RegisterStaticCompletions(createCmd, "driver", flags.AllowedDBDrivers)
utils.RegisterStaticCompletions(createCmd, "feature", flags.AllowedAdvancedFeatures)
utils.RegisterStaticCompletions(createCmd, "git", flags.AllowedGitsOptions)
utils.RegisterStaticCompletions(createCmd, "builder", flags.AllowedBuilders)
}

type Options struct {
Expand All @@ -61,6 +69,7 @@ type Options struct {
Advanced *multiSelect.Selection
Workflow *multiInput.Selection
Git *multiInput.Selection
Builder *multiInput.Selection
}

// createCmd defines the "create" command for the CLI
Expand Down Expand Up @@ -92,6 +101,7 @@ var createCmd = &cobra.Command{
flagFramework := flags.Framework(cmd.Flag("framework").Value.String())
flagDBDriver := flags.Database(cmd.Flag("driver").Value.String())
flagGit := flags.Git(cmd.Flag("git").Value.String())
flagBuilder := flags.Builder(cmd.Flag("builder").Value.String())

options := Options{
ProjectName: &textinput.Output{},
Expand All @@ -101,6 +111,7 @@ var createCmd = &cobra.Command{
Choices: make(map[string]bool),
},
Git: &multiInput.Selection{},
Builder: &multiInput.Selection{},
}

project := &program.Project{
Expand All @@ -109,8 +120,10 @@ var createCmd = &cobra.Command{
DBDriver: flagDBDriver,
FrameworkMap: make(map[flags.Framework]program.Framework),
DBDriverMap: make(map[flags.Database]program.Driver),
BuilderMap: make(map[flags.Builder]program.Builder),
AdvancedOptions: make(map[string]bool),
GitOptions: flagGit,
Builder: flagBuilder,
}

steps := steps.InitSteps(flagFramework, flagDBDriver)
Expand Down Expand Up @@ -238,6 +251,21 @@ var createCmd = &cobra.Command{
}
}

if project.Builder == "" {
isInteractive = true
step := steps.Steps["builder"]
tprogram = tea.NewProgram(multiInput.InitialModelMulti(step.Options, options.Builder, step.Headers, project))
if _, err := tprogram.Run(); err != nil {
cobra.CheckErr(textinput.CreateErrorInputModel(err).Err())
}
project.ExitCLI(tprogram)

project.Builder = flags.Builder(strings.ToLower(options.Builder.Choice))
err := cmd.Flag("builder").Value.Set(project.Builder.String())
if err != nil {
log.Fatal("failed to set the builder flag value: ", err)
}
}
currentWorkingDir, err := os.Getwd()
if err != nil {
log.Printf("could not get current working directory: %v", err)
Expand Down Expand Up @@ -273,7 +301,7 @@ var createCmd = &cobra.Command{
if releaseErr := spinner.ReleaseTerminal(); releaseErr != nil {
log.Printf("Problem releasing terminal: %v", releaseErr)
}
log.Printf("Problem creating files for project. %v", err)
log.Printf("Problem creating files for project.")
cobra.CheckErr(textinput.CreateErrorInputModel(err).Err())
}

Expand Down
37 changes: 37 additions & 0 deletions cmd/flags/builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

package flags

import (
"fmt"
"strings"
)

type Builder string

const (
Make Builder = "make"
Just Builder = "just"
)

var AllowedBuilders = []string{string(Make), string(Just)}

func (f Builder) String() string {
return string(f)
}

func (f *Builder) Type() string {
return "Database"
}

func (f *Builder) Set(value string) error {
// Contains isn't available in 1.20 yet
// if AllowedDBDrivers.Contains(value) {
for _, builder := range AllowedBuilders {
if builder == value {
*f = Builder(value)
return nil
}
}

return fmt.Errorf("Builder to use. Allowed values: %s", strings.Join(AllowedBuilders, ", "))
}
Loading
Loading