update taskfile to fix code-gen caches and use 'dir' attribute

This commit is contained in:
Hayden 2023-03-08 07:05:37 -09:00
parent 6a14d1f78e
commit 8c50942716
No known key found for this signature in database
GPG key ID: 17CF79474E257545

View file

@ -27,47 +27,47 @@ tasks:
--modular \ --modular \
--path ./backend/app/api/static/docs/swagger.json \ --path ./backend/app/api/static/docs/swagger.json \
--output ./frontend/lib/api/types --output ./frontend/lib/api/types
- go run ./scripts/process-types/*.go ./frontend/lib/api/types/data-contracts.ts - go run ./backend/app/tools/typegen/main.go ./frontend/lib/api/types/data-contracts.ts
- cp ./backend/app/api/static/docs/swagger.json docs/docs/api/openapi-2.0.json - cp ./backend/app/api/static/docs/swagger.json docs/docs/api/openapi-2.0.json
sources: sources:
- "./backend/app/api/**/*" - "./backend/app/api/**/*"
- "./backend/internal/data/**" - "./backend/internal/data/**"
- "./backend/internal/services/**/*" - "./backend/internal/core/services/**/*"
- "./scripts/process-types.py" - "./backend/app/tools/typegen/main.go"
generates:
- "./frontend/lib/api/types/data-contracts.ts"
- "./backend/internal/data/ent/schema"
- "./backend/app/api/static/docs/swagger.json"
- "./backend/app/api/static/docs/swagger.yaml"
go:run: go:run:
desc: Starts the backend api server (depends on generate task) desc: Starts the backend api server (depends on generate task)
dir: backend
deps: deps:
- generate - generate
cmds: cmds:
- cd backend && go run ./app/api/ {{ .CLI_ARGS }} - go run ./app/api/ {{ .CLI_ARGS }}
silent: false silent: false
go:test: go:test:
desc: Runs all go tests using gotestsum - supports passing gotestsum args desc: Runs all go tests using gotestsum - supports passing gotestsum args
dir: backend
cmds: cmds:
- cd backend && gotestsum {{ .CLI_ARGS }} ./... - gotestsum {{ .CLI_ARGS }} ./...
go:coverage: go:coverage:
desc: Runs all go tests with -race flag and generates a coverage report desc: Runs all go tests with -race flag and generates a coverage report
dir: backend
cmds: cmds:
- cd backend && go test -race -coverprofile=coverage.out -covermode=atomic ./app/... ./internal/... ./pkgs/... -v -cover - go test -race -coverprofile=coverage.out -covermode=atomic ./app/... ./internal/... ./pkgs/... -v -cover
silent: true silent: true
go:tidy: go:tidy:
desc: Runs go mod tidy on the backend desc: Runs go mod tidy on the backend
dir: backend
cmds: cmds:
- cd backend && go mod tidy - go mod tidy
go:lint: go:lint:
desc: Runs golangci-lint desc: Runs golangci-lint
dir: backend
cmds: cmds:
- cd backend && golangci-lint run ./... - golangci-lint run ./...
go:all: go:all:
desc: Runs all go test and lint related tasks desc: Runs all go test and lint related tasks
@ -78,19 +78,19 @@ tasks:
go:build: go:build:
desc: Builds the backend binary desc: Builds the backend binary
dir: backend
cmds: cmds:
- cd backend && go build -o ../build/backend ./app/api - go build -o ../build/backend ./app/api
db:generate: db:generate:
desc: Run Entgo.io Code Generation desc: Run Entgo.io Code Generation
dir: backend/internal/
cmds: cmds:
- | - |
cd backend/internal/ && go generate ./... \ go generate ./... \
--template=./data/ent/schema/templates/has_id.tmpl --template=./data/ent/schema/templates/has_id.tmpl
sources: sources:
- "./backend/internal/data/ent/schema/**/*" - "./backend/internal/data/ent/schema/**/*"
generates:
- "./backend/internal/ent/"
db:migration: db:migration:
desc: Runs the database diff engine to generate a SQL migration files desc: Runs the database diff engine to generate a SQL migration files
@ -101,23 +101,27 @@ tasks:
ui:watch: ui:watch:
desc: Starts the vitest test runner in watch mode desc: Starts the vitest test runner in watch mode
dir: frontend
cmds: cmds:
- cd frontend && pnpm run test:watch - pnpm run test:watch
ui:dev: ui:dev:
desc: Run frontend development server desc: Run frontend development server
dir: frontend
cmds: cmds:
- cd frontend && pnpm dev - pnpm dev
ui:fix: ui:fix:
desc: Runs prettier and eslint on the frontend desc: Runs prettier and eslint on the frontend
dir: frontend
cmds: cmds:
- cd frontend && pnpm run lint:fix - pnpm run lint:fix
ui:check: ui:check:
desc: Runs type checking desc: Runs type checking
dir: frontend
cmds: cmds:
- cd frontend && pnpm run typecheck - pnpm run typecheck
test:ci: test:ci:
desc: Runs end-to-end test on a live server (only for use in CI) desc: Runs end-to-end test on a live server (only for use in CI)