Skip to content

Commit bc2a966

Browse files
committed
refactor: switch to protoc-gen-es-starpc
Signed-off-by: Christian Stewart <christian@aperture.us>
1 parent 44f9283 commit bc2a966

7 files changed

+978
-788
lines changed

Makefile

+31-33
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ GO_MOD_OUTDATED=hack/bin/go-mod-outdated
1111
GOLIST=go list -f "{{ .Dir }}" -m
1212

1313
export GO111MODULE=on
14-
undefine GOOS
1514
undefine GOARCH
15+
undefine GOOS
1616

1717
all:
1818

@@ -25,12 +25,6 @@ $(PROTOC_GEN_GO):
2525
-o ./bin/protoc-gen-go-lite \
2626
github.com/aperturerobotics/protobuf-go-lite/cmd/protoc-gen-go-lite
2727

28-
$(PROTOC_GEN_STARPC):
29-
cd ./hack; \
30-
go build -v \
31-
-o ./bin/protoc-gen-go-starpc \
32-
github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc
33-
3428
$(GOIMPORTS):
3529
cd ./hack; \
3630
go build -v \
@@ -61,33 +55,40 @@ $(GO_MOD_OUTDATED):
6155
-o ./bin/go-mod-outdated \
6256
github.com/psampaz/go-mod-outdated
6357

58+
$(PROTOC_GEN_STARPC):
59+
cd ./hack; \
60+
go build -v \
61+
-o ./bin/protoc-gen-go-starpc \
62+
github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc
63+
64+
node_modules:
65+
yarn install
66+
6467
.PHONY: genproto
6568
genproto: vendor node_modules $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTOC_GEN_STARPC)
6669
shopt -s globstar; \
6770
set -eo pipefail; \
6871
export PROJECT=$$(go list -m); \
6972
export PATH=$$(pwd)/hack/bin:$${PATH}; \
70-
mkdir -p $$(pwd)/vendor/$$(dirname $${PROJECT}); \
73+
export OUT=$$(pwd)/vendor; \
74+
mkdir -p $${OUT}/$$(dirname $${PROJECT}); \
7175
rm $$(pwd)/vendor/$${PROJECT} || true; \
7276
ln -s $$(pwd) $$(pwd)/vendor/$${PROJECT} ; \
7377
protogen() { \
7478
$(PROTOWRAP) \
75-
-I $$(pwd)/vendor \
76-
--plugin=./node_modules/.bin/protoc-gen-ts_proto \
77-
--go-lite_out=$$(pwd)/vendor \
78-
--go-lite_opt=features=marshal+unmarshal+size+equal+clone+json+unmarshal_unsafe \
79-
--go-starpc_out=$$(pwd)/vendor \
80-
--ts_proto_out=$$(pwd)/vendor \
81-
--ts_proto_opt=esModuleInterop=true \
82-
--ts_proto_opt=fileSuffix=.pb \
83-
--ts_proto_opt=importSuffix=.js \
84-
--ts_proto_opt=forceLong=long \
85-
--ts_proto_opt=oneof=unions \
86-
--ts_proto_opt=outputServices=default,outputServices=generic-definitions \
87-
--ts_proto_opt=useAbortSignal=true \
88-
--ts_proto_opt=useAsyncIterable=true \
89-
--ts_proto_opt=useDate=true \
90-
--proto_path $$(pwd)/vendor \
79+
-I $${OUT} \
80+
--plugin=./node_modules/.bin/protoc-gen-es \
81+
--plugin=./node_modules/.bin/protoc-gen-es-starpc \
82+
--go-lite_out=$${OUT} \
83+
--go-lite_opt=features=marshal+unmarshal+size+equal+json+clone \
84+
--go-starpc_out=$${OUT} \
85+
--es_out=$${OUT} \
86+
--es_opt target=ts \
87+
--es_opt ts_nocheck=false \
88+
--es-starpc_out=$${OUT} \
89+
--es-starpc_opt target=ts \
90+
--es-starpc_opt ts_nocheck=false \
91+
--proto_path $${OUT} \
9192
--print_structure \
9293
--only_specified_files \
9394
$$(\
@@ -101,9 +102,6 @@ genproto: vendor node_modules $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTO
101102
$(GOIMPORTS) -w ./
102103
npm run format:js
103104

104-
node_modules:
105-
yarn install
106-
107105
.PHONY: gen
108106
gen: genproto
109107

@@ -117,17 +115,17 @@ list: $(GO_MOD_OUTDATED)
117115

118116
.PHONY: lint
119117
lint: $(GOLANGCI_LINT)
120-
$(GOLANGCI_LINT) run --timeout=10m
118+
$(GOLANGCI_LINT) run
121119

122120
.PHONY: fix
123121
fix: $(GOLANGCI_LINT)
124-
$(GOLANGCI_LINT) run --fix --timeout=10m
122+
$(GOLANGCI_LINT) run --fix
123+
124+
.PHONY: test
125+
test:
126+
go test -v ./...
125127

126128
.PHONY: format
127129
format: $(GOFUMPT) $(GOIMPORTS)
128130
$(GOIMPORTS) -w ./
129131
$(GOFUMPT) -w ./
130-
131-
.PHONY: test
132-
test:
133-
go test -v ./...

example/example.pb.go

-88
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)