Add volta support to find-node.sh (#32611)

Summary:
This PR add [volta](https://volta.sh/) support to find-node.sh for use by `scripts/react-native-xcode.sh`, `scripts/generate-specs.sh`, etc.

## Changelog

[iOS] [Added] - add volta support to find-node.sh

Pull Request resolved: https://github.com/facebook/react-native/pull/32611

Test Plan:
Manually tested with volta installed node (and [relevant change](https://docs.volta.sh/guide/understanding#managing-your-project) added to the project's package.json). Without this patch, the `Bundle React Native code and images` Build Phase fails, with it, it succeeds.

Tested with both `curl https://get.volta.sh | bash` installed and `brew install volta`. One check works for both because the `node` shim will always be installed to the same location (and the required environment variable exports are the same also)

Wasn't sure if you'd want the package.json change applied to rn-tester? Shouldn't affect people who don't use volta. Shout if you want me to add it to this PR.

Reviewed By: cortinico

Differential Revision: D32498267

Pulled By: yungsters

fbshipit-source-id: 93ee187bd2178bfcd8f9009a1a0668c6f5583aa3
This commit is contained in:
Liam Jones 2021-11-19 05:26:24 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 6b1ccef71f
Коммит 765844055b
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -50,3 +50,9 @@ elif [[ -x "$(command -v brew)" && -f "$(brew --prefix asdf)/asdf.sh" ]]; then
# shellcheck source=/dev/null
. "$(brew --prefix asdf)/asdf.sh"
fi
# Set up volta if present
if [[ -x "$HOME/.volta/bin/node" ]]; then
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
fi