Skip to content
Snippets Groups Projects
Commit 4d7ff12d authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'task-3074-use-nvm' into 'master'

Task 3074 use nvm

See merge request !100
parents f86c19d0 23c9dab3
Branches
No related tags found
No related merge requests found
...@@ -1647,6 +1647,7 @@ class project extends base { ...@@ -1647,6 +1647,7 @@ class project extends base {
. 'export GIT_SSH="'.$this->_aConfig['appRootDir'].'/shellscripts/gitsshwrapper.sh";' . 'export GIT_SSH="'.$this->_aConfig['appRootDir'].'/shellscripts/gitsshwrapper.sh";'
. 'export DIR_SSH_KEYS="'.$this->_aConfig['dataDir'].'/sshkeys";' . 'export DIR_SSH_KEYS="'.$this->_aConfig['dataDir'].'/sshkeys";'
. 'export DIR_APPROOT="'.$sTempBuildDir.'";' . 'export DIR_APPROOT="'.$sTempBuildDir.'";'
. 'export NVMINIT="'.$this->_aConfig['appRootDir'].'/shellscripts/nvm_init.sh";'
. (isset($this->_aConfig['build']['env']) ? $this->_aConfig['build']['env'] : '') . (isset($this->_aConfig['build']['env']) ? $this->_aConfig['build']['env'] : '')
; ;
......
#!/bin/bash
# ======================================================================
#
# NVM INIT
#
# This is a helper tool for build processes with nodejs.
# It installs nvm and offers a method to remove nvm again.
#
# ----------------------------------------------------------------------
# 2019-06-18 first lines <axel.hahn@iml.unibe.ch>
# ======================================================================
# ----------------------------------------------------------------------
# CONFIG
# ----------------------------------------------------------------------
NVM_REPO=https://github.com/nvm-sh/nvm.git
# ----------------------------------------------------------------------
# FUNCTIONS
# ----------------------------------------------------------------------
function nvmremove(){
echo "REMOVE NVM ..."
if [ -z $NVM_DIR ]; then
echo ERROR: sorry, NVM_DIR is empty.
exit 1
fi
echo -n "Removing NVM from build directory: [$NVM_DIR] ..."
rm -rf "$NVM_DIR" || exit 3
echo OK
echo -n "unload ... "
nvm unload || exit 2
echo OK
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
echo
echo ===== NVM INIT =====
echo
if [ -z $DIR_APPROOT ]; then
echo ERROR: this script runs in a onbuilt process only.
echo Currently here is no DIR_APPROOT to define a temporary working dir.
exit 1
fi
# INSTALL NVM ... see
# https://github.com/nvm-sh/nvm#manual-install
export NVM_DIR="$DIR_APPROOT/.nvm" && (
git clone $NVM_REPO "$NVM_DIR"
cd "$NVM_DIR"
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && . "$NVM_DIR/nvm.sh" || exit 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment