From 563e99e2f532fd592ba0b8d49e5bdd3edb5d6518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20S=C5=82uszniak?= Date: Mon, 25 May 2026 12:34:39 +0200 Subject: [PATCH] fix(build): pack phonemis submodule sources in npm tarball Init the phonemis submodule from create-package.sh so its sources are present at npm pack time; previously the submodule was empty so the podspec's third-party/common/phonemis/src glob found nothing and TTS-using apps could not build from the published package. Trim phonemis data/test/scripts/requirements.txt in the script (with a trap-based restore) rather than via package.json `files` because the submodule's own .gitignore re-includes scripts/build* via `!scripts/build*` and that overrides the package.json exclusion in npm-packlist. --- .../scripts/create-package.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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