chore(contributing): improve onboarding (#3)

- shell scripts logging and fail on error
- use npx --yes instead of manual global install
- run go libs directly instead of installing and running binaries
- add missing brew dependencies
This commit is contained in:
Luca Steeb
2023-12-19 01:36:48 +07:00
committed by GitHub
parent 1f470da954
commit 6fef81eb52
22 changed files with 49 additions and 30 deletions

View File

@@ -10,10 +10,7 @@
- The following additional devtools:
- `protoc`: `brew install protobuf`
- `sqlc`: `brew install sqlc`
- `deepmap/oapi-codegen`: `go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@latest`
- `swagger-cli`: `npm list -g @apidevtools/swagger-cli || npm install -g @apidevtools/swagger-cli`
- `nodemon`: `npm list -g nodemon || npm install -g nodemon`
- `turbo`: `npm list -g turbo || npm i -g turbo`
- `caddy` and `nss`: `brew install caddy nss`
### Setup

View File

@@ -1,9 +1,9 @@
app.dev.hatchet-tools.com {
tls internal
handle /api/* {
reverse_proxy localhost:8080
}
handle /api/* {
reverse_proxy localhost:8080
}
handle /* {
reverse_proxy localhost:5173

View File

@@ -58,7 +58,7 @@ tasks:
- sh ./hack/dev/proto.sh
generate-sqlc:
cmds:
- npx prisma migrate diff --from-empty --to-schema-datasource prisma/schema.prisma --script > internal/repository/prisma/dbsqlc/schema.sql
- npx --yes prisma migrate diff --from-empty --to-schema-datasource prisma/schema.prisma --script > internal/repository/prisma/dbsqlc/schema.sql
- sqlc generate --file internal/repository/prisma/dbsqlc/sqlc.yaml
kill-query-engines:
cmds:

3
go.mod
View File

@@ -87,6 +87,5 @@ require (
google.golang.org/grpc v1.58.2
google.golang.org/protobuf v1.31.0
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1 // indirect
gopkg.in/yaml.v3 v3.0.1
)

2
go.sum
View File

@@ -631,8 +631,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -1,6 +1,8 @@
#!/bin/bash
# This scripts generates test keys and certificates for the sample.
set -eux
CERTS_DIR=./certs
# Read CERTS_DIR from args if exists

View File

@@ -1,5 +1,7 @@
#!/bin/sh
set -eux
# run:
# ./manage-etc-hosts.sh add 10.20.1.2 test.com
# ./manage-etc-hosts.sh remove 10.20.1.2 test.com

View File

@@ -2,6 +2,11 @@
#
# Builds auto-generated protobuf files
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
export PATH="$PATH:$(go env GOPATH)/bin"
protoc --proto_path=api-contracts/dispatcher --go_out=./internal/services/dispatcher/contracts --go_opt=paths=source_relative \
--go-grpc_out=./internal/services/dispatcher/contracts --go-grpc_opt=paths=source_relative \
dispatcher.proto

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -eux
set -a
. .env
set +a

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -eux
set -a
. .env
set +a

View File

@@ -1,9 +1,11 @@
#!/bin/bash
set -eux
caddy start
set -a
. .env
set +a
nodemon --signal SIGINT --config nodemon.api.json --exec go run ./cmd/hatchet-api
npx --yes nodemon --signal SIGINT --config nodemon.api.json --exec go run ./cmd/hatchet-api

View File

@@ -1,7 +1,9 @@
#!/bin/bash
set -eux
set -a
. .env
set +a
nodemon --signal SIGINT --config nodemon.engine.json --exec go run ./cmd/hatchet-engine
npx --yes nodemon --signal SIGINT --config nodemon.engine.json --exec go run ./cmd/hatchet-engine

View File

@@ -1,3 +1,5 @@
#!/bin/bash
set -eux
cd ./frontend/app && npm run dev

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -eux
set -a
. .env
set +a

View File

@@ -1,3 +1,5 @@
#!/bin/bash
set -eux
cd frontend && (npx swagger-typescript-api -p ../bin/oas/openapi.yaml -o ./app/src/lib/api/generated -n hatchet.ts --modular --axios || cd ..)

View File

@@ -1,4 +1,6 @@
#!/bin/bash
swagger-cli bundle ./api-contracts/openapi/openapi.yaml --outfile bin/oas/openapi.yaml --type yaml
oapi-codegen -config ./api/v1/server/oas/gen/codegen.yaml ./bin/oas/openapi.yaml
set -eux
npx --yes swagger-cli bundle ./api-contracts/openapi/openapi.yaml --outfile bin/oas/openapi.yaml --type yaml
go run github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@latest -config ./api/v1/server/oas/gen/codegen.yaml ./bin/oas/openapi.yaml

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.19.3
// protoc-gen-go v1.28.1
// protoc v4.25.1
// source: workflows.proto
package contracts

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.3
// - protoc v4.25.1
// source: workflows.proto
package contracts

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.19.3
// protoc-gen-go v1.28.1
// protoc v4.25.1
// source: dispatcher.proto
package contracts

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.3
// - protoc v4.25.1
// source: dispatcher.proto
package contracts

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.19.3
// protoc-gen-go v1.28.1
// protoc v4.25.1
// source: events.proto
package contracts

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.3
// - protoc v4.25.1
// source: events.proto
package contracts