Skip to content

Commit

Permalink
Migrate to templ for html templates
Browse files Browse the repository at this point in the history
  • Loading branch information
profsmallpine committed Aug 15, 2024
1 parent 41134c2 commit 027bcc8
Show file tree
Hide file tree
Showing 49 changed files with 2,654 additions and 1,281 deletions.
32 changes: 32 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
root = "."
tmp_dir = "tmp"

[build]
bin = "./tmp/main"
cmd = "templ generate && go build -o ./tmp/main ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor"]
exclude_file = []
exclude_regex = [".*_templ.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "templ", "html"]
kill_delay = "0s"
log = "build-errors.log"
send_interrupt = false
stop_on_error = true

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
time = false

[misc]
clean_on_exit = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# Application binary
private-notes
tmp_bin
tmp/*

# ENV
.env
4 changes: 0 additions & 4 deletions .hotbuild.toml

This file was deleted.

17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# run templ generation in watch mode to detect all .templ files and
# re-create _templ.txt files on change, then send reload event to browser.
# Default url: http://localhost:7331
live/templ:
templ generate --watch --proxy="http://localhost:8080" --open-browser=false

# run air to detect any go file changes to re-build and re-run the server.
live/server:
air \
--build.cmd "go build -o tmp/bin/main" --build.bin "tmp/bin/main" --build.delay "100" \
--build.include_ext "go" \
--build.stop_on_error "false" \
--misc.clean_on_exit true

# start all watch processes in parallel.
dev:
make -j5 live/templ live/server
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ conversations using E2E encryption with keys stored by the consuming clients.

## Development instructions

1. Install Go 1.20
1. Install Go 1.22
2. Install PostgreSQL 13.1
3. `./scripts/setup_dev_dbs` to create development database
4. Run `cp .env.example .env`
Expand Down Expand Up @@ -42,7 +42,8 @@ conversations using E2E encryption with keys stored by the consuming clients.
- [x] Spike out SSE implementation for meeting + goals
- [x] Remove hotwire for HMTX dep
- [x] Add MVP of meeting review
- [ ] Update header to context based breadcrumb
- [x] Adds templ POC to /templ
- [x] Update header to context based breadcrumb
- [ ] Paginate meetings
- [ ] Implement application encryption for note content (E2E)
- [ ] Add draft feature for notes
Expand Down
6 changes: 6 additions & 0 deletions domain/breadcrumb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package domain

type Breadcrumb struct {
Label string
URL string
}
2 changes: 1 addition & 1 deletion domain/note.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Note struct {

Author *User `json:"author" gorm:"foreignKey:UserID"`
Comments []*Comment `json:"comments"`
// Group via group_id
Group *Group `json:"group"`
}

func (n *Note) CreatedAtHumanized() string {
Expand Down
38 changes: 15 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,61 +1,53 @@
module github.com/profsmallpine/private-notes

go 1.20
go 1.22.5

require (
github.com/a-h/templ v0.2.747
github.com/gorilla/mux v1.8.0
github.com/gorilla/schema v1.2.0
github.com/xy-planning-network/trails v0.8.12
github.com/xy-planning-network/trails v0.10.5
golang.org/x/oauth2 v0.11.0
google.golang.org/api v0.138.0
gorm.io/gorm v1.25.4
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde
)

require (
github.com/joho/godotenv v1.4.0 // indirect
github.com/xy-planning-network/tint v0.0.0-20230807192211-11572c81efcc // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
github.com/xy-planning-network/tint v0.0.0-20230906200307-662ca545427c // indirect
)

require (
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/getsentry/sentry-go v0.23.0 // indirect
github.com/go-redis/redis/v8 v8.11.4 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/google/s2a-go v0.1.5 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.12.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.11.0 // indirect
github.com/jackc/pgx/v4 v4.16.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.6.0 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
go.uber.org/mock v0.3.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gorm.io/driver/postgres v1.3.6 // indirect
gorm.io/driver/postgres v1.5.7 // indirect
)
Loading

0 comments on commit 027bcc8

Please sign in to comment.