etherpad-lite/src/bin/installDeps.sh

53 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/sh
# Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1
2011-07-27 15:37:12 +02:00
2021-02-03 00:30:07 +01:00
# Source constants and useful functions
. src/bin/functions.sh
# Is node installed?
# Not checking io.js, default installation creates a symbolic link to node
is_cmd node || fatal "Please install node.js ( https://nodejs.org )"
2011-07-27 15:37:12 +02:00
# Is npm installed?
is_cmd npm || fatal "Please install npm ( https://npmjs.org )"
2011-07-27 15:37:12 +02:00
# Check npm version
require_minimal_version "npm" "$(get_program_version "npm")" \
2021-09-06 01:24:17 +02:00
"$REQUIRED_NPM_MAJOR" "$REQUIRED_NPM_MINOR"
2011-08-11 16:09:05 +02:00
# Check node version
require_minimal_version "nodejs" "$(get_program_version "node")" \
2021-09-06 01:24:17 +02:00
"$REQUIRED_NODE_MAJOR" "$REQUIRED_NODE_MINOR"
2012-01-26 12:55:54 +01:00
# Get the name of the settings file
settings="settings.json"
a='';
for arg in "$@"; do
if [ "$a" = "--settings" ] || [ "$a" = "-s" ]; then settings=$arg; fi
a=$arg
done
# Does a $settings exist? if not copy the template
if [ ! -f "$settings" ]; then
log "Copy the settings template to $settings..."
cp settings.json.template "$settings" || exit 1
2011-07-27 15:37:12 +02:00
fi
2021-09-06 01:23:01 +02:00
log "Installing dependencies..."
2012-02-26 13:31:47 +01:00
(
2021-09-06 01:36:05 +02:00
mkdir -p node_modules &&
cd node_modules &&
{ [ -d ep_etherpad-lite ] || ln -sf ../src ep_etherpad-lite; } &&
cd ep_etherpad-lite &&
npm ci --no-optional --omit=optional --include=dev --lockfile-version 1
) || exit 1
2011-07-27 15:37:12 +02:00
# Remove all minified data to force node creating it new
log "Clearing minified cache..."
2011-07-27 15:37:12 +02:00
rm -f var/minified*
exit 0