From d50cdc4c2d70be9f2490fd39a5e00ddb4d4e76b8 Mon Sep 17 00:00:00 2001 From: Jonathan Yen Date: Sun, 9 Nov 2025 14:48:57 -0500 Subject: [PATCH 1/3] Allow task dev to run without go/bin --- Taskfile.yml | 19 ++++++++++++------- package-lock.json | 7 ++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 2d0a563..d3adfc9 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,9 +1,14 @@ version: '3' +set: + - pipefail + # Load env/development.env by default, but allow it to be overridden by setting ENV like `ENV=production task ` +dotenv: ['env/{{.ENV}}.env'] env: ENV: "{{.ENV | default \"development\"}}" -dotenv: ['env/{{.ENV}}.env'] + GOBIN: + sh: go env GOPATH tasks: @@ -16,8 +21,8 @@ tasks: # Do an initial build of the frontend assets to ensure that when we build the Go app, embed succeeds - npx vite build - go install - - if [[ ! $(command -v air) ]]; then go install github.com/air-verse/air@v1.52.2; fi - - if [[ ! $(command -v atlas) ]]; then curl -sSf https://atlasgo.sh | sh -s -- -y; fi + - export PATH="{{.GOBIN}}/bin:$PATH" && if [[ ! $(command -v air) ]]; then go install github.com/air-verse/air@v1.52.2; fi + - export PATH="{{.GOBIN}}/bin:$PATH" && if [[ ! $(command -v atlas) ]]; then curl -sSf https://atlasgo.sh | sh -s -- -y; fi - task: "db:up" - task: "db:apply" - task: "db:seed" @@ -31,7 +36,7 @@ tasks: cmds: # Sometimes the previous process doesn't get killed properly, ensure it's gone - pkill kbexample || true - - air {{.CLI_ARGS}} + - export PATH="{{.GOBIN}}/bin:$PATH" && air {{.CLI_ARGS}} dev:frontend: cmds: @@ -41,7 +46,7 @@ tasks: desc: Run the backend with dlv for debugging cmds: - npx vite build - - dlv debug . + - export PATH="{{.GOBIN}}/bin:$PATH" && dlv debug . test: desc: "Run tests (hint: use -w to test continuously)" @@ -74,12 +79,12 @@ tasks: db:apply: desc: Ensure any changes in the schema.sql file are applied to the dev database cmds: - - atlas schema apply --to file://schema.sql --url "postgresql:///kbexample_dev" --dev-url "postgresql:///atlas_dev" + - export PATH="{{.GOBIN}}/bin:$PATH" && atlas schema apply --to file://schema.sql --url "postgresql:///kbexample_dev" --dev-url "postgresql:///atlas_dev" db:gen-migration: desc: Create a migration file based on the changes made to schema.sql cmds: - - atlas migrate diff {{.CLI_ARGS}} --dir "file://migrations" --to file://schema.sql --dev-url "postgresql:///atlas_dev" + - export PATH="{{.GOBIN}}/bin:$PATH" && atlas migrate diff {{.CLI_ARGS}} --dir "file://migrations" --to file://schema.sql --dev-url "postgresql:///atlas_dev" db:shell: desc: Open a psql shell to the database diff --git a/package-lock.json b/package-lock.json index a9e00a7..b2aeb49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1352,9 +1352,10 @@ } }, "node_modules/vite": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", - "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", + "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", + "license": "MIT", "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", From 7e61fcd888220151dbda236a4d4bf59aacaad61b Mon Sep 17 00:00:00 2001 From: Jonathan Yen Date: Mon, 10 Nov 2025 08:26:36 -0500 Subject: [PATCH 2/3] display warning and recommended fix when air is not executable --- Taskfile.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index d3adfc9..5410927 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -4,11 +4,9 @@ set: - pipefail # Load env/development.env by default, but allow it to be overridden by setting ENV like `ENV=production task ` -dotenv: ['env/{{.ENV}}.env'] env: ENV: "{{.ENV | default \"development\"}}" - GOBIN: - sh: go env GOPATH +dotenv: ['env/{{.ENV}}.env'] tasks: @@ -21,8 +19,9 @@ tasks: # Do an initial build of the frontend assets to ensure that when we build the Go app, embed succeeds - npx vite build - go install - - export PATH="{{.GOBIN}}/bin:$PATH" && if [[ ! $(command -v air) ]]; then go install github.com/air-verse/air@v1.52.2; fi - - export PATH="{{.GOBIN}}/bin:$PATH" && if [[ ! $(command -v atlas) ]]; then curl -sSf https://atlasgo.sh | sh -s -- -y; fi + - if [[ ! $(command -v air) ]]; then go install github.com/air-verse/air@v1.52.2; fi + - "if [[ ! $(command -v air) ]]; then echo \"WARNING: Attempted to go install the air command, but it still could not be found; to fix this, try adding ~/bin/go to your PATH like so: go env GOPATH >> .zshrc\"; fi" + - if [[ ! $(command -v atlas) ]]; then curl -sSf https://atlasgo.sh | sh -s -- -y; fi - task: "db:up" - task: "db:apply" - task: "db:seed" @@ -36,7 +35,7 @@ tasks: cmds: # Sometimes the previous process doesn't get killed properly, ensure it's gone - pkill kbexample || true - - export PATH="{{.GOBIN}}/bin:$PATH" && air {{.CLI_ARGS}} + - air {{.CLI_ARGS}} dev:frontend: cmds: @@ -46,7 +45,7 @@ tasks: desc: Run the backend with dlv for debugging cmds: - npx vite build - - export PATH="{{.GOBIN}}/bin:$PATH" && dlv debug . + - dlv debug . test: desc: "Run tests (hint: use -w to test continuously)" @@ -79,12 +78,12 @@ tasks: db:apply: desc: Ensure any changes in the schema.sql file are applied to the dev database cmds: - - export PATH="{{.GOBIN}}/bin:$PATH" && atlas schema apply --to file://schema.sql --url "postgresql:///kbexample_dev" --dev-url "postgresql:///atlas_dev" + - atlas schema apply --to file://schema.sql --url "postgresql:///kbexample_dev" --dev-url "postgresql:///atlas_dev" db:gen-migration: desc: Create a migration file based on the changes made to schema.sql cmds: - - export PATH="{{.GOBIN}}/bin:$PATH" && atlas migrate diff {{.CLI_ARGS}} --dir "file://migrations" --to file://schema.sql --dev-url "postgresql:///atlas_dev" + - atlas migrate diff {{.CLI_ARGS}} --dir "file://migrations" --to file://schema.sql --dev-url "postgresql:///atlas_dev" db:shell: desc: Open a psql shell to the database From 5fd4aef957fcec492decda6a245dda358c1528a4 Mon Sep 17 00:00:00 2001 From: Jonathan Yen Date: Mon, 10 Nov 2025 08:59:25 -0500 Subject: [PATCH 3/3] revert package-lock.json, remove unneeded directive --- Taskfile.yml | 3 --- package-lock.json | 7 +++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 5410927..04990b8 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,8 +1,5 @@ version: '3' -set: - - pipefail - # Load env/development.env by default, but allow it to be overridden by setting ENV like `ENV=production task ` env: ENV: "{{.ENV | default \"development\"}}" diff --git a/package-lock.json b/package-lock.json index b2aeb49..a9e00a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1352,10 +1352,9 @@ } }, "node_modules/vite": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", - "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", - "license": "MIT", + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", + "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4",