New "npm run build:conversejs-no-loc" to build more quickly when

developing.
This commit is contained in:
John Livingston 2024-04-10 18:47:27 +02:00
parent 2047282b98
commit 922edbe5b3
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
2 changed files with 22 additions and 9 deletions

View File

@ -1,5 +1,11 @@
#!/bin/bash
NO_CONVERSEJS_LOC=""
if [ "$1" = "no-loc" ]; then
echo "We won't generate ConverseJS localization files!"
NO_CONVERSEJS_LOC="1"
fi
set -euo pipefail
set -x
@ -94,15 +100,21 @@ fi
echo "Building ConverseJS..."
cd "$converse_build_dir"
# Note: following lines are from the ConverseJS Makefile (see "make dist" code), where we just replace the "npm run build" with our webpack.livechat.js.
# Ideally this should just be `npm run build`.
# The additional steps are necessary to properly generate JSON chunk files
# from the .po files. The nodeps config uses preset-env with IE11.
# Somehow this is necessary.
npm run nodeps
TMPD=$(mktemp -d)
mv dist/locales $TMPD && npx webpack --config webpack.livechat.js && mv $TMPD/locales/*-po.js dist/locales/ && rm -rf $TMPD
rm dist/converse-no-dependencies.js dist/converse-no-dependencies.js.map
if [ "$NO_CONVERSEJS_LOC" = "1" ]; then
echo "Building without ConverseJS localization files!"
# shortcut to build more quickly for dev purpose (see npm run build:converjs-no-loc)
npx webpack --config webpack.livechat.js
else
# Note: following lines are from the ConverseJS Makefile (see "make dist" code), where we just replace the "npm run build" with our webpack.livechat.js.
# Ideally this should just be `npm run build`.
# The additional steps are necessary to properly generate JSON chunk files
# from the .po files. The nodeps config uses preset-env with IE11.
# Somehow this is necessary.
npm run nodeps
TMPD=$(mktemp -d)
mv dist/locales $TMPD && npx webpack --config webpack.livechat.js && mv $TMPD/locales/*-po.js dist/locales/ && rm -rf $TMPD
rm dist/converse-no-dependencies.js dist/converse-no-dependencies.js.map
fi
cd $rootdir

View File

@ -94,6 +94,7 @@
"clean:light": "rm -rf dist/* support/documentation/content/translations/* support/documentation/i18n/*",
"prepare": "npm run clean && npm run build",
"build:converse": "bash conversejs/build-conversejs.sh",
"build:converse-no-loc": "bash conversejs/build-conversejs.sh no-loc",
"build:prosody": "bash build-prosody.sh",
"build:images": "mkdir -p dist/client/images && npx svgo -f assets/images/ -o dist/client/images/",
"build:avatars": "./build-avatars.js",