Files
pgbackweb/taskfile.yaml

154 lines
3.4 KiB
YAML

version: "3"
dotenv: [".env"]
interval: 500ms
tasks:
on:
desc: Start development environment, should be run from the host machine
cmds:
- docker compose -f ./docker/compose.dev.yaml up -d --build
- docker compose -f ./docker/compose.dev.yaml exec app /bin/bash
off:
desc: Stop development environment, should be run from the host machine
cmd: docker compose -f ./docker/compose.dev.yaml down
dev:
desc: Build and serve the project with hot reloading
watch: true
sources:
- "**/*.go"
- "**/*.sql"
- "**/*.js"
- "**/*.css"
- "**/*.json"
- exclude: "./.git/**"
- exclude: "./node_modules/**"
- exclude: "./internal/database/dbgen/**"
- exclude: "./internal/view/static/build/**"
- exclude: "./temp/**"
- exclude: "./tmp/**"
- exclude: "./dist/**"
- exclude: "**/*.test.go"
- exclude: "**/*.generated.go"
- exclude: "**/*.sql.go"
- exclude: "**/*.gen.go"
- exclude: "**/*.gen.sql"
- exclude: "**/*.min.css"
- exclude: "**/*.min.js"
deps:
- build
cmds:
- ./dist/app
build:
desc: Build the project
deps:
- gen-db
- build-static
cmds:
- go build -o ./dist/app ./cmd/app/.
- go build -o ./dist/change-password ./cmd/changepw/.
serve:
desc: Serve the built project
cmd: ./dist/app
migrate-serve:
desc: Run migrations and then serve the built project
cmds:
- task goose -- up
- task serve
run:
desc: Build the project and then serve it
cmds:
- task build
- task serve
goose:
desc: Run goose commands Ex. task goose -- up
silent: true
cmd: >
goose
-dir ./internal/database/migrations
postgres "{{.PBW_POSTGRES_CONN_STRING}}"
{{.CLI_ARGS}}
gen-db:
desc: Generate sqlc files
silent: true
cmds:
- ./scripts/sqlc-prebuild.mjs
- sqlc generate
sources:
- ./internal/service/**/*.sql
generates:
- ./internal/database/queries.gen.sql
- ./internal/database/dbgen/*.go
reset-db:
desc: Reset the database
cmd: go run ./cmd/resetdb/.
build-static:
desc: Build the static files (css and js)
silent: true
cmds:
- >
npm run tailwindcss --
--minify
--config ./tailwind.config.js
--input ./internal/view/static/css/style.css
--output ./internal/view/static/build/style.min.css
- ./scripts/build-js.mjs
tidy:
desc: Tidy the go.mod file
cmd: go mod tidy
fmt:
desc: Format the go and js files
cmds:
- go fmt ./...
- npm run standard -- --fix
lint-only:
desc: Lint the go and js files
cmds:
- task gen-db
- golangci-lint run ./...
- npm run standard
test-only:
desc: Run the tests
cmds:
- task gen-db
- go test ./...
check-deps:
desc: Check if all required dependencies are installed
silent: true
cmds:
- chmod +x ./scripts/check_deps.sh
- ./scripts/check_deps.sh
test:
desc: Run the checks, linters and tests
cmds:
- task check-deps
- task lint-only
- task test-only
clean:
desc: Clean the temporary and distribution folders
cmds:
- rm -rf ./tmp
- rm -rf ./dist
fixperms:
desc: Fixes the permissions of the files in the project
cmd: chmod -R 777 ./