29 lines
1.1 KiB
Bash
29 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
# "protogen": "pbjs -t json-module -w commonjs -o %build%/proto.js ../../lib/api/*.proto ../../lib/api/services/*.proto ../../lib/domain_model/*.proto ../../lib/sparkproto/*.proto ../../lib/md/protos/*.proto",
|
|
OUT=../../../build/web/
|
|
mkdir -p $OUT/src
|
|
PROTO_LIST="../../lib/api/*.proto ../../lib/api/services/*.proto ../../lib/domain_model/*.proto ../../lib/sparkproto/*.proto ../../lib/md/protos/*.proto"
|
|
|
|
# Run pbjs to produce protobuf module
|
|
echo pbjs
|
|
npx pbjs -t json-module -w commonjs -o $OUT/api/proto.js $PROTO_LIST
|
|
|
|
# Run bts proto=>typescript compiler
|
|
echo protoc
|
|
../../../externals/linux/bin/protoc \
|
|
--plugin=protoc-gen-service=../../lib/api/service_compiler/plugin.py \
|
|
--service_out=lang=js,strip_out_path=1:$OUT/src \
|
|
-I ../../ \
|
|
$PROTO_LIST
|
|
|
|
# run typescript compiler to convert typescript to javascript
|
|
echo tsc
|
|
npx tsc -p tsconfig.release.json
|
|
|
|
# run ts2fable to make f# stubs from typescript definitions
|
|
for FILE in $OUT/api/*.d.ts; do
|
|
filename=$(basename -- $FILE)
|
|
filename="${filename%.d.ts}"
|
|
npx ts2fable $OUT/api/$filename.d.ts $OUT/api/$filename.fs
|
|
done |