summaryrefslogtreecommitdiff
path: root/bin/setup
blob: 2fcc65d644fbc430b0f33164b6563c85954eeb6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

set -e

# run command at repo root
CURRENT_PATH=$PWD
if [ -d .git ]; then
  cd "$(git rev-parse --show-toplevel)"
fi

if ! type yarn > /dev/null
then
  cat << EOF
yarn is not installed, please install Node.js, npm and yarn.
Read more on Node.js official website: https://nodejs.org
And for yarn package manager at: https://yarnpkg.com/en/
Setup will not be run
EOF
  exit 0
fi

echo "copy config files"
if [ ! -f config.json ]; then
  cp config.json.example config.json
fi

if [ ! -f .sequelizerc ]; then
  cp .sequelizerc.example .sequelizerc
fi

echo "install packages"
yarn install --pure-lockfile
yarn install --production=false --pure-lockfile

cat << EOF


Edit the following config file to setup HedgeDoc server and client.
Read more info at https://github.com/hedgedoc/hedgedoc#configuration-files

* config.json           -- HedgeDoc config
* .sequelizerc          -- db config

EOF

# change directory back
cd "$CURRENT_PATH"