A NodeJS application to use in OpenShift
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
693 B

#!/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 ./