2018-06-06 16:02:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
root=$(pwd)
|
2018-06-07 06:35:00 +00:00
|
|
|
entryFile=$1
|
2018-06-06 16:02:43 +00:00
|
|
|
|
2018-06-07 06:35:00 +00:00
|
|
|
if [ ! -f "$entryFile" ]
|
|
|
|
then
|
|
|
|
echo "The build file $entryFile does not exists"
|
|
|
|
exit 2
|
|
|
|
else
|
2018-06-06 16:02:43 +00:00
|
|
|
path=$(dirname "$entryFile")
|
2018-10-01 05:29:11 +00:00
|
|
|
file=$(basename $entryFile)
|
2018-06-06 16:02:43 +00:00
|
|
|
|
2018-10-01 05:29:11 +00:00
|
|
|
set -e
|
|
|
|
cd $path
|
|
|
|
echo "Entering $path"
|
|
|
|
|
|
|
|
# support for multiple chunks
|
|
|
|
for chunk in *$file; do
|
|
|
|
|
|
|
|
# Backup original file
|
|
|
|
backupFile="$chunk.orig"
|
|
|
|
echo "Backing up $chunk to $backupFile"
|
|
|
|
cp $chunk $backupFile
|
|
|
|
|
|
|
|
done
|
2018-06-06 16:02:43 +00:00
|
|
|
|
|
|
|
# Make the app
|
2018-10-01 05:29:11 +00:00
|
|
|
echo "Making $file"
|
|
|
|
cd ../
|
|
|
|
npm --silent install
|
|
|
|
npm run --silent build
|
2018-06-06 16:02:43 +00:00
|
|
|
|
|
|
|
# Reset
|
|
|
|
cd $root
|
2018-10-01 05:29:11 +00:00
|
|
|
cd $path
|
|
|
|
|
|
|
|
# support for multiple chunks
|
|
|
|
for chunk in *$file; do
|
|
|
|
|
|
|
|
# Compare build files
|
|
|
|
echo "Comparing $chunk to the original"
|
|
|
|
backupFile="$chunk.orig"
|
|
|
|
if ! diff -q $chunk $backupFile &>/dev/null
|
|
|
|
then
|
|
|
|
echo "$chunk build is NOT up-to-date! Please send the proper production build within the pull request"
|
|
|
|
cat $HOME/.npm/_logs/*.log
|
|
|
|
exit 2
|
|
|
|
else
|
|
|
|
echo "$chunk build is up-to-date"
|
|
|
|
fi
|
2018-06-06 16:02:43 +00:00
|
|
|
|
2018-10-01 05:29:11 +00:00
|
|
|
done
|
2018-06-07 06:35:00 +00:00
|
|
|
fi
|