mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-08 09:55:32 +00:00
55 lines
No EOL
1.6 KiB
Bash
Executable file
55 lines
No EOL
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Compiles common TS-based utility functions for use among Keyman's codebase
|
|
|
|
set -eu
|
|
|
|
## START STANDARD BUILD SCRIPT INCLUDE
|
|
# adjust relative paths as necessary
|
|
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
|
|
. "${THIS_SCRIPT%/*}/../../../resources/build/build-utils.sh"
|
|
## END STANDARD BUILD SCRIPT INCLUDE
|
|
|
|
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
|
|
|
|
cd "$THIS_SCRIPT_PATH"
|
|
|
|
################################ Main script ################################
|
|
|
|
builder_describe \
|
|
"Compiles the web-oriented utility function module." \
|
|
"@/common/web/keyman-version" \
|
|
"@/common/web/es-bundling" \
|
|
clean configure build test \
|
|
"--ci For use with action ${BUILDER_TERM_START}test${BUILDER_TERM_END} - emits CI-friendly test reports"
|
|
|
|
builder_describe_outputs \
|
|
configure "/node_modules" \
|
|
build "/common/web/utils/build/obj/index.js"
|
|
|
|
builder_parse "$@"
|
|
|
|
function do_build() {
|
|
tsc --build "$THIS_SCRIPT_PATH/tsconfig.json"
|
|
|
|
# May be useful one day, for building a mass .d.ts for KMW as a whole.
|
|
# So... tsc does declaration-bundling on its own pretty well, at least for local development.
|
|
tsc --emitDeclarationOnly --outFile ./build/lib/index.d.ts
|
|
}
|
|
|
|
function do_test() {
|
|
builder_heading "Running web-utils test suite"
|
|
|
|
local FLAGS=
|
|
if builder_has_option --ci; then
|
|
echo "Replacing user-friendly test reports with CI-friendly versions."
|
|
FLAGS="$FLAGS --reporter mocha-teamcity-reporter"
|
|
fi
|
|
|
|
c8 mocha --recursive $FLAGS ./src/test/
|
|
}
|
|
|
|
builder_run_action configure verify_npm_setup
|
|
builder_run_action clean rm -rf build/
|
|
builder_run_action build do_build
|
|
builder_run_action test do_test |