Bluemage/Makefile

44 lines
1.2 KiB
Makefile
Raw Normal View History

2024-08-04 23:16:05 +07:00
.ONESHELL:
export PATH := $(shell pwd)/bin:$(shell pwd)/web/node_modules/.bin:$(PATH)
2024-08-05 23:06:32 +07:00
export GOOSE_DRIVER ?= sqlite3
export GOOSE_DBSTRING ?= ./go/data.db
export GOOSE_MIGRATION_DIR ?= schemas/migrations
2024-08-16 14:38:57 +07:00
export GOFLAGS=-tags=fts5
2024-08-04 23:16:05 +07:00
build: generate-go generate-web
go build -o bin/bluemage ./go/cmd/bluemage/main.go
2024-08-07 10:41:00 +07:00
run:
cd go && air
run-web: generate-web
cd web && npm run dev
2024-08-05 23:06:32 +07:00
generate-go: migrate
2024-08-19 21:16:22 +07:00
@rm -rf go/gen/*
ogen -target go/gen/reddit -package reddit -clean schemas/openapi/reddit.yaml 2>&1 | grep -v INFO
jet -source=sqlite -dsn="./go/data.db" -path="./go/gen/jet" | grep -v "Unsupported sql column"
2024-08-05 23:06:32 +07:00
(cd ./schemas/proto && buf generate --template buf.gen.go.yaml .)
2024-08-19 21:16:22 +07:00
(cd go/gen && bobgen-sqlite --config ../bobgen.yaml 2>&1 | grep -v bytes | grep -v SKIPPED)
2024-08-07 23:59:29 +07:00
(cd go && goverter gen -g 'output:file ../gen/converter/converter.go' -g 'output:package github.com/tigorlazuardi/bluemage/go/gen/converter' ./converts)
2024-08-04 23:16:05 +07:00
generate-web:
rm -rf web/gen
cd ./schemas/proto
buf generate --template buf.gen.web.yaml .
migrate:
@goose up
migrate-new:
@read -p "Name new migration: " name
if [[ $$name ]]; then goose create "$$name" sql; fi
migrate-redo:
@goose redo
migrate-down:
@goose down