-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ts): implement grpc-js client services (#184)
Issue: #184
- Loading branch information
1 parent
b7813c9
commit b54ba45
Showing
24 changed files
with
4,732 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
TMP_GRPC_JS_SERVICES_DIR="${AKASH_DEVCACHE_BASE}/ts/generated-grpc-js" | ||
|
||
function prepare_grpc_js() { | ||
mkdir -p "$TMP_GRPC_JS_SERVICES_DIR" | ||
} | ||
|
||
function add_grpc_js_services() { | ||
local ts_grpc_js_services | ||
local file | ||
local dest_path | ||
local index_file_path | ||
local index_file_name | ||
local export_statement | ||
|
||
ts_grpc_js_services=$(find "$TMP_GRPC_JS_SERVICES_DIR" -name 'service.ts') | ||
|
||
for file in $ts_grpc_js_services; do | ||
dest_path=$(dirname "${file/$TMP_GRPC_JS_SERVICES_DIR/$AKASH_TS_ROOT\/src\/generated}") | ||
dest_file="${dest_path}/service.grpc-js.ts" | ||
|
||
mv "$file" "$dest_file" | ||
|
||
path_from_gen_dir=${dest_file#"${AKASH_TS_ROOT}/src/generated/"} | ||
index_file_name_base=${path_from_gen_dir%/service.grpc-js.ts} | ||
index_file_name="index.${index_file_name_base//\//.}.grpc-js.ts" | ||
index_file_path="${AKASH_TS_ROOT}/src/generated/$index_file_name" | ||
export_statement="export * from \"./${path_from_gen_dir%.ts}\";" | ||
|
||
echo "$export_statement" > "$index_file_path" | ||
done | ||
|
||
rm -rf "$TMP_GRPC_JS_SERVICES_DIR" | ||
} |
Oops, something went wrong.