Skip to content

Commit

Permalink
Protocol: Add script to generate types with description.
Browse files Browse the repository at this point in the history
Add script to generate type script types from rust ones with description
about how to include them in the system with notes to ensure the
existing types won't be overwriting unintentionally.
  • Loading branch information
AmmarAbouZor authored and DmitryAstafyev committed Jan 7, 2025
1 parent 921c437 commit f2d7322
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions application/apps/indexer/stypes/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

echo "
This script generates TypeScript types from Rust types by executing special unit tests.
After running these tests, the types will be generated, and existing types will be overwritten
in the 'bindings' directory.
Please copy only the newly generated types to the 'application/platform/types' directory.
Notes:
* The generated files in 'bindings' are not part of the communication protocol; only the types in
'platform' are part of the protocol.
* Please commit only the new changes and exclude the overwritten versions of existing types.
"
read -p "Do you want to continue? (y/N): " response

response=${response,,}
if [[ "$response" != "y" ]]; then
echo "Operation aborted."
exit 1
fi

echo "Generating types"
cargo test --release --features "test_and_gen" -- --nocapture

0 comments on commit f2d7322

Please sign in to comment.