summaryrefslogtreecommitdiffstats
path: root/build/vue-builds.sh
blob: 782abe11a7cad0709905d42108efd534bf80e188 (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
#!/bin/bash

root=$(pwd)
entryFile=$1

if [ ! -f "$entryFile" ]
then
	echo "The build file $entryFile does not exists"
	exit 2
else
	backupFile="$entryFile.orig"
	path=$(dirname "$entryFile")

	# Backup original file
	echo "Backing up $entryFile to $backupFile"
	cp $entryFile $backupFile

	# Make the app
	set -e
	cd "$path/../"
	make

	# Reset
	cd $root

	# Compare build files
	echo "Comparing $entryFile to the original"
	if ! diff -q $entryFile $backupFile &>/dev/null
	then
		echo "$entryFile 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 "$entryFile build is up-to-date"
	fi
fi