2018-11-01 00:20:25 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
/etc/init.d/postgresql stop
|
|
|
|
echo "Usage: $0 [nodejs10|nodejs6]"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "$0 $1"
|
|
|
|
|
2018-04-27 21:46:57 +08:00
|
|
|
# start PostgreSQL
|
|
|
|
/etc/init.d/postgresql start
|
2017-10-07 00:24:11 +08:00
|
|
|
|
2018-11-01 00:20:25 +08:00
|
|
|
echo "Node.js version:"
|
|
|
|
node -v
|
|
|
|
|
2018-04-27 21:46:57 +08:00
|
|
|
# install dependencies
|
2018-11-01 00:20:25 +08:00
|
|
|
NODEJS_VERSION=${1-nodejs10}
|
|
|
|
|
|
|
|
if [ "$NODEJS_VERSION" = "nodejs10" ];
|
|
|
|
then
|
2018-11-02 20:30:24 +08:00
|
|
|
echo "npm version on install:"
|
2018-11-01 00:20:25 +08:00
|
|
|
npm -v
|
|
|
|
npm install
|
2018-11-06 19:35:10 +08:00
|
|
|
npm ls
|
2018-11-01 00:20:25 +08:00
|
|
|
elif [ "$NODEJS_VERSION" = "nodejs6" ];
|
|
|
|
then
|
|
|
|
npm install -g yarn@0.27.5
|
2018-11-02 20:57:30 +08:00
|
|
|
echo "yarn version on install:"
|
|
|
|
yarn --version
|
2018-11-01 00:20:25 +08:00
|
|
|
yarn
|
|
|
|
else
|
|
|
|
usage
|
|
|
|
fi
|
2017-10-07 00:24:11 +08:00
|
|
|
|
2018-04-27 21:46:57 +08:00
|
|
|
# run tests
|
2018-11-02 20:30:24 +08:00
|
|
|
echo "npm version on tests:"
|
|
|
|
npm -v
|
|
|
|
|
2018-11-02 19:24:01 +08:00
|
|
|
npm test
|