TeaWeb/shared/generate_declarations.sh

34 lines
1.1 KiB
Bash
Raw 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
source ../scripts/resolve_commands.sh
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
2020-03-28 12:58:36 +00:00
npm run dtsgen -- --config "$(pwd)/tsconfig/$1" -v
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/"
loader_declaration_app="../declarations/loader/"
# loader_declaration_certaccept="declarations/exports_loader_certaccept.d.ts"
2019-09-01 15:24:06 +00:00
generate_declaration dtsconfig_app.json ${app_declaration}
generate_declaration dtsconfig_loader_app.json ${loader_declaration_app}
# generate_declaration dtsconfig_loader_certaccept.json ${loader_declaration_certaccept}
2019-09-01 15:24:06 +00:00
exit 0