Feliday-js-client/copy_generated_types_from_lemmy.sh
2023-06-06 09:05:14 -04:00

25 lines
656 B
Bash
Executable file

#!/bin/bash
# First re-generate the types by running cargo test on lemmy
pushd ../lemmy/scripts
./test.sh
cd ../crates
# Copy them over to the types folder
cp api_common/bindings/* ../../lemmy-js-client/src/types/
cp db_schema/bindings/* ../../lemmy-js-client/src/types/
cp db_views/bindings/* ../../lemmy-js-client/src/types/
cp db_views_actor/bindings/* ../../lemmy-js-client/src/types/
cp db_views_moderator/bindings/* ../../lemmy-js-client/src/types/
popd
# Remove the Sensitive type
rm src/types/Sensitive.ts
# Change all the bigints to numbers
find src/types -type f -name '*.ts' -exec sed -i 's/bigint/number/g' {} +
node putTypesInIndex.js