forked from ionorg/ion-sdk-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
32 lines (25 loc) · 979 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
PROTOC_GEN_TS=$(shell which protoc-gen-ts)
.PHONY: check proto build
all: check proto build
# Check if protoc-gen-ts is installed
check:
@if [ -z "$(PROTOC_GEN_TS)" ]; then \
echo "Error: protoc-gen-ts is not installed. Please install it with 'npm i -g ts-protoc-gen'."; \
exit 1; \
fi
# Generate TypeScript gRPC files
proto:
mkdir -p src/gen
#sudo npm i -g [email protected]
protoc room.proto --plugin=protoc-gen-ts=${PROTOC_GEN_TS} --js_out=import_style=commonjs,binary:./src/gen --ts_out=service=grpc-web:./src/gen
protoc rtc.proto --plugin=protoc-gen-ts=${PROTOC_GEN_TS} --js_out=import_style=commonjs,binary:./src/gen --ts_out=service=grpc-web:./src/gen
# Build the project
build:
yarn build
# Default target to print comments
print-comments:
@awk '/^#/{print}' $(MAKEFILE_LIST)
# Display help
help:
@echo "Available targets:"
@awk 'BEGIN {FS = "[:#]"} /^#/{comment=$2} /^[a-zA-Z_-]+:/ {print $$1 "\t" comment}' $(MAKEFILE_LIST) | column -t -s $$'\t'