Build.sh more inteligent

This commit is contained in:
weryques 2018-01-29 15:24:51 -02:00
parent 33d3f06651
commit a3cc7dddd7
3 changed files with 44 additions and 17 deletions

3
.gitignore vendored
View File

@ -13,6 +13,9 @@ node_modules
npm-debug.log npm-debug.log
src/assets/*.js src/assets/*.js
last-js-build.md5 last-js-build.md5
last-sass-build.md5
last-composer-build.md5
last-package-build.md5
src/admin/scss/.sass-cache src/admin/scss/.sass-cache
src/assets/css/tainacan-admin.css src/assets/css/tainacan-admin.css
src/assets/css/tainacan-admin.css.map src/assets/css/tainacan-admin.css.map

View File

@ -3,28 +3,53 @@
source build-config.cfg source build-config.cfg
## Only run npm build if there was a change in a .js or .vue file ## Only run npm build if there was a change in a .js or .vue file
current_md5=$(<last-js-build.md5) current_md5_js=$(<last-js-build.md5)
current_md5_sass=$(<last-sass-build.md5)
current_md5_composer=$(<last-composer-build.md5)
current_md5_package=$(<last-package-build.md5)
current_OS=`uname` current_OS=`uname`
# For macOS (Darwin) # For macOS (Darwin)
if [ $current_OS == "Darwin" ]; then if [ $current_OS == "Darwin" ]; then
find src -type f \( -name "*.js" -or -name "*.vue" -or -name "*.scss" \) -exec md5 {} \; | sort -k 2 | md5 > last-js-build.md5 find src -type f \( -name "*.js" -or -name "*.vue" \) -exec md5 {} \; | sort -k 2 | md5 > last-js-build.md5
find src -type f \( -name "*.scss" \) -exec md5 {} \; | sort -k 2 | md5 > last-sass-build.md5
find src -type f \( -name "composer.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-composer-build.md5
find src -type f \( -name "package.json" \) -exec md5 {} \; | sort -k 2 | md5 > last-package-build.md5
else else
find src -type f \( -name "*.js" -or -name "*.vue" -or -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5 find src -type f \( -name "*.js" -or -name "*.vue" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5
find src -type f \( -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-sass-build.md5
find src -type f \( -name "composer.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-composer-build.md5
find src -type f \( -name "package.json" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-package-build.md5
fi fi
new_md5=$(<last-js-build.md5) new_md5_js=$(<last-js-build.md5)
if [ "$current_md5" != "$new_md5" ] if [ "$current_md5_js" != "$new_md5_js" ]
then then
npm run build npm run build
## Compile SASS
sh compile-sass.sh
fi fi
### END npm build ### ### END npm build ###
## Install composer dependencies new_md5_sass=$(<last-sass-build.md5)
composer install if [ "$current_md5_sass" != "$new_md5_sass" ]
then
## Compile SASS
sh compile-sass.sh
fi
new_md5_composer=$(<last-composer-build.md5)
if [ "$current_md5_composer" != "$new_md5_composer" ]
then
## Install composer dependencies
composer install
fi
new_md5_package=$(<last-package-build.md5)
if [ "$current_md5_package" != "$new_md5_package" ]
then
## Install composer dependencies
npm install
fi
echo "Updating files in $destination" echo "Updating files in $destination"
rm -rf $destination rm -rf $destination

View File

@ -2,13 +2,13 @@
<div> <div>
<el-row v-if="collection != null"> <el-row v-if="collection != null">
<el-card :body-style="{ padding: '0px' }"> <el-card :body-style="{ padding: '0px' }">
<img src="" class="image" :alt="collection.name"> <img :src="collection.featured_image" class="image" :alt="collection.name">
<div style="padding: 14px;"> <div style="padding: 14px;">
<span>{{ collection.name }}</span> <span>{{ collection.name }}</span>
<div class="bottom clearfix"> <div class="bottom clearfix">
<time class="time">{{collection.description}}</time> <time class="time">{{collection.description}}</time>
<el-button type="text">Lista de Itens</el-button> <el-button type="text" class="element-button">Lista de Itens</el-button>
<router-link tag="el-button" :to="{ path: `/collections/${collection.id}/items/create`, params: { collection_id: collection.id }}">Criar Item</router-link> <router-link type="success" class="element-button" tag="el-button" :to="{ path: `/collections/${collection.id}/items/create`, params: { collection_id: collection.id }}">Criar Item</router-link>
</div> </div>
</div> </div>
</el-card> </el-card>
@ -62,13 +62,12 @@ export default {
line-height: 12px; line-height: 12px;
} }
el-button { .element-button {
padding: 0;
float: right; float: right;
} }
.image { .image {
width: 100%; max-width: 100%;
display: block; display: block;
} }