2022-08-30 02:30:36 +00:00
|
|
|
version: "3"
|
|
|
|
|
2022-09-28 04:26:44 +00:00
|
|
|
env:
|
|
|
|
HBOX_STORAGE_SQLITE_URL: .data/homebox.db?_fk=1
|
|
|
|
|
2022-08-30 02:30:36 +00:00
|
|
|
tasks:
|
2022-09-12 22:47:27 +00:00
|
|
|
generate:
|
2022-09-24 19:33:38 +00:00
|
|
|
desc: |
|
|
|
|
Generates collateral files from the backend project
|
|
|
|
including swagger docs and typescripts type for the frontend
|
2022-09-28 04:26:44 +00:00
|
|
|
deps:
|
|
|
|
- db:generate
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
|
|
|
- cd backend/app/api/ && swag fmt
|
2022-09-12 22:47:27 +00:00
|
|
|
- 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
|
2022-09-24 19:33:38 +00:00
|
|
|
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"
|
|
|
|
|
2022-09-12 22:47:27 +00:00
|
|
|
api:
|
2022-09-24 19:33:38 +00:00
|
|
|
desc: Starts the backend api server (depends on generate task)
|
|
|
|
deps:
|
|
|
|
- generate
|
2022-09-12 22:47:27 +00:00
|
|
|
cmds:
|
2022-09-24 19:33:38 +00:00
|
|
|
- cd backend && go run ./app/api/ {{ .CLI_ARGS }}
|
2022-08-30 02:30:36 +00:00
|
|
|
silent: false
|
|
|
|
|
|
|
|
api:build:
|
|
|
|
cmds:
|
|
|
|
- cd backend && go build ./app/api/
|
|
|
|
silent: true
|
|
|
|
|
|
|
|
api:test:
|
|
|
|
cmds:
|
|
|
|
- cd backend && go test ./app/api/
|
|
|
|
silent: true
|
|
|
|
|
2022-09-12 22:47:27 +00:00
|
|
|
api:watch:
|
|
|
|
cmds:
|
|
|
|
- cd backend && gotestsum --watch ./...
|
|
|
|
|
2022-08-30 02:30:36 +00:00
|
|
|
api:coverage:
|
|
|
|
cmds:
|
|
|
|
- cd backend && go test -race -coverprofile=coverage.out -covermode=atomic ./app/... ./internal/... ./pkgs/... -v -cover
|
|
|
|
silent: true
|
|
|
|
|
2022-09-09 19:34:19 +00:00
|
|
|
test:ci:
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-09-04 03:06:55 +00:00
|
|
|
- cd backend && go build ./app/api
|
|
|
|
- backend/api &
|
2022-08-30 02:30:36 +00:00
|
|
|
- sleep 5
|
2022-09-04 02:42:03 +00:00
|
|
|
- cd frontend && pnpm run test:ci
|
2022-08-30 02:30:36 +00:00
|
|
|
silent: true
|
|
|
|
|
2022-09-12 22:47:27 +00:00
|
|
|
frontend:watch:
|
|
|
|
desc: Starts the vitest test runner in watch mode
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-09-12 22:47:27 +00:00
|
|
|
- cd frontend && pnpm vitest --watch
|
2022-08-30 02:30:36 +00:00
|
|
|
|
2022-09-12 22:47:27 +00:00
|
|
|
frontend:
|
|
|
|
desc: Run frontend development server
|
2022-08-30 02:30:36 +00:00
|
|
|
cmds:
|
2022-09-12 22:47:27 +00:00
|
|
|
- cd frontend && pnpm dev
|
2022-09-28 04:26:44 +00:00
|
|
|
|
|
|
|
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 }}
|