etherpad-lite/src/bin/installDeps.sh
SamTV12345 049231e4af
Feature/axios (#5776)
* Move from deprecated request package to axios.

* Fixed package.json

* Another check.

* Fixing npm - hopefully the last.

* Remove double parsing of JSON.

* Bump bundled npm to also get rid of request in the bundled npm.

* Revert "Bump bundled npm to also get rid of request in the bundled npm."

This reverts commit b60fa4f435c141bca332a5b344c36204eb0cc7b4.
2023-06-27 21:20:53 +02:00

52 lines
1.4 KiB
Bash
Executable file

#!/bin/sh
# Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1
# 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 )"
# Is npm installed?
is_cmd npm || fatal "Please install npm ( https://npmjs.org )"
# Check npm version
require_minimal_version "npm" "$(get_program_version "npm")" \
"$REQUIRED_NPM_MAJOR" "$REQUIRED_NPM_MINOR"
# Check node version
require_minimal_version "nodejs" "$(get_program_version "node")" \
"$REQUIRED_NODE_MAJOR" "$REQUIRED_NODE_MINOR"
# 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
fi
log "Installing dependencies..."
(
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
# Remove all minified data to force node creating it new
log "Clearing minified cache..."
rm -f var/minified*
exit 0