mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 10:15:17 -04:00
Merge pull request #5 from SISheogorath/fix/setupVersions
Add some version checks to setup script
This commit is contained in:
commit
b111d1f7fd
1 changed files with 31 additions and 10 deletions
41
bin/setup
41
bin/setup
|
@ -2,24 +2,46 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
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"; }
|
||||||
|
|
||||||
# run command at repo root
|
# run command at repo root
|
||||||
CURRENT_PATH=$PWD
|
CURRENT_PATH=$PWD
|
||||||
if [ -d .git ]; then
|
if [ -d .git ]; then
|
||||||
cd "$(git rev-parse --show-toplevel)"
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! type yarn > /dev/null
|
if ! type yarn > /dev/null; then
|
||||||
then
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
yarn is not installed, please install Node.js, npm and yarn.
|
FATAL: Yarn could not be found.
|
||||||
Read more on Node.js official website: https://nodejs.org
|
|
||||||
And for yarn package manager at: https://yarnpkg.com/en/
|
Please follow the official installation instructions at
|
||||||
Setup will not be run
|
https://classic.yarnpkg.com/en/docs/install
|
||||||
|
and try again.
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "copy config files"
|
if version_lt "$(yarn --version)" '1.22.0'; then
|
||||||
|
cat << EOF
|
||||||
|
FATAL: Your Yarn version is outdated.
|
||||||
|
|
||||||
|
Please upgrade to version 1.22.0 or higher and try again.
|
||||||
|
See https://classic.yarnpkg.com/en/docs/install for instructions.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if version_lt "$(node --version)" 'v10.13.0'; then
|
||||||
|
cat << EOF
|
||||||
|
FATAL: Your Node.js version is outdated.
|
||||||
|
|
||||||
|
Please upgrade to version 10.13 or higher and try again.
|
||||||
|
We recommend running the latest LTS release, see https://nodejs.org/en/about/releases/ for details.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Copying config files..."
|
||||||
if [ ! -f config.json ]; then
|
if [ ! -f config.json ]; then
|
||||||
cp config.json.example config.json
|
cp config.json.example config.json
|
||||||
fi
|
fi
|
||||||
|
@ -28,7 +50,7 @@ if [ ! -f .sequelizerc ]; then
|
||||||
cp .sequelizerc.example .sequelizerc
|
cp .sequelizerc.example .sequelizerc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "install packages"
|
echo "Installing packages..."
|
||||||
yarn install --pure-lockfile
|
yarn install --pure-lockfile
|
||||||
yarn install --production=false --pure-lockfile
|
yarn install --production=false --pure-lockfile
|
||||||
|
|
||||||
|
@ -40,7 +62,6 @@ Read more info at https://github.com/hedgedoc/hedgedoc#configuration-files
|
||||||
|
|
||||||
* config.json -- HedgeDoc config
|
* config.json -- HedgeDoc config
|
||||||
* .sequelizerc -- db config
|
* .sequelizerc -- db config
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# change directory back
|
# change directory back
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue