Gaëtan Renaudeau
7 years ago
committed by
GitHub
4 changed files with 55 additions and 28 deletions
@ -0,0 +1,26 @@ |
|||
#/bin/bash |
|||
|
|||
function GET_HASH_PATH { |
|||
HASH_NAME=$1 |
|||
echo "./node_modules/.cache/LEDGER_HASH_$HASH_NAME.hash" |
|||
} |
|||
|
|||
function GET_HASH { |
|||
HASH_NAME=$1 |
|||
HASH_PATH=`GET_HASH_PATH $HASH_NAME` |
|||
if [ ! -e "$HASH_PATH" ]; then |
|||
echo '' |
|||
else |
|||
HASH_CONTENT=`cat "$HASH_PATH"` |
|||
echo $HASH_CONTENT |
|||
fi |
|||
} |
|||
|
|||
function SET_HASH { |
|||
HASH_NAME=$1 |
|||
HASH_CONTENT=$2 |
|||
echo "setting hash $HASH_NAME to $HASH_CONTENT" |
|||
HASH_PATH=`GET_HASH_PATH $HASH_NAME` |
|||
mkdir -p ./node_modules/.cache |
|||
echo $HASH_CONTENT > $HASH_PATH |
|||
} |
@ -0,0 +1,13 @@ |
|||
#/bin/bash |
|||
|
|||
source scripts/hash-utils.sh |
|||
|
|||
PACKAGE_JSON_HASH=`md5sum package.json | cut -d ' ' -f 1` |
|||
CACHED_PACKAGE_JSON_HASH=`GET_HASH 'package.json'` |
|||
|
|||
if [ "$CACHED_PACKAGE_JSON_HASH" == "$PACKAGE_JSON_HASH" ]; then |
|||
echo "> Skipping yarn install" |
|||
else |
|||
yarn install |
|||
SET_HASH 'package.json' $PACKAGE_JSON_HASH |
|||
fi |
Loading…
Reference in new issue