hedgedoc/bin/setup

48 lines
943 B
Text
Raw Normal View History

2016-10-04 23:21:19 -04:00
#!/bin/bash
set -e
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
if ! type yarn > /dev/null
2016-10-04 23:21:19 -04:00
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
2016-10-04 23:21:19 -04:00
exit 0
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
echo "install packages"
yarn install --pure-lockfile
yarn install --production=false --pure-lockfile
2016-10-04 23:21:19 -04:00
cat << EOF
Edit the following config file to setup CodiMD server and client.
Read more info at https://github.com/hackmdio/codimd#configuration-files
2016-10-04 23:21:19 -04:00
* config.json -- CodiMD 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"