TeaWeb/shared/generate_declarations.sh

29 lines
810 B
Bash
Raw Permalink Normal View History

2019-09-01 15:24:06 +00:00
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
2020-03-28 12:58:36 +00:00
cd "$BASEDIR" || { echo "Failed to enter script base dir"; exit 1; }
2019-09-01 15:24:06 +00:00
function generate_declaration() {
echo "Generating declarations for project $1 ($2)"
if [[ -d "${2}" ]]; then
rm -r "${2}"; _exit_code=$?
2020-03-28 12:58:36 +00:00
if [[ $_exit_code -ne 0 ]]; then
echo "Failed to remove old declaration file ($2): $_exit_code!"
2019-09-01 15:24:06 +00:00
echo "This could be critical later!"
fi
fi
2021-01-08 20:41:26 +00:00
npm run tsc -- --project "$(pwd)/tsconfig/$1"
2019-09-01 15:24:06 +00:00
if [[ ! -e $2 ]]; then
echo "Failed to generate definitions"
exit 1
fi
}
#Generate the loader definitions first
app_declaration="../declarations/shared-app/"
2020-12-12 21:43:47 +00:00
generate_declaration tsconfig.declarations.json ${app_declaration}
2020-08-09 12:30:17 +00:00
cp -r svg-sprites "../declarations/svg-sprites"
2019-09-01 15:24:06 +00:00
exit 0