alfresco-ng2-components/scripts/npm-build-all.sh
2019-08-29 20:15:10 +01:00

72 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -f
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval EXEC_GIT_NPM_INSTALL_JSAPI=false
eval GIT_ISH=""
eval EXEC_VERSION_JSAPI=false
eval JSAPI_VERSION=""
eval projects=( "core"
"content-services"
"insights"
"testing"
"process-services"
"process-services-cloud"
"extensions" )
show_help() {
echo "Usage: npm-build-all.sh"
echo ""
echo "-gitjsapi <commit-ish> Build all the components against a commit-ish version of the JS-API"
echo "-vjsapi <commit-ish> Install different version from npm of JS-API defined in the package.json"
}
enable_js_api_git_link() {
GIT_ISH='git://github.com/Alfresco/alfresco-js-api.git#'$1
EXEC_GIT_NPM_INSTALL_JSAPI=true
}
version_js_api() {
JSAPI_VERSION=$1
if [[ "${JSAPI_VERSION}" == "" ]]
then
echo "JSAPI version required with -vJSApi"
exit 0
fi
EXEC_VERSION_JSAPI=true
}
exec_install(){
EXEC_INSTALL=false
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-gitjsapi) enable_js_api_git_link $2; shift 2;;
-vjsapi) version_js_api $2; shift 2;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
esac
done
cd "$DIR/../"
if $EXEC_GIT_NPM_INSTALL_JSAPI == true; then
echo "====== Use the alfresco JS-API '$GIT_ISH'====="
npm install $GIT_ISH --no-save
cd "$DIR/../node_modules/alfresco-js-api"
npm install
cd "$DIR/../"
fi
if $EXEC_VERSION_JSAPI == true; then
echo "====== Use the alfresco JS-API '$JSAPI_VERSION'====="
npm install alfresco-js-api@${JSAPI_VERSION} --no-save
fi
echo "====== Build components ====="
./scripts/build/build-all-lib.sh