2016-10-05 03:21:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-01-23 05:11:20 +00:00
|
|
|
set -e
|
|
|
|
|
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
|
2018-09-06 14:00:02 +00:00
|
|
|
yarn is not installed, please install Node.js, npm and yarn.
|
2016-10-05 06:09:39 +00:00
|
|
|
Read more on Node.js official website: https://nodejs.org
|
2018-09-06 14:00:02 +00:00
|
|
|
And for yarn package manager at: https://yarnpkg.com/en/
|
2016-10-05 06:09:39 +00:00
|
|
|
Setup will not be run
|
|
|
|
EOF
|
2016-10-05 03:21:19 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "copy 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
|
|
|
|
2018-09-06 14:00:02 +00:00
|
|
|
echo "install packages"
|
|
|
|
yarn install --pure-lockfile
|
|
|
|
yarn install --production=false --pure-lockfile
|
2016-10-05 03:21:19 +00:00
|
|
|
|
|
|
|
cat << EOF
|
|
|
|
|
|
|
|
|
2018-06-22 19:07:30 +00:00
|
|
|
Edit the following config file to setup CodiMD server and client.
|
2019-03-27 18:31:20 +00:00
|
|
|
Read more info at https://github.com/codimd/server#configuration-files
|
2016-10-05 03:21:19 +00:00
|
|
|
|
2018-06-22 19:07:30 +00:00
|
|
|
* config.json -- CodiMD 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"
|