-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: switch to protobuf-es-lite and update deps
Signed-off-by: Christian Stewart <christian@aperture.us>
- Loading branch information
Showing
40 changed files
with
7,371 additions
and
11,249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ vendor/ | |
debug.test | ||
.nyc_output | ||
.aider* | ||
.tools/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./vendor/github.com/aperturerobotics/common/.golangci.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ vendor/ | |
*.pb.go | ||
*.pb.ts | ||
go.sum | ||
*_*.pb.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
semi: false | ||
singleQuote: true | ||
experimentalTernaries: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,165 +1,31 @@ | ||
# https://github.com/aperturerobotics/protobuf-project | ||
|
||
# https://github.com/aperturerobotics/template | ||
PROJECT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
SHELL:=bash | ||
ESBUILD=hack/bin/esbuild | ||
PROTOWRAP=hack/bin/protowrap | ||
PROTOC_GEN_GO=hack/bin/protoc-gen-go | ||
PROTOC_GEN_STARPC=hack/bin/protoc-gen-go-starpc | ||
PROTOC_GEN_VTPROTO=hack/bin/protoc-gen-go-vtproto | ||
GOIMPORTS=hack/bin/goimports | ||
GOLANGCI_LINT=hack/bin/golangci-lint | ||
GO_MOD_OUTDATED=hack/bin/go-mod-outdated | ||
GOLIST=go list -f "{{ .Dir }}" -m | ||
MAKEFLAGS += --no-print-directory | ||
|
||
GO_VENDOR_DIR := ./vendor | ||
COMMON_DIR := $(GO_VENDOR_DIR)/github.com/aperturerobotics/common | ||
COMMON_MAKEFILE := $(COMMON_DIR)/Makefile | ||
|
||
export GO111MODULE=on | ||
undefine GOARCH | ||
undefine GOOS | ||
|
||
all: | ||
|
||
vendor: | ||
go mod vendor | ||
|
||
$(ESBUILD): | ||
cd ./hack; \ | ||
go build -v \ | ||
-o ./bin/esbuild \ | ||
github.com/evanw/esbuild/cmd/esbuild | ||
|
||
$(PROTOC_GEN_GO): | ||
cd ./hack; \ | ||
go build -v \ | ||
-o ./bin/protoc-gen-go \ | ||
google.golang.org/protobuf/cmd/protoc-gen-go | ||
|
||
$(PROTOC_GEN_VTPROTO): | ||
cd ./hack; \ | ||
go build -v \ | ||
-o ./bin/protoc-gen-go-vtproto \ | ||
github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto | ||
|
||
$(PROTOC_GEN_STARPC): | ||
cd ./hack; \ | ||
go build -v \ | ||
-o ./bin/protoc-gen-go-starpc \ | ||
github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc | ||
|
||
$(GOIMPORTS): | ||
cd ./hack; \ | ||
go build -v \ | ||
-o ./bin/goimports \ | ||
golang.org/x/tools/cmd/goimports | ||
|
||
$(PROTOWRAP): | ||
cd ./hack; \ | ||
go build -v \ | ||
-o ./bin/protowrap \ | ||
github.com/aperturerobotics/goprotowrap/cmd/protowrap | ||
.PHONY: $(MAKECMDGOALS) | ||
|
||
$(GOLANGCI_LINT): | ||
cd ./hack; \ | ||
go build -v \ | ||
-o ./bin/golangci-lint \ | ||
github.com/golangci/golangci-lint/cmd/golangci-lint | ||
|
||
$(GO_MOD_OUTDATED): | ||
cd ./hack; \ | ||
go build -v \ | ||
-o ./bin/go-mod-outdated \ | ||
github.com/psampaz/go-mod-outdated | ||
|
||
# Add --go-grpc_out=$$(pwd)/vendor to use the GRPC protoc generator. | ||
# .. and remove the "grpc" option from the vtprotobuf features list. | ||
|
||
.PHONY: gengo | ||
gengo: $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTOC_GEN_VTPROTO) $(PROTOC_GEN_STARPC) | ||
shopt -s globstar; \ | ||
set -eo pipefail; \ | ||
export PROJECT=$$(go list -m); \ | ||
export PATH=$$(pwd)/hack/bin:$${PATH}; \ | ||
mkdir -p $$(pwd)/vendor/$$(dirname $${PROJECT}); \ | ||
rm $$(pwd)/vendor/$${PROJECT} || true; \ | ||
ln -s $$(pwd) $$(pwd)/vendor/$${PROJECT} ; \ | ||
$(PROTOWRAP) \ | ||
-I $$(pwd)/vendor \ | ||
--go_out=$$(pwd)/vendor \ | ||
--go-vtproto_out=$$(pwd)/vendor \ | ||
--go-vtproto_opt=features=marshal+unmarshal+size+equal+clone \ | ||
--go-starpc_out=$$(pwd)/vendor \ | ||
--proto_path $$(pwd)/vendor \ | ||
--print_structure \ | ||
--only_specified_files \ | ||
$$(\ | ||
git \ | ||
ls-files "*.proto" |\ | ||
xargs printf -- \ | ||
"$$(pwd)/vendor/$${PROJECT}/%s "); \ | ||
rm $$(pwd)/vendor/$${PROJECT} || true | ||
$(GOIMPORTS) -w ./ | ||
|
||
node_modules: | ||
yarn install | ||
|
||
.PHONY: gents | ||
gents: $(PROTOWRAP) node_modules | ||
shopt -s globstar; \ | ||
set -eo pipefail; \ | ||
export PROJECT=$$(go list -m); \ | ||
export PATH=$$(pwd)/hack/bin:$${PATH}; \ | ||
mkdir -p $$(pwd)/vendor/$$(dirname $${PROJECT}); \ | ||
rm $$(pwd)/vendor/$${PROJECT} || true; \ | ||
ln -s $$(pwd) $$(pwd)/vendor/$${PROJECT} ; \ | ||
$(PROTOWRAP) \ | ||
-I $$(pwd)/vendor \ | ||
--plugin=./node_modules/.bin/protoc-gen-ts_proto \ | ||
--ts_proto_out=$$(pwd)/vendor \ | ||
--ts_proto_opt=esModuleInterop=true \ | ||
--ts_proto_opt=fileSuffix=.pb \ | ||
--ts_proto_opt=importSuffix=.js \ | ||
--ts_proto_opt=forceLong=long \ | ||
--ts_proto_opt=oneof=unions \ | ||
--ts_proto_opt=outputServices=default,outputServices=generic-definitions \ | ||
--ts_proto_opt=useAbortSignal=true \ | ||
--ts_proto_opt=useAsyncIterable=true \ | ||
--ts_proto_opt=useDate=true \ | ||
--proto_path $$(pwd)/vendor \ | ||
--print_structure \ | ||
--only_specified_files \ | ||
$$(\ | ||
git \ | ||
ls-files "*.proto" |\ | ||
xargs printf -- \ | ||
"$$(pwd)/vendor/$${PROJECT}/%s "); \ | ||
rm $$(pwd)/vendor/$${PROJECT} || true | ||
npm run format | ||
|
||
.PHONY: genproto | ||
genproto: gengo gents | ||
|
||
.PHONY: gen | ||
gen: genproto | ||
|
||
.PHONY: outdated | ||
outdated: $(GO_MOD_OUTDATED) | ||
go list -mod=mod -u -m -json all | $(GO_MOD_OUTDATED) -update -direct | ||
|
||
.PHONY: list | ||
list: $(GO_MOD_OUTDATED) | ||
go list -mod=mod -u -m -json all | $(GO_MOD_OUTDATED) | ||
all: | ||
|
||
.PHONY: lint | ||
lint: $(GOLANGCI_LINT) | ||
$(GOLANGCI_LINT) run | ||
$(COMMON_MAKEFILE): vendor | ||
@if [ ! -f $(COMMON_MAKEFILE) ]; then \ | ||
echo "Please add github.com/aperturerobotics/common to your go.mod."; \ | ||
exit 1; \ | ||
fi | ||
|
||
.PHONY: fix | ||
fix: $(GOLANGCI_LINT) | ||
$(GOLANGCI_LINT) run --fix | ||
$(MAKECMDGOALS): $(COMMON_MAKEFILE) | ||
@$(MAKE) -C $(COMMON_DIR) PROJECT_DIR="$(PROJECT_DIR)" $@ | ||
|
||
.PHONY: test | ||
test: | ||
go test -v ./... | ||
%: $(COMMON_MAKEFILE) | ||
@$(MAKE) -C $(COMMON_DIR) PROJECT_DIR="$(PROJECT_DIR)" $@ | ||
|
||
.PHONY: demo | ||
demo: node_modules vendor $(ESBUILD) | ||
export PATH=$$(pwd)/hack/bin:$${PATH}; \ | ||
cd ./example && bash ./example.bash | ||
vendor: | ||
go mod vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// HandleResultValue handles the next value in the sequence, optionally | ||
// returning a handler for the next value(s) in the sequence. | ||
|
||
import { RGQLValue } from '../rgraphql.pb' | ||
import { RGQLValue } from '../rgraphql.pb.js' | ||
|
||
// If val == undefined, delete the value. | ||
export type ResultTreeHandler = ((val: RGQLValue | undefined) => ResultTreeHandler) | null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//go:build deps_only | ||
// +build deps_only | ||
|
||
package rgraphql | ||
|
||
import ( | ||
// _ imports common with the Makefile and tools | ||
_ "github.com/aperturerobotics/common" | ||
) |
Oops, something went wrong.