diff options
Diffstat (limited to 'run.sh')
| -rwxr-xr-x | run.sh | 40 |
1 files changed, 29 insertions, 11 deletions
@@ -81,7 +81,7 @@ case "$COMMAND" in # Change current directory to the project path. APP_PATH=$1 shift - pushd $APP_PATH + pushd $APP_PATH > /dev/null if [[ -z "${SETUP_CMD}" ]]; then # Before running license_finder, we need to install dependencies for the project. @@ -108,11 +108,27 @@ case "$COMMAND" in pip install -r requirements.txt fi - if test -f package.json ; then - # Install NPM packages. - npm install --production - # Try to install Peer packages too, npm install doesn't do it anymore. - /node_modules/.bin/npm-install-peers + if test -f package.json; then + # Check is npm is being used, if so convert it to yarn + if [ -f package-lock.json ] && [ ! -f yarn.lock ] ; then + # restore original lock file state on EXIT + function restore_lockfile { + echo "Cleanup generated $APP_PATH/yarn.lock" + rm -f $APP_PATH/yarn.lock || true + } + trap restore_lockfile EXIT + + echo "Convert package-lock.json to yarn.lock" + yarn import + fi + + # install via yarn + if [ ! -d node_modules ]; then + yarn install --ignore-scripts + + # Try to install Peer packages too, npm install doesn't do it anymore. + /node_modules/.bin/npm-install-peers + fi fi if test -f bower.json ; then @@ -125,14 +141,14 @@ case "$COMMAND" in if test -f Godeps/Godeps.json ; then # Install Go dependencies with Godeps. - pushd /gopath/src/app + pushd /gopath/src/app > /dev/null godep restore - popd + popd > /dev/null elif find . -name "*.go" -printf "found" -quit |grep found >/dev/null ; then # Install Go dependencies with go get. - pushd /gopath/src/app + pushd /gopath/src/app > /dev/null go get - popd + popd > /dev/null fi if test -f pom.xml ; then @@ -151,7 +167,9 @@ case "$COMMAND" in # Run License Finder. echo "Running license_finder $@ in $PWD" license_finder report --format=html --save=gl-license-management-report.html - popd + # rvm removes trap in bash: https://github.com/rvm/rvm/issues/4416 + declare -f restore_lockfile > /dev/null && restore_lockfile + popd > /dev/null # Extract data from the HTML report and put it into a JSON file node /html2json.js $APP_PATH/gl-license-management-report.html > $APP_PATH/gl-license-management-report.json |
