blob: b5198cbbc1fe5771929a61a370365c61f74be059 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/bash
root=$(pwd)
entryFile=$1
if [ ! -f "$entryFile" ]
then
echo "The build file $entryFile does not exists"
exit 2
else
path=$(dirname "$entryFile")
file=$(basename $entryFile)
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
# Make the app
echo "Making $file"
cd ../
npm --silent install
npm run --silent build
# Reset
cd $root
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
done
fi
|