Small fixes and cleanup of package scripts

This commit is contained in:
Pieter Vander Vennet 2021-12-22 23:50:43 +01:00
parent 630bcd8dad
commit 220d65ef85
4 changed files with 15 additions and 48 deletions

View file

@ -8,25 +8,27 @@ rm -rf .cache
mkdir dist 2> /dev/null
mkdir dist/assets 2> /dev/null
npm run generate
npm run test
npm run generate:editor-layer-index
npm run generate:layouts
# Copy the layer files, as these might contain assets (e.g. svgs)
cp -r assets/layers/ dist/assets/layers/
cp -r assets/themes/ dist/assets/themes/
cp -r assets/svg/ dist/assets/svg/
echo "\n\n Building non-theme pages"
echo " ==========================\n\n"
parcel build --no-source-maps "index.html" "404.html" "professional.html" "automaton.html" "land.html" "customGenerator.html" "theme.html" vendor
echo "\n\n Building theme pages"
echo " ======================\n\n"
echo -e "\n\n Building non-theme pages"
echo -e " ==========================\n\n"
parcel build --public-url "./" --no-source-maps "index.html" "404.html" "professional.html" "automaton.html" "land.html" "customGenerator.html" "theme.html" vendor
echo -e "\n\n Building theme pages"
echo -e " ======================\n\n"
for file in $(ls index_*.ts)
do
theme=${file:6:-3}
echo "\n\n $theme"
echo " ------------ \n\n"
echo -e "\n\n $theme"
echo -e " ------------ \n\n"
# Builds the necessary files for just one theme, e.g. 'bookcases.html' + 'index_bookcases.ts' + supporting file
# npm run generate && node --max_old_space_size=12000 $(which parcel) build
parcel build --no-source-maps "$theme.html"
parcel build --public-url "./" --no-source-maps "$theme.html"
done
# Optimize images
cd dist/ && find -name '*.png' -exec optipng '{}' \; && echo 'PNGs are optimized'