26 lines
617 B
Bash
Executable File
26 lines
617 B
Bash
Executable File
#!/bin/bash
|
|
script_dir=$(dirname $0)
|
|
script="${script_dir}/dist/bin/${1}.js"
|
|
|
|
if [[ -z "$1" ]]; then
|
|
echo "usage: $(basename $0) <command>"
|
|
echo ""
|
|
echo "Available commands are"
|
|
echo ""
|
|
find ${script_dir}/dist/bin -name \*.js -exec basename {} .js \;
|
|
exit -1
|
|
fi
|
|
|
|
# For scripts that need config access
|
|
export NODE_CONFIG_DIR="${script_dir}/config"
|
|
export NODE_ENV=production
|
|
|
|
if [[ ! -e "${script}" ]]; then
|
|
echo error: Script ${script} does not exist
|
|
exit -1
|
|
fi
|
|
|
|
shift
|
|
# See https://stackoverflow.com/questions/448407/bash-script-to-receive-and-repass-quoted-parameters
|
|
babel-node -- "${script}" "$@"
|