Add web api build script
This commit is contained in:
1 parent
6b3a88905c
commit
02cf1fbed9
1 file changed
+29
@@ -0,0 +1,29 @@
|
||||
#!/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
|
||||
Reference in new issue
Block a user