2016-10-05 03:21:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-01-23 05:11:20 +00:00
|
|
|
set -e
|
|
|
|
|
2020-11-17 20:22:48 +00:00
|
|
|
version_lt() { test "$(printf '%s\n' "$@" | { [ "$(uname)" = "Linux" ] && (sort -V || sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n;) } | tail -n 1)" != "$1"; }
|
2018-11-23 15:58:17 +00:00
|
|
|
|
2016-10-05 03:21:19 +00:00
|
|
|
# run command at repo root
|
|
|
|
CURRENT_PATH=$PWD
|
2016-10-14 11:28:54 +00:00
|
|
|
if [ -d .git ]; then
|
2017-10-10 11:36:37 +00:00
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
2016-10-14 11:28:54 +00:00
|
|
|
fi
|
2016-10-05 03:21:19 +00:00
|
|
|
|
2018-09-06 14:00:02 +00:00
|
|
|
if ! type yarn > /dev/null
|
2016-10-05 03:21:19 +00:00
|
|
|
then
|
2016-10-05 06:09:39 +00:00
|
|
|
cat << EOF
|
2020-11-17 19:32:30 +00:00
|
|
|
FATAL: Yarn could not be found.
|
|
|
|
|
|
|
|
Please follow the official installation instructions at
|
|
|
|
https://classic.yarnpkg.com/en/docs/install
|
|
|
|
and try again.
|
2016-10-05 06:09:39 +00:00
|
|
|
EOF
|
2018-11-23 15:58:17 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-11-17 19:39:50 +00:00
|
|
|
if version_lt "$(yarn --version)" '1.22.0'; then
|
2018-11-23 15:58:17 +00:00
|
|
|
cat <<EOF
|
2020-11-17 19:39:50 +00:00
|
|
|
FATAL: Your Yarn version is outdated.
|
|
|
|
|
2020-11-17 19:53:58 +00:00
|
|
|
Please upgrade to version 1.22.0 or higher and try again.
|
2020-11-17 19:39:50 +00:00
|
|
|
See https://classic.yarnpkg.com/en/docs/install for instructions.
|
2018-11-23 15:58:17 +00:00
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-11-17 19:39:50 +00:00
|
|
|
if version_lt "$(node --version)" 'v10.13.0'; then
|
2018-11-23 15:58:17 +00:00
|
|
|
cat <<EOF
|
2020-11-17 19:39:50 +00:00
|
|
|
FATAL: Your Node.js version is outdated.
|
|
|
|
|
2020-11-17 19:32:30 +00:00
|
|
|
Please upgrade to version 10.13 or higher and try again.
|
|
|
|
We recommend running the latest LTS release, see https://nodejs.org/en/about/releases/ for details.
|
2018-11-23 15:58:17 +00:00
|
|
|
EOF
|
|
|
|
exit 1
|
2016-10-05 03:21:19 +00:00
|
|
|
fi
|
|
|
|
|
2020-11-17 19:32:30 +00:00
|
|
|
echo "Copying config files..."
|
2016-10-05 04:12:21 +00:00
|
|
|
if [ ! -f config.json ]; then
|
|
|
|
cp config.json.example config.json
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f .sequelizerc ]; then
|
|
|
|
cp .sequelizerc.example .sequelizerc
|
|
|
|
fi
|
2016-10-05 03:21:19 +00:00
|
|
|
|
2020-11-17 19:32:30 +00:00
|
|
|
echo "Installing packages..."
|
2018-09-06 14:00:02 +00:00
|
|
|
yarn install --pure-lockfile
|
|
|
|
yarn install --production=false --pure-lockfile
|
2016-10-05 03:21:19 +00:00
|
|
|
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
|
2020-07-02 15:22:52 +00:00
|
|
|
Edit the following config file to setup HedgeDoc server and client.
|
2020-11-14 21:24:44 +00:00
|
|
|
Read more info at https://github.com/hedgedoc/hedgedoc#configuration-files
|
2016-10-05 03:21:19 +00:00
|
|
|
|
2020-07-02 15:22:52 +00:00
|
|
|
* config.json -- HedgeDoc config
|
2016-10-05 04:07:07 +00:00
|
|
|
* .sequelizerc -- db config
|
2016-10-05 03:21:19 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# change directory back
|
2017-10-10 11:36:37 +00:00
|
|
|
cd "$CURRENT_PATH"
|