only run npm build when js changes

This commit is contained in:
Leo Germani 2017-12-04 16:34:47 -02:00
parent ff09c7bf11
commit 9ff4438236
2 changed files with 15 additions and 5 deletions

3
.gitignore vendored
View File

@ -11,4 +11,5 @@ vendor
src/vendor
node_modules
npm-debug.log
src/assets/web-components.js
src/assets/web-components.js
last-js-build.md5

View File

@ -1,15 +1,24 @@
#!/bin/bash
#source build-config.cfg
source build-config.cfg
#destination=~/devel/wordpress/wp-content/plugins/tainacan
## Only run npm build if there was a change in a .js or .vue file
current_md5=$(<last-js-build.md5)
find src -type f \( -name "*.js" -or -name "*.vue" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5
new_md5=$(<last-js-build.md5)
if [ "$current_md5" != "$new_md5" ]
then
npm run build
fi
### END npm build ###
## Compile SASS
sh compile-sass.sh
npm run build
## Install composer dependencies
composer install
echo "Atualizando arquivos em $destination"
echo "Updating files in $destination"
rm -rf $destination
mkdir $destination
cp -R src/* $destination/