2018-10-28 22:59:15 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function execute_tsc() {
|
2018-12-15 13:04:29 +00:00
|
|
|
execute_npm_command tsc $@
|
|
|
|
}
|
2018-10-28 22:59:15 +00:00
|
|
|
|
2018-12-15 13:04:29 +00:00
|
|
|
function execute_ttsc() {
|
|
|
|
execute_npm_command ttsc $@
|
|
|
|
}
|
2018-10-28 22:59:15 +00:00
|
|
|
|
2018-12-15 13:04:29 +00:00
|
|
|
function execute_npm_command() {
|
|
|
|
command_name=$1
|
|
|
|
command_variable="command_$command_name"
|
|
|
|
#echo "Variable names $command_variable"
|
2018-10-28 22:59:15 +00:00
|
|
|
|
2018-12-15 13:04:29 +00:00
|
|
|
if [ "${!command_variable}" == "" ]; then
|
|
|
|
node_bin=$(npm bin)
|
|
|
|
#echo "Node root ${node_bin}"
|
|
|
|
|
|
|
|
if [ ! -e "${node_bin}/${command_name}" ]; then
|
|
|
|
echo "Could not find \"$command_name\" command"
|
|
|
|
echo "May type npm install"
|
2018-10-28 22:59:15 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2018-12-15 13:04:29 +00:00
|
|
|
|
|
|
|
eval "${command_variable}=\"${node_bin}/${command_name}\""
|
2018-10-28 22:59:15 +00:00
|
|
|
fi
|
|
|
|
|
2018-12-15 13:04:29 +00:00
|
|
|
echo "Arguments: ${@:2}"
|
|
|
|
${!command_variable} ${@:2}
|
2018-10-28 22:59:15 +00:00
|
|
|
}
|