Updates build by removing source map files on production
This commit is contained in:
parent
e1a0aa8c15
commit
6d4eca3d18
|
@ -13,6 +13,7 @@ npm-debug.log
|
||||||
src/assets/js/*.js
|
src/assets/js/*.js
|
||||||
src/assets/js/*.js.LICENSE
|
src/assets/js/*.js.LICENSE
|
||||||
src/assets/js/*.js.LICENSE.txt
|
src/assets/js/*.js.LICENSE.txt
|
||||||
|
src/assets/js/*.map.js
|
||||||
src/assets/*.js
|
src/assets/*.js
|
||||||
last-js-build.md5
|
last-js-build.md5
|
||||||
last-sass-build.md5
|
last-sass-build.md5
|
||||||
|
|
14
build.sh
14
build.sh
|
@ -46,15 +46,15 @@ fi
|
||||||
|
|
||||||
new_md5_js=$(<last-js-build.md5)
|
new_md5_js=$(<last-js-build.md5)
|
||||||
|
|
||||||
|
is_prod_build=false
|
||||||
if [ "$current_md5_js" != "$new_md5_js" ]
|
if [ "$current_md5_js" != "$new_md5_js" ]
|
||||||
then
|
then
|
||||||
is_prod_build=false
|
|
||||||
for i in "$@"
|
for i in "$@"
|
||||||
do
|
do
|
||||||
case $i in
|
case $i in
|
||||||
--prod)
|
--prod)
|
||||||
is_prod_build=true
|
is_prod_build=true
|
||||||
echo "Building in production mode..."
|
echo "$(tput setab 4) $(tput sgr 0) $(tput setab 4) $(tput sgr 0) Building in production mode $(tput setab 4) $(tput sgr 0) $(tput setab 4) $(tput sgr 0)"
|
||||||
npm run build-prod
|
npm run build-prod
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -62,11 +62,10 @@ then
|
||||||
|
|
||||||
if [ "$is_prod_build" == false ]
|
if [ "$is_prod_build" == false ]
|
||||||
then
|
then
|
||||||
echo "Building in development mode..."
|
echo "$(tput setab 2) $(tput sgr 0) $(tput setab 2) $(tput sgr 0) Building in development mode $(tput setab 2) $(tput sgr 0) $(tput setab 2) $(tput sgr 0)"
|
||||||
npm run build
|
npm run build
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
### END npm build ###
|
|
||||||
|
|
||||||
## Fetch PDF.js
|
## Fetch PDF.js
|
||||||
## Commented as we have a modified version of its code.
|
## Commented as we have a modified version of its code.
|
||||||
|
@ -78,7 +77,6 @@ fi
|
||||||
# rm pdfjs-1.9.426-dist.zip
|
# rm pdfjs-1.9.426-dist.zip
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
|
|
||||||
echo "Updating files in $wp_plugin_dir"
|
echo "Updating files in $wp_plugin_dir"
|
||||||
|
|
||||||
rm -rf $wp_plugin_dir
|
rm -rf $wp_plugin_dir
|
||||||
|
@ -94,6 +92,7 @@ rsync -axz --exclude='vendor/bin/phpc*' --exclude='vendor/squizlabs' --exclude='
|
||||||
--exclude='vendor/tecnickcom/tcpdf/examples' \
|
--exclude='vendor/tecnickcom/tcpdf/examples' \
|
||||||
src/* $wp_plugin_dir/
|
src/* $wp_plugin_dir/
|
||||||
|
|
||||||
|
echo "Removing unecessary source files"
|
||||||
rm -rf $wp_plugin_dir/scss
|
rm -rf $wp_plugin_dir/scss
|
||||||
find $wp_plugin_dir/views/ -type f -name '*.vue' -exec rm {} +
|
find $wp_plugin_dir/views/ -type f -name '*.vue' -exec rm {} +
|
||||||
find $wp_plugin_dir/views/ -type f -name '*.scss' -exec rm {} +
|
find $wp_plugin_dir/views/ -type f -name '*.scss' -exec rm {} +
|
||||||
|
@ -101,4 +100,9 @@ find $wp_plugin_dir/views/ -type f -name '*.sass' -exec rm {} +
|
||||||
find $wp_plugin_dir/views/ -type f -name '*.js' ! -path "${wp_plugin_dir}/views/libs/*" -exec rm {} +
|
find $wp_plugin_dir/views/ -type f -name '*.js' ! -path "${wp_plugin_dir}/views/libs/*" -exec rm {} +
|
||||||
find $wp_plugin_dir/views/ -type d -empty -delete
|
find $wp_plugin_dir/views/ -type d -empty -delete
|
||||||
|
|
||||||
|
if [ "$is_prod_build" == true ]
|
||||||
|
then
|
||||||
|
find $wp_plugin_dir/assets/js/ -type f -name '*.js.map' -exec rm {} +
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Build complete!"
|
echo "Build complete!"
|
||||||
|
|
|
@ -20,7 +20,7 @@ const terserPlugin = new TerserPlugin({
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
devtool: undefined,
|
devtool: '',
|
||||||
plugins: [
|
plugins: [
|
||||||
new VueLoaderPlugin(),
|
new VueLoaderPlugin(),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue