forked from mirrors/homebox
8ba954674e
* enable atlas migrations * use embedded atlas migrations * chores * bad migration example * tidy * fix linter issues * reset migration state * sort slice before testing * move temp write logic to migrations package
94 lines
2.3 KiB
YAML
94 lines
2.3 KiB
YAML
version: "3"
|
|
|
|
env:
|
|
HBOX_STORAGE_SQLITE_URL: .data/homebox.db?_fk=1
|
|
|
|
tasks:
|
|
generate:
|
|
desc: |
|
|
Generates collateral files from the backend project
|
|
including swagger docs and typescripts type for the frontend
|
|
deps:
|
|
- db:generate
|
|
cmds:
|
|
- cd backend/app/api/ && swag fmt
|
|
- cd backend/app/api/ && swag init --dir=./,../../internal,../../pkgs
|
|
- |
|
|
npx swagger-typescript-api \
|
|
--no-client \
|
|
--modular \
|
|
--path ./backend/app/api/docs/swagger.json \
|
|
--output ./frontend/lib/api/types
|
|
|
|
python3 ./scripts/process-types.py ./frontend/lib/api/types/data-contracts.ts
|
|
sources:
|
|
- "./backend/app/api/**/*"
|
|
- "./backend/app/internal/types/**/*"
|
|
- "./scripts/process-types.py"
|
|
generates:
|
|
- "./frontend/lib/api/types/data-contracts.ts"
|
|
- "./backend/app/api/docs/swagger.json"
|
|
- "./backend/app/api/docs/swagger.yaml"
|
|
|
|
api:
|
|
desc: Starts the backend api server (depends on generate task)
|
|
deps:
|
|
- generate
|
|
cmds:
|
|
- cd backend && go run ./app/api/ {{ .CLI_ARGS }}
|
|
silent: false
|
|
|
|
api:build:
|
|
cmds:
|
|
- cd backend && go build ./app/api/
|
|
silent: true
|
|
|
|
api:test:
|
|
cmds:
|
|
- cd backend && go test ./app/api/
|
|
silent: true
|
|
|
|
api:watch:
|
|
cmds:
|
|
- cd backend && gotestsum --watch ./...
|
|
|
|
api:coverage:
|
|
cmds:
|
|
- cd backend && go test -race -coverprofile=coverage.out -covermode=atomic ./app/... ./internal/... ./pkgs/... -v -cover
|
|
silent: true
|
|
|
|
test:ci:
|
|
cmds:
|
|
- cd backend && go build ./app/api
|
|
- backend/api &
|
|
- sleep 5
|
|
- cd frontend && pnpm run test:ci
|
|
silent: true
|
|
|
|
frontend:watch:
|
|
desc: Starts the vitest test runner in watch mode
|
|
cmds:
|
|
- cd frontend && pnpm vitest --watch
|
|
|
|
frontend:
|
|
desc: Run frontend development server
|
|
cmds:
|
|
- cd frontend && pnpm dev
|
|
|
|
db:generate:
|
|
desc: Run Entgo.io Code Generation
|
|
cmds:
|
|
- |
|
|
cd backend && go generate ./... \
|
|
--template=ent/schema/templates/has_id.tmpl
|
|
sources:
|
|
- "./backend/ent/schema/**/*"
|
|
generates:
|
|
- "./backend/ent/"
|
|
|
|
db:migration:
|
|
desc: Runs the database diff engine to generate a SQL migration files
|
|
deps:
|
|
- db:generate
|
|
cmds:
|
|
- cd backend && go run app/migrations/main.go {{ .CLI_ARGS }}
|