From 65f24abcfb22aa91ff192c1af09bdab6b27fa0de Mon Sep 17 00:00:00 2001 From: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:57:04 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20feat:=20fix=20server=20dockerfil?= =?UTF-8?q?e=20&&=20untrack=20*=5Ftempl.go=20(#991)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend.yml | 32 ++++--- .github/workflows/backend_codeql.yml | 4 +- .github/workflows/cli.yml | 10 +- .github/workflows/cli_codeql.yml | 2 +- .github/workflows/dashboard.yml | 12 +-- .github/workflows/frontend_lib.yml | 16 ++-- .github/workflows/mobile.yml | 12 +-- .github/workflows/web.yml | 12 +-- .gitignore | 10 +- backend/.dockerignore | 4 +- backend/Dockerfile.server | 21 +++-- .../templates/emails/layouts/base_templ.go | 64 ------------- backend/templates/emails/verification.templ | 76 ---------------- .../templates/emails/verification_templ.go | 91 ------------------- backend/templates/emails/welcome_templ.go | 89 ------------------ cli/cmd/format.go | 4 +- cli/cmd/lint.go | 4 +- cli/cmd/run.go | 4 +- cli/cmd/search.go | 2 +- cli/cmd/test.go | 4 +- cli/helpers/backend.go | 2 +- cli/helpers/database.go | 2 +- go.work.sum | 6 ++ 23 files changed, 90 insertions(+), 393 deletions(-) delete mode 100644 backend/templates/emails/layouts/base_templ.go delete mode 100644 backend/templates/emails/verification.templ delete mode 100644 backend/templates/emails/verification_templ.go delete mode 100644 backend/templates/emails/welcome_templ.go diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index aacb559fd..14d705198 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -19,20 +19,22 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: "1.22" - name: Cache Go Modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-go- + ${{ runner.os }}-go - name: Install gofumpt run: go install mvdan.cc/gofumpt@latest + - name: templ + run: go install github.com/a-h/templ/cmd/templ@latest && templ generate - name: Check code formatting run: | unformatted_files=$(gofumpt -l ./backend/) @@ -49,13 +51,21 @@ jobs: pull-requests: read checks: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: "1.22" - cache: false + - name: Cache Go Modules + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go + - name: templ + run: go install github.com/a-h/templ/cmd/templ@latest && templ generate - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: version: latest working-directory: ./backend/ @@ -74,20 +84,20 @@ jobs: - 5432:5432 steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: "1.22" - name: Cache Go Modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go - name: Install Dependencies - run: cd ./backend/ && go get ./... + run: cd ./backend/ && go install github.com/a-h/templ/cmd/templ@latest && templ generate && go get ./... - name: Increase max_connections in PostgreSQL run: | CONTAINER_ID=$(docker ps --filter "publish=5432" --format "{{.ID}}") diff --git a/.github/workflows/backend_codeql.yml b/.github/workflows/backend_codeql.yml index a40539efb..3570080bf 100644 --- a/.github/workflows/backend_codeql.yml +++ b/.github/workflows/backend_codeql.yml @@ -22,7 +22,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: "1.22" - name: Initialize CodeQL @@ -32,7 +32,7 @@ jobs: queries: security-and-quality - name: Build run: | - cd ./backend/ && go build -o backend main.go + go install github.com/a-h/templ/cmd/templ@latest && templ generate && cd ./backend/ && go build -o backend main.go - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 with: diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index fa584ba5d..4cd59de1e 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -19,13 +19,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: "1.22" - name: Cache Go Modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -49,13 +49,13 @@ jobs: pull-requests: read checks: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: "1.22" cache: false - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: version: latest working-directory: ./cli/ diff --git a/.github/workflows/cli_codeql.yml b/.github/workflows/cli_codeql.yml index cb09497e5..7eb08c2ab 100644 --- a/.github/workflows/cli_codeql.yml +++ b/.github/workflows/cli_codeql.yml @@ -22,7 +22,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: "1.22" - name: Initialize CodeQL diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index 2c13b7a0d..0c5f56c9c 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -34,9 +34,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -54,9 +54,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn diff --git a/.github/workflows/frontend_lib.yml b/.github/workflows/frontend_lib.yml index 029ea34ae..f62be6185 100644 --- a/.github/workflows/frontend_lib.yml +++ b/.github/workflows/frontend_lib.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -34,9 +34,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -54,9 +54,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -74,7 +74,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout current branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get new version of package.json id: get_new_version @@ -82,7 +82,7 @@ jobs: echo "new_version=$(jq -r '.version' frontend/lib/package.json)" >> $GITHUB_OUTPUT - name: Checkout main - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: main diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 39304c8e7..eb5dde6d9 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -34,9 +34,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -54,9 +54,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 81b216117..72b30a0b3 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -34,9 +34,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn @@ -54,9 +54,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.x cache: yarn diff --git a/.gitignore b/.gitignore index af7dd576d..87f35bef7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,17 @@ -# MacOS .DS_Store -# Cli sac -# VSCode .vscode .trunk -# Node modules node_modules -# Environment files .env .env.dev +.env.prod -# Debug files backend/tests/api/__debug_* -.env.prod frontend/mobile/ios/ frontend/mobile/android/ @@ -25,3 +19,5 @@ tmp/ ios android .idea/modules.xml + +*_templ.go \ No newline at end of file diff --git a/backend/.dockerignore b/backend/.dockerignore index 59a45cc78..9ffcea7db 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -1,2 +1,4 @@ tests/ -docs/ \ No newline at end of file +docs/ +*.md +*.templ \ No newline at end of file diff --git a/backend/Dockerfile.server b/backend/Dockerfile.server index 8fa18c7b8..65261320d 100644 --- a/backend/Dockerfile.server +++ b/backend/Dockerfile.server @@ -1,15 +1,18 @@ -# syntax=docker/dockerfile:1 - -FROM golang:1.22.2 +FROM golang:1.22-alpine as builder WORKDIR /app +RUN apk add --no-cache make nodejs npm git -COPY go.mod go.sum ./ - -COPY *.go ./ +COPY . ./ +RUN go install github.com/a-h/templ/cmd/templ@latest +RUN templ generate +RUN go get ./... +RUN go mod tidy +RUN go mod download +RUN go build -tags prod -o bin/sac main.go -RUN CGO_ENABLED=0 GOOS=linux go build -v -o ./sac +FROM scratch +COPY --from=builder /app/bin/sac /sac EXPOSE 8080 - -CMD ["/sac"] \ No newline at end of file +ENTRYPOINT [ "./sac" ] \ No newline at end of file diff --git a/backend/templates/emails/layouts/base_templ.go b/backend/templates/emails/layouts/base_templ.go deleted file mode 100644 index 3689f140b..000000000 --- a/backend/templates/emails/layouts/base_templ.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.639 -package layouts - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import "context" -import "io" -import "bytes" - -func Base(title string, styles templ.Component) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/emails/layouts/base.templ`, Line: 7, Col: 17} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = styles.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} diff --git a/backend/templates/emails/verification.templ b/backend/templates/emails/verification.templ deleted file mode 100644 index fad4cff02..000000000 --- a/backend/templates/emails/verification.templ +++ /dev/null @@ -1,76 +0,0 @@ -package emails - -import ( - "github.com/GenerateNU/sac/backend/templates/emails/layouts" -) - -templ Verification(otp string) { - @layouts.Base("Welcome to Hippo! Verify your Email", verificationStyles()) { -
-

Welcome to Hippo

-

- Thank you for signing up! To unlock the full potential of your account - and start enjoying our services, please verify your email address by - typing the following code in the verification page: -

-

{ otp }

-

- If you didn't create an account with Hippo, please disregard this email. -

-

We look forward to having you on board!

-

Sincerely,

-

The Hippo Team

-
- } -} - -templ verificationStyles() { - -} diff --git a/backend/templates/emails/verification_templ.go b/backend/templates/emails/verification_templ.go deleted file mode 100644 index 25b8af044..000000000 --- a/backend/templates/emails/verification_templ.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.639 -package emails - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import "context" -import "io" -import "bytes" - -import ( - "github.com/GenerateNU/sac/backend/templates/emails/layouts" -) - -func Verification(otp string) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Welcome to Hippo

Thank you for signing up! To unlock the full potential of your account and start enjoying our services, please verify your email address by typing the following code in the verification page:

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(otp) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/emails/verification.templ`, Line: 16, Col: 19} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

If you didn't create an account with Hippo, please disregard this email.

We look forward to having you on board!

Sincerely,

The Hippo Team

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = layouts.Base("Welcome to Hippo! Verify your Email", verificationStyles()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} - -func verificationStyles() templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} diff --git a/backend/templates/emails/welcome_templ.go b/backend/templates/emails/welcome_templ.go deleted file mode 100644 index 2f3325b90..000000000 --- a/backend/templates/emails/welcome_templ.go +++ /dev/null @@ -1,89 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.639 -package emails - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import "context" -import "io" -import "bytes" - -import "github.com/GenerateNU/sac/backend/templates/emails/layouts" - -func Welcome(name string) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Welcome to Hippo ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(name) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/emails/welcome.templ`, Line: 8, Col: 30} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("!

Thank you for creating an account with us. We're excited to have you on board!

Your account is now active, and you can log in using your email address and password.

If you haven't already, we recommend that you complete your profile to get the most out of your Hippo experience.

To get started, you can visit our website at hipponeu.com.

If you have any questions or need assistance, please don't hesitate to contact us at generatesac@gmail.com.

We look forward to seeing you around!

Sincerely,

The Hippo Team

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = layouts.Base("Welcome to Hippo!", welcomeStyles()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} - -func welcomeStyles() templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} diff --git a/cli/cmd/format.go b/cli/cmd/format.go index 788f5cf6a..1800c7e98 100644 --- a/cli/cmd/format.go +++ b/cli/cmd/format.go @@ -102,7 +102,7 @@ var formatBackendCmd = &cobra.Command{ os.Exit(1) } - err = helpers.Execute(exec.Command("gofumpt", "-l", "-w", "."), helpers.BACKEND_DIR) + err = helpers.Execute(exec.Command("templ", "generate", "&&", "gofumpt", "-l", "-w", "."), helpers.BACKEND_DIR) if err != nil { fmt.Println(err) os.Exit(1) @@ -122,7 +122,7 @@ var formatCliCmd = &cobra.Command{ os.Exit(1) } - err = helpers.Execute(exec.Command("gofumpt", "-l", "-w", "."), helpers.CLI_DIR) + err = helpers.Execute(exec.Command("templ", "generate", "&&", "gofumpt", "-l", "-w", "."), helpers.CLI_DIR) if err != nil { fmt.Println(err) os.Exit(1) diff --git a/cli/cmd/lint.go b/cli/cmd/lint.go index c1115ce4f..f4ab19ab8 100644 --- a/cli/cmd/lint.go +++ b/cli/cmd/lint.go @@ -102,7 +102,7 @@ var lintBackendCmd = &cobra.Command{ os.Exit(1) } - err = helpers.Execute(exec.Command("golangci-lint", "run", "--fix", "--timeout=1m"), helpers.BACKEND_DIR) + err = helpers.Execute(exec.Command("templ", "generate", "&&", "golangci-lint", "run", "--fix", "--timeout=1m"), helpers.BACKEND_DIR) if err != nil { fmt.Println(err) os.Exit(1) @@ -122,7 +122,7 @@ var lintCliCmd = &cobra.Command{ os.Exit(1) } - err = helpers.Execute(exec.Command("golangci-lint", "run", "--fix", "--timeout=1m"), helpers.CLI_DIR) + err = helpers.Execute(exec.Command("templ", "generate", "&&", "golangci-lint", "run", "--fix", "--timeout=1m"), helpers.CLI_DIR) if err != nil { fmt.Println(err) os.Exit(1) diff --git a/cli/cmd/run.go b/cli/cmd/run.go index 09cc8eda5..8cfa88f18 100644 --- a/cli/cmd/run.go +++ b/cli/cmd/run.go @@ -40,7 +40,7 @@ var runBeCmd = &cobra.Command{ seedSearch, _ := cmd.Flags().GetBool("seed-search") if migrate { - err := helpers.Execute(exec.Command("go", "run", "main.go", "--only-migrate"), helpers.BACKEND_DIR) + err := helpers.Execute(exec.Command("templ", "generate", "&&", "go", "run", "main.go", "--only-migrate"), helpers.BACKEND_DIR) if err != nil { fmt.Println(err) os.Exit(1) @@ -48,7 +48,7 @@ var runBeCmd = &cobra.Command{ } if seedSearch { - err := helpers.Execute(exec.Command("go", "run", "main.go", "--seed-search"), helpers.BACKEND_DIR) + err := helpers.Execute(exec.Command("templ", "generate", "&&", "go", "run", "main.go", "--seed-search"), helpers.BACKEND_DIR) if err != nil { fmt.Println(err) os.Exit(1) diff --git a/cli/cmd/search.go b/cli/cmd/search.go index a290fbf4a..ed67f0236 100644 --- a/cli/cmd/search.go +++ b/cli/cmd/search.go @@ -13,7 +13,7 @@ var seedSearchCmd = &cobra.Command{ Use: "seed-search", Short: "Seed Search", Run: func(cmd *cobra.Command, args []string) { - err := helpers.Execute(exec.Command("go", "run", "main.go", "seed-search"), helpers.BACKEND_DIR) + err := helpers.Execute(exec.Command("templ", "generate", "&&", "go", "run", "main.go", "seed-search"), helpers.BACKEND_DIR) if err != nil { fmt.Println(err) os.Exit(1) diff --git a/cli/cmd/test.go b/cli/cmd/test.go index 91a8c1f64..e3f5bba51 100644 --- a/cli/cmd/test.go +++ b/cli/cmd/test.go @@ -100,7 +100,7 @@ var testBackendCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { clear, _ := cmd.Flags().GetBool("clean") - err := helpers.Execute(exec.Command("go", "test", "-v", "-race", "./..."), helpers.BACKEND_DIR) + err := helpers.Execute(exec.Command("templ", "generate", "&&", "go", "test", "-v", "-race", "./..."), helpers.BACKEND_DIR) if err != nil { fmt.Println(err) } @@ -120,7 +120,7 @@ var testCliCmd = &cobra.Command{ Short: "CLI testing commands", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - err := helpers.Execute(exec.Command("go", "test", "-v", "-race", "./..."), helpers.CLI_DIR) + err := helpers.Execute(exec.Command("templ", "generate", "&&", "go", "test", "-v", "-race", "./..."), helpers.CLI_DIR) if err != nil { fmt.Println(err) os.Exit(1) diff --git a/cli/helpers/backend.go b/cli/helpers/backend.go index 34cbf1eb8..283a88b0d 100644 --- a/cli/helpers/backend.go +++ b/cli/helpers/backend.go @@ -16,7 +16,7 @@ func RunBackend() error { return fmt.Errorf("error initializing redis: %w", err) } - err = Execute(exec.Command("go", "run", "main.go"), BACKEND_DIR) + err = Execute(exec.Command("templ", "generate", "&&", "go", "run", "main.go"), BACKEND_DIR) if err != nil { return fmt.Errorf("error running backend: %w", err) } diff --git a/cli/helpers/database.go b/cli/helpers/database.go index ad2951c00..f365b7d4e 100644 --- a/cli/helpers/database.go +++ b/cli/helpers/database.go @@ -123,7 +123,7 @@ func InsertDB() error { if !exists { fmt.Println("Database does not exist or has no tables. Running database migration.") - migrateCmd := exec.Command("go", "run", "main.go", "--only-migrate") + migrateCmd := exec.Command("templ", "generate", "&&", "go", "run", "main.go", "--only-migrate") migrateCmd.Dir = BACKEND_DIR diff --git a/go.work.sum b/go.work.sum index d98dc8c5b..16a0105eb 100644 --- a/go.work.sum +++ b/go.work.sum @@ -29,6 +29,8 @@ cloud.google.com/go/cloudtasks v1.12.4/go.mod h1:BEPu0Gtt2dU6FxZHNqqNdGqIG86qyWK cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute v1.23.1/go.mod h1:CqB3xpmPKKt3OJpW2ndFIXnA9A4xAy/F3Xp1ixncW78= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/contactcenterinsights v1.11.3/go.mod h1:HHX5wrz5LHVAwfI2smIotQG9x8Qd6gYilaHcLLLmNis= cloud.google.com/go/container v1.27.1/go.mod h1:b1A1gJeTBXVLQ6GGw9/9M4FG94BEGsqJ5+t4d/3N7O4= cloud.google.com/go/containeranalysis v0.11.3/go.mod h1:kMeST7yWFQMGjiG9K7Eov+fPNQcGhb8mXj/UcTiWw9U= @@ -275,6 +277,7 @@ github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EO github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= @@ -479,6 +482,7 @@ github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCO github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b h1:7gd+rd8P3bqcn/96gOZa3F5dpJr/vEiDQYlNb/y2uNs= @@ -580,6 +584,7 @@ google.golang.org/api v0.150.0/go.mod h1:ccy+MJ6nrYFgE3WgRx/AMXOxOmU8Q4hSa+jjibz google.golang.org/api v0.152.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= google.golang.org/api v0.153.0 h1:N1AwGhielyKFaUqH07/ZSIQR3uNPcV7NVw0vj+j4iR4= google.golang.org/api v0.153.0/go.mod h1:3qNJX5eOmhiWYc67jRA/3GsDw97UFb5ivv7Y2PrriAY= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= @@ -602,6 +607,7 @@ google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= lukechampine.com/frand v1.4.2/go.mod h1:4S/TM2ZgrKejMcKMbeLjISpJMO+/eZ1zu3vYX9dtj3s=