aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile18
-rw-r--r--backend/Makefile10
-rw-r--r--backend/gen/gen.go4
-rw-r--r--backend/gen/oapi-codegen.yaml (renamed from backend/oapi-codegen.yaml)2
-rw-r--r--backend/gen/sqlc.yaml (renamed from backend/sqlc.yaml)6
-rw-r--r--frontend/Makefile3
-rw-r--r--frontend/package.json1
7 files changed, 16 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 7adf808..2361ac5 100644
--- a/Makefile
+++ b/Makefile
@@ -52,17 +52,7 @@ initdb:
make psql-query < ./backend/schema.sql
make psql-query < ./backend/fixtures/dev.sql
-.PHONY: openapi
-openapi: oapi-codegen openapi-typescript
-
-.PHONY: oapi-codegen
-oapi-codegen:
- cd backend; make oapi-codegen
-
-.PHONY: openapi-typescript
-openapi-typescript:
- cd frontend; make openapi-typescript
-
-.PHONY: sqlc
-sqlc:
- cd backend; make sqlc
+.PHONY: gen
+gen:
+ cd backend; make gen
+ cd frontend; npm run openapi-typescript
diff --git a/backend/Makefile b/backend/Makefile
index 3b26e00..72d3314 100644
--- a/backend/Makefile
+++ b/backend/Makefile
@@ -10,10 +10,6 @@ check:
lint:
go vet ./...
-.PHONY: oapi-codegen
-oapi-codegen:
- go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -config oapi-codegen.yaml ../openapi.yaml
-
-.PHONY: sqlc
-sqlc:
- go run github.com/sqlc-dev/sqlc/cmd/sqlc generate
+.PHONY: gen
+gen:
+ go generate ./...
diff --git a/backend/gen/gen.go b/backend/gen/gen.go
new file mode 100644
index 0000000..6af912d
--- /dev/null
+++ b/backend/gen/gen.go
@@ -0,0 +1,4 @@
+package main
+
+//go:generate go run github.com/sqlc-dev/sqlc/cmd/sqlc generate
+//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -config oapi-codegen.yaml ../../openapi.yaml
diff --git a/backend/oapi-codegen.yaml b/backend/gen/oapi-codegen.yaml
index 65cf079..d235096 100644
--- a/backend/oapi-codegen.yaml
+++ b/backend/gen/oapi-codegen.yaml
@@ -4,7 +4,7 @@ generate:
echo-server: true
strict-server: true
embedded-spec: true
-output: api/generated.go
+output: ../api/generated.go
output-options:
skip-prune: true
nullable-type: true
diff --git a/backend/sqlc.yaml b/backend/gen/sqlc.yaml
index 3b2d1d0..c56e44b 100644
--- a/backend/sqlc.yaml
+++ b/backend/gen/sqlc.yaml
@@ -1,11 +1,11 @@
version: "2"
sql:
- engine: "postgresql"
- queries: "query.sql"
- schema: "schema.sql"
+ queries: "../query.sql"
+ schema: "../schema.sql"
gen:
go:
package: "db"
- out: "db"
+ out: "../db"
sql_package: "pgx/v5"
emit_pointers_for_null_types: true
diff --git a/frontend/Makefile b/frontend/Makefile
deleted file mode 100644
index 17dd690..0000000
--- a/frontend/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-.PHONY: openapi-typescript
-openapi-typescript:
- npx --no-install openapi-typescript --path-params-as-types --output ./app/.server/api/schema.d.ts ../openapi.yaml
diff --git a/frontend/package.json b/frontend/package.json
index aefb693..ff25a86 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -7,6 +7,7 @@
"build": "remix vite:build",
"dev": "remix vite:dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
+ "openapi-typescript": "npx --no-install openapi-typescript --path-params-as-types --output ./app/.server/api/schema.d.ts ../openapi.yaml",
"start": "remix-serve ./build/server/index.js",
"typecheck": "tsc"
},