diff --git a/packages/react-native-executorch/scripts/create-package.sh b/packages/react-native-executorch/scripts/create-package.sh index 8b77cc20b1..709af11d20 100755 --- a/packages/react-native-executorch/scripts/create-package.sh +++ b/packages/react-native-executorch/scripts/create-package.sh @@ -1,5 +1,24 @@ #!/bin/bash +# Phonemis is a git submodule whose sources the podspec compiles directly +# (see third-party/common/phonemis/src in react-native-executorch.podspec). +# Init it explicitly so the files are present in the packed tarball. +# Run from repo root so the submodule path resolves regardless of cwd. +git -C "$(git rev-parse --show-toplevel)" submodule update --init --recursive \ + packages/react-native-executorch/third-party/common/phonemis + +# Trim phonemis to what consumers need at build time. Done here (not via +# package.json "files") because the submodule's own .gitignore has +# `!scripts/build*` which npm-packlist honors and re-includes those files +# despite our exclusion rules. Restore on exit so the working tree stays clean. +PHONEMIS_DIR="third-party/common/phonemis" +restore_phonemis() { + git -C "$PHONEMIS_DIR" checkout -- data test scripts requirements.txt 2>/dev/null || true +} +trap restore_phonemis EXIT +rm -rf "$PHONEMIS_DIR/data" "$PHONEMIS_DIR/test" "$PHONEMIS_DIR/scripts" +rm -f "$PHONEMIS_DIR/requirements.txt" + yarn install --immutable if [ $# -ge 1 ] && [ "$1" = "generate_nightly_version" ]; then