weblate/scripts/yarn-update
Michal Čihař 154a069b00 Avoid blocking on font load
See https://developers.google.com/web/updates/2016/02/font-display

Signed-off-by: Michal Čihař <michal@cihar.com>
2019-07-18 15:09:58 +02:00

72 lines
2.8 KiB
Bash
Executable file
Vendored

#!/bin/sh
# Wrapper around yarn to update our javascript dependencies
set -e
cd scripts/yarn/
yarn install --check-files
yarn upgrade-interactive
yarn run build --scripts-prepend-node-path
# Bootstrap Datepicker
cp node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css ../../weblate/static/bootstrap/css/
cp node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.js ../../weblate/static/bootstrap/js/
# Font Awesome
cp node_modules/font-awesome/fonts/fontawesome-webfont.* ../../weblate/static/font-awesome/fonts/
cp node_modules/font-awesome/css/font-awesome.css ../../weblate/static/font-awesome/css/
# Font Linux
cp node_modules/font-linux/assets/font-linux.* ../../weblate/static/font-linux/
# Autosize
cp node_modules/autosize/dist/autosize.js ../../weblate/static/js/
# Chartist
cp node_modules/chartist/dist/chartist.css ../../weblate/static/
cp node_modules/chartist/dist/chartist.js ../../weblate/static/js/
# Mousetrap
cp node_modules/mousetrap/mousetrap.js ../../weblate/static/js/
# Mousetrap global bind
cp node_modules/mousetrap-global-bind/mousetrap-global-bind.js ../../weblate/static/js/
dos2unix -q ../../weblate/static/js/mousetrap-global-bind.js
# js.cookie
cp node_modules/js-cookie/src/js.cookie.js ../../weblate/static/js/
# jQuery
cp node_modules/jquery/dist/jquery.js ../../weblate/static/js/
# Clipboard
cp node_modules/clipboard/dist/clipboard.js ../../weblate/static/js/
# multi.js
cp node_modules/multi.js/src/multi.js ../../weblate/static/js/
cp node_modules/multi.js/src/multi.css ../../weblate/static/
# Modernizr
mv modernizr.js ../../weblate/static/js/
# Slugify
cp node_modules/slugify/index.js ../../weblate/static/js/slugify.js
# Source Sans/Code Pro fonts
sed '/font-family/ a font-display: swap;' < node_modules/source-sans-pro/source-sans-pro.css > ../../weblate/static/font-source/source-sans-pro.css
sed '/font-family/ a font-display: swap;' < node_modules/source-code-pro/source-code-pro.css > ../../weblate/static/font-source/source-code-pro.css
find node_modules/source-sans-pro/ node_modules/source-code-pro/ -name SourceSansPro-ExtraLight.* -o -name SourceSansPro-Light.* -o -name SourceSansPro-Semibold.* -o -name SourceSansPro-Black.* -o -name SourceSansPro-Bold.* -o -name SourceSansPro-Regular.* -o -name SourceSansPro-It.* -o -name SourceSansPro-BoldIt.* -o -name SourceCodePro-Regular.* -o -name SourceCodePro-Bold.* | while read name ; do
target=`echo $name | sed 's@node_modules/source-\(sans\|code\)-pro/@../../weblate/static/font-source/@'`
dir=`dirname $target`
if [ ! -d $dir ] ; then
mkdir -p $dir
fi
cp $name $target
done
# DejaVu font
cp node_modules/dejavu-fonts-ttf/ttf/DejaVuSans.ttf node_modules/dejavu-fonts-ttf/ttf/DejaVuSans-Bold.ttf ../../weblate/static/font-dejavu
# Not updated:
# Bootstrap, use online customizer
# bootstrap-rtl as the version in yarn is outdated