Files
actual/packages/crdt/bin/generate-proto
Julian Dominguez-Schatz 7b71374e79 Move remaining .d.ts files to .ts (#5208)
* Update CRDT protobuf generation to create a .ts file

* Move remaining .d.ts files to .ts

* Fix remaining type errors

* Ignore .d.ts files so we don't accidentally use them in the future

* Add release notes
2025-07-03 14:59:21 -04:00

27 lines
829 B
Bash
Executable File

#!/bin/bash
cd "$(dirname "$(dirname "$0")")"
if ! [ -x "$(command -v protoc)" ]; then
echo 'Error: protoc is not installed. See the readme for installation instructions.' >&2
exit 1
fi
export PATH="$PWD/bin:$PATH"
protoc --plugin="protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts" \
--ts_opt=esModuleInterop=true \
--ts_out="src/proto" \
--js_out=import_style=commonjs,binary:src/proto \
--proto_path=src/proto \
sync.proto
../../node_modules/.bin/prettier --write src/proto/*.d.ts
for file in src/proto/*.d.ts; do
{ echo "/* eslint-disable @typescript-eslint/no-namespace */"; sed 's/export class/export declare class/g' "$file"; } > "${file%.d.ts}.ts"
rm "$file"
done
echo 'One more step! Find the `var global = ...` declaration in src/proto/sync_pb.js and change it to `var global = globalThis;`'