mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-26 11:42:16 +01:00
27 lines
650 B
Bash
Executable File
27 lines
650 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Paths
|
|
JSON_PATH='./submodules/trezor-common/models.json'
|
|
TS_PATH='./packages/connect/src/data/models.ts'
|
|
|
|
# Check if the JSON file exists
|
|
if [ ! -f "$JSON_PATH" ]; then
|
|
echo "JSON file does not exist: $JSON_PATH"
|
|
exit 1
|
|
fi
|
|
|
|
echo "// !!! IMPORTANT: This file is autogenerated !!! use yarn update-models"
|
|
|
|
# Begin the output with the export declaration
|
|
echo "export const models = " > "$TS_PATH"
|
|
|
|
# Append the JSON content to the .ts file
|
|
if cat "$JSON_PATH" >> "$TS_PATH"; then
|
|
echo "File converted and saved successfully to $TS_PATH!"
|
|
else
|
|
echo "Operation failed!"
|
|
exit 2
|
|
fi
|
|
|
|
yarn prettier --write $TS_PATH
|