2016-10-04 23:21:19 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-01-23 00:11:20 -05:00
|
|
|
set -e
|
|
|
|
|
2020-11-17 15:22:48 -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"; }
|
2018-11-23 10:58:17 -05:00
|
|
|
|
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
|
|
|
|
2020-11-17 15:29:54 -05:00
|
|
|
if ! type yarn > /dev/null; then
|
2016-10-05 02:09:39 -04:00
|
|
|
cat << EOF
|
2020-11-17 14:32:30 -05: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 02:09:39 -04:00
|
|
|
EOF
|
2018-11-23 10:58:17 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-11-17 14:39:50 -05:00
|
|
|
if version_lt "$(yarn --version)" '1.22.0'; then
|
2020-11-17 15:29:54 -05:00
|
|
|
cat << EOF
|
2021-04-22 12:56:52 -04:00
|
|
|
FATAL: Your Yarn version is not supported.
|
2020-11-17 14:39:50 -05:00
|
|
|
|
2020-11-17 14:53:58 -05:00
|
|
|
Please upgrade to version 1.22.0 or higher and try again.
|
2020-11-17 14:39:50 -05:00
|
|
|
See https://classic.yarnpkg.com/en/docs/install for instructions.
|
2018-11-23 10:58:17 -05:00
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-04-22 12:46:01 -04:00
|
|
|
if version_lt "$(node --version)" 'v12.0.0'; then
|
2020-11-17 15:29:54 -05:00
|
|
|
cat << EOF
|
2021-04-22 12:56:52 -04:00
|
|
|
FATAL: Your Node.js version is not supported.
|
2020-11-17 14:39:50 -05:00
|
|
|
|
2021-04-22 12:46:01 -04:00
|
|
|
Please upgrade to version 12 or higher and try again.
|
2020-11-17 14:32:30 -05:00
|
|
|
We recommend running the latest LTS release, see https://nodejs.org/en/about/releases/ for details.
|
2018-11-23 10:58:17 -05:00
|
|
|
EOF
|
|
|
|
exit 1
|
2016-10-04 23:21:19 -04:00
|
|
|
fi
|
|
|
|
|
2020-11-17 14:32:30 -05:00
|
|
|
echo "Copying config files..."
|
2016-10-05 00:12:21 -04:00
|
|
|
if [ ! -f config.json ]; then
|
|
|
|
cp config.json.example config.json
|
|
|
|
fi
|
|
|
|
|
2020-11-17 14:32:30 -05:00
|
|
|
echo "Installing packages..."
|
2021-05-05 09:38:00 -04:00
|
|
|
yarn install --production=true --pure-lockfile
|
2016-10-04 23:21:19 -04:00
|
|
|
|
|
|
|
cat << EOF
|
2021-05-08 04:08:21 -04:00
|
|
|
If you want to build the frontend yourself, you need to run 'yarn install' before 'yarn build' to install the devDependencies for the build process.
|
2016-10-04 23:21:19 -04:00
|
|
|
|
2020-07-02 11:22:52 -04:00
|
|
|
Edit the following config file to setup HedgeDoc server and client.
|
2021-03-06 04:36:24 -05:00
|
|
|
Read more info at https://docs.hedgedoc.org/configuration/
|
2016-10-04 23:21:19 -04:00
|
|
|
|
2020-07-02 11:22:52 -04:00
|
|
|
* config.json -- HedgeDoc config
|
2016-10-04 23:21:19 -04:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# change directory back
|
2017-10-10 07:36:37 -04:00
|
|
|
cd "$CURRENT_PATH"
|