2016-10-04 23:21:19 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-01-23 00:11:20 -05:00
|
|
|
set -e
|
|
|
|
|
2018-11-23 10:58:17 -05: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"; }
|
|
|
|
|
2016-10-04 23:21:19 -04:00
|
|
|
# run command at repo root
|
|
|
|
CURRENT_PATH=$PWD
|
2016-10-14 07:28:54 -04:00
|
|
|
if [ -d .git ]; then
|
2017-10-10 07:36:37 -04:00
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
2016-10-14 07:28:54 -04:00
|
|
|
fi
|
2016-10-04 23:21:19 -04:00
|
|
|
|
2018-09-06 10:00:02 -04:00
|
|
|
if ! type yarn > /dev/null
|
2016-10-04 23:21:19 -04:00
|
|
|
then
|
2016-10-05 02:09:39 -04:00
|
|
|
cat << EOF
|
2018-09-06 10:00:02 -04:00
|
|
|
yarn is not installed, please install Node.js, npm and yarn.
|
2016-10-05 02:09:39 -04:00
|
|
|
Read more on Node.js official website: https://nodejs.org
|
2018-09-06 10:00:02 -04:00
|
|
|
And for yarn package manager at: https://yarnpkg.com/en/
|
2016-10-05 02:09:39 -04:00
|
|
|
Setup will not be run
|
|
|
|
EOF
|
2018-11-23 10:58:17 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if version_lt "$(yarn --version)" '1.3.2'; then
|
|
|
|
cat <<EOF
|
|
|
|
Your yarn version is outdated. Please upgrade to a version
|
|
|
|
newer than 1.3.2.
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if version_lt "$(node --version)" 'v6.0.0'; then
|
|
|
|
cat <<EOF
|
|
|
|
Your node version is outdated. Please upgrade to version 6
|
|
|
|
or higher. (Version 8 or higher is recommended)
|
|
|
|
EOF
|
|
|
|
exit 1
|
2016-10-04 23:21:19 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "copy config files"
|
2016-10-05 00:12:21 -04:00
|
|
|
if [ ! -f config.json ]; then
|
|
|
|
cp config.json.example config.json
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f .sequelizerc ]; then
|
|
|
|
cp .sequelizerc.example .sequelizerc
|
|
|
|
fi
|
2016-10-04 23:21:19 -04:00
|
|
|
|
2018-09-06 10:00:02 -04:00
|
|
|
echo "install packages"
|
|
|
|
yarn install --pure-lockfile
|
|
|
|
yarn install --production=false --pure-lockfile
|
2016-10-04 23:21:19 -04:00
|
|
|
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
|
2020-07-02 11:22:52 -04:00
|
|
|
Edit the following config file to setup HedgeDoc server and client.
|
2020-11-14 16:24:44 -05:00
|
|
|
Read more info at https://github.com/hedgedoc/hedgedoc#configuration-files
|
2016-10-04 23:21:19 -04:00
|
|
|
|
2020-07-02 11:22:52 -04:00
|
|
|
* config.json -- HedgeDoc config
|
2016-10-05 00:07:07 -04:00
|
|
|
* .sequelizerc -- db config
|
2016-10-04 23:21:19 -04:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# change directory back
|
2017-10-10 07:36:37 -04:00
|
|
|
cd "$CURRENT_PATH"
|