TeaWeb/web/generate_packed.sh

37 lines
890 B
Bash
Raw Normal View History

2018-10-28 22:01:09 +00:00
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
cd "$BASEDIR"
2018-10-28 22:59:15 +00:00
source ../scripts/resolve_commands.sh
2018-10-28 22:01:09 +00:00
2019-08-30 21:06:39 +00:00
if [[ ! -e declarations/imports_shared.d.ts ]]; then
2018-10-28 22:01:09 +00:00
echo "generate the declarations first!"
echo "Execute: /scripts/build_declarations.sh"
exit 1
fi
2019-08-30 21:06:39 +00:00
if [[ ! -e ../shared/generated/shared.js ]]; then
2018-10-28 22:01:09 +00:00
echo "generate the shared packed file first!"
echo "Execute: /shared/generate_packed.sh"
exit 1
fi
2018-10-28 22:59:15 +00:00
execute_tsc -p tsconfig/tsconfig_packed.json
2019-08-30 21:06:39 +00:00
if [[ $? -ne 0 ]]; then
2018-10-28 22:01:09 +00:00
echo "Failed to build file"
exit 1
fi
2019-08-30 21:06:39 +00:00
echo "Merging files"
2019-08-30 21:06:39 +00:00
if [[ -e generated/client.js ]]; then
rm generated/client.js
fi
cat ../shared/generated/shared.js > generated/client.js
cat generated/web.js >> generated/client.js
2019-08-30 21:06:39 +00:00
if [[ -e generated/client.min.js ]]; then
rm generated/client.min.js
fi
npm run minify-web-rel-file `pwd`/generated/client.min.js `pwd`/generated/client.js