forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_yarn_lockfile.sh
More file actions
executable file
·43 lines (34 loc) · 1.09 KB
/
validate_yarn_lockfile.sh
File metadata and controls
executable file
·43 lines (34 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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.
# Abort the mission if any command fails
set -e
# Allow the script to be invoked from various environments
if [[ -z "${OVERRIDE_YARN_BINARY}" ]]; then
YARN_BINARY=$(command -v yarn)
else
YARN_BINARY="${OVERRIDE_YARN_BINARY}"
fi
REACT_NATIVE_TEMP_DIR=$(mktemp -d /tmp/react-native-XXXXXXXX)
function cleanup {
set +e
rm -rf "$REACT_NATIVE_TEMP_DIR"
set -e
}
function msg {
echo -e " "
echo -e "\\x1B[36m${1}\\x1B[0m";
echo -e "\\x1B[36m${1//?/=}\\x1B[0m"
}
trap cleanup EXIT
cp -R ./package.json "$REACT_NATIVE_TEMP_DIR"
cp -R ./yarn.lock "$REACT_NATIVE_TEMP_DIR"
pushd "$REACT_NATIVE_TEMP_DIR" >/dev/null
if ! $YARN_BINARY --ignore-scripts --silent --non-interactive --mutex network --frozen-lockfile; then
msg "Yarn validation failed."
echo "This means the package.json and yarn.lock disagree in some way."
echo "Try fixing it by running \`yarn\` and committing the changes."
fi
popd >/dev/null