2018-11-08 02:03:52 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
/etc/init.d/postgresql stop
|
|
|
|
echo "Usage: $0 [nodejs10|nodejs6]"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "$0 $1"
|
|
|
|
|
2018-04-27 22:12:47 +08:00
|
|
|
# start PostgreSQL
|
|
|
|
/etc/init.d/postgresql start
|
|
|
|
|
2018-11-08 02:21:46 +08:00
|
|
|
# Configure
|
|
|
|
./configure
|
|
|
|
|
2018-11-08 02:03:52 +08:00
|
|
|
echo "Node.js version:"
|
|
|
|
node -v
|
2018-04-27 22:38:36 +08:00
|
|
|
|
2018-04-27 22:12:47 +08:00
|
|
|
# install dependencies
|
2018-11-08 02:03:52 +08:00
|
|
|
NODEJS_VERSION=${1-nodejs10}
|
|
|
|
|
|
|
|
if [ "$NODEJS_VERSION" = "nodejs10" ];
|
|
|
|
then
|
|
|
|
echo "npm version on install:"
|
|
|
|
npm -v
|
2018-11-08 03:24:14 +08:00
|
|
|
mv npm-shrinkwrap.json npm-shrinkwrap.json.backup
|
2018-11-08 02:03:52 +08:00
|
|
|
npm ci
|
|
|
|
npm ls
|
2018-11-08 03:24:14 +08:00
|
|
|
mv npm-shrinkwrap.json.backup npm-shrinkwrap.json
|
2018-11-08 02:03:52 +08:00
|
|
|
elif [ "$NODEJS_VERSION" = "nodejs6" ];
|
|
|
|
then
|
|
|
|
echo "npm version on install:"
|
|
|
|
npm -v
|
2018-11-08 03:24:14 +08:00
|
|
|
mv package-lock.json package-lock.json.backup
|
2018-11-08 02:03:52 +08:00
|
|
|
npm i
|
|
|
|
npm ls
|
2018-11-08 03:24:14 +08:00
|
|
|
mv package-lock.json.backup package-lock.json
|
2018-11-08 02:03:52 +08:00
|
|
|
else
|
|
|
|
usage
|
|
|
|
fi
|
2018-04-27 22:12:47 +08:00
|
|
|
|
|
|
|
# run tests
|
2018-11-08 02:03:52 +08:00
|
|
|
echo "npm version on tests:"
|
|
|
|
npm -v
|
|
|
|
|
2018-04-27 23:40:13 +08:00
|
|
|
npm test
|