#!/bin/bash
# Back up the original package.json
cp package.json package.json.bak

# Remove all dependencies starting with the prefix @dyte-in
# The imported types from these dependencies will be bundled
# cat package.json.bak | jq '.dependencies |= delpaths([keys[] | select(contains("@dytesdk")) | [.]])' > package.json

npx tsup src/index.ts --external @protobuf-ts/runtime --external axios --dts-resolve --dts-only --format esm

mv package.json.bak package.json
find dist/ -name '*.d.ts' -exec sed -i '' '/#private;/d' {} +
