#!/bin/bash if [ -z "$NPM_PACKAGE_TO_INSTALL" ]; then echo "Warning: NPM_PACKAGE_TO_INSTALL is not defined !" echo "Switching back to the default S2I behavior" exec "$STI_SCRIPTS_PATH/assemble" fi # Exit on any error set -e echo "---> Installing application from NPM ..." npm install "$NPM_PACKAGE_TO_INSTALL" # Trim package name (remove the version number) package_name="${NPM_PACKAGE_TO_INSTALL%@*}" echo "---> Generating symlinks ..." for file in node_modules/$package_name/*; do from="$file" to="$(basename "$file")" # Avoid recursive loops if [ "$to" == "node_modules" ]; then continue fi echo " - $from => $to" ln -s "$from" "$to" done fix-permissions ./