Commit c29c5514 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[BUGFIX] set node version only when needed

parent f784fd01
......@@ -3,7 +3,7 @@
"description": "sgalinski command line interface",
"homepage": "https://www.sgalinski.de",
"license": ["SEE LICENSE IN LICENSE.md"],
"version": "2.6.1",
"version": "2.6.2",
"replace": {
"sgc-core": "self.version"
}
......
......@@ -12,28 +12,30 @@ if [ $SGC_VERSION != $INSTALLED_SGC_VERSION ]; then
exit 1;
fi
# the nvm config file will only exist on unix systems
if [ ! $OSTYPE == "msys" ]
then
. ~/.nvm/nvm.sh
fi
function setNodeVersion {
# the nvm config file will only exist on unix systems
if [ ! $OSTYPE == "msys" ]
then
. ~/.nvm/nvm.sh
fi
# include version config
. ./sgc-core/core/node.sh
# include version config
. ./sgc-core/core/node.sh
if [ ! $OSTYPE == "msys" ]
then
# set node version
nvm use --delete-prefix ${nodeversion}
else
# interestingly, setting the node version here will break on windows. for some reason the node and npm commands
# wont't be available anymore afterwards. tell the user instead.
if [ ! $(node -v) == "v${nodeversion}" ]
if [ ! $OSTYPE == "msys" ]
then
echo -e "\033[0;31mWrong node version! Please run 'nvm use ${nodeversion}\033[0m";
exit 1;
# set node version
nvm use --delete-prefix ${nodeversion}
else
# interestingly, setting the node version here will break on windows. for some reason the node and npm commands
# wont't be available anymore afterwards. tell the user instead.
if [ ! $(node -v) == "v${nodeversion}" ]
then
echo -e "\033[0;31mWrong node version! Please run 'nvm use ${nodeversion}\033[0m";
exit 1;
fi
fi
fi
}
if [ "$1" == "shortlist" ]; then
taskList="server images css css:sprites css:svg css:abovethefold images:uploaded js:compile js:qa js shortlist releaseExtension lighthouse"
......@@ -44,14 +46,19 @@ if [ "$1" == "shortlist" ]; then
echo -e ${taskList}
fi
elif [ -e "sgc-core/core/modules/$1.sh" ]; then
setNodeVersion
./sgc-core/core/modules/$1.sh $@
elif [ -e "./sgc-scripts/$1.sh" ]; then
setNodeVersion
./sgc-scripts/$1.sh
elif [ -e "./sgc-scripts/$1.js" ]; then
setNodeVersion
node ./sgc-scripts/$1.js
elif [ -e "./sgc-core/core/modules/$1.js" ]; then
setNodeVersion
node ./sgc-core/core/modules/$1.js $@
else
setNodeVersion
cd sgc-core
node ./node_modules/gulp/bin/gulp.js $@
fi
SGC_VERSION=2.6.1
SGC_VERSION=2.6.2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment