mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Generalize node search logic
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
"scripts/packager.sh",
|
||||
"scripts/react_native_pods.rb",
|
||||
"scripts/react-native-xcode.sh",
|
||||
"scripts/find-node.sh",
|
||||
"template.config.js",
|
||||
"template",
|
||||
"third-party-podspecs"
|
||||
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
set -e
|
||||
|
||||
# Define NVM_DIR and source the nvm.sh setup script
|
||||
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
|
||||
|
||||
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
|
||||
. "$HOME/.nvm/nvm.sh"
|
||||
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
|
||||
. "$(brew --prefix nvm)/nvm.sh"
|
||||
fi
|
||||
|
||||
# Set up the nodenv node version manager if present
|
||||
if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then
|
||||
eval "$("$HOME/.nodenv/bin/nodenv" init -)"
|
||||
elif [[ -x "$(command -v brew)" && -x "$(brew --prefix nodenv)/bin/nodenv" ]]; then
|
||||
eval "$("$(brew --prefix nodenv)/bin/nodenv" init -)"
|
||||
fi
|
||||
|
||||
# Set up the ndenv of anyenv if preset
|
||||
if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then
|
||||
export PATH=${HOME}/.anyenv/bin:${PATH}
|
||||
if [[ "$(anyenv envs | grep -c ndenv )" -eq 1 ]]; then
|
||||
eval "$(anyenv init -)"
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user