From 63f2703b9fdd1fe37ede682cf1cf1b482fc64898 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Pe=CC=81rez=20Crespo?= <jaime.perez@uninett.no>
Date: Wed, 12 Dec 2018 15:14:17 +0100
Subject: [PATCH] Adapt the build script to the new deployment procudure.

Before calling npm to install dependencies and build, we need to step into the installation directory. Also, node_modules and the stylesheet.js* byproduct can be removed in production.
---
 bin/build-release.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/build-release.sh b/bin/build-release.sh
index 7a20ca619..e7b03bbdd 100755
--- a/bin/build-release.sh
+++ b/bin/build-release.sh
@@ -15,7 +15,7 @@ if [ -z "$VERSION" ]; then
     exit 1
 fi
 
-if [ -z "$REPO" ]; then
+if [ -z "$REPOPATH" ]; then
     REPOPATH="https://github.com/simplesamlphp/simplesamlphp.git"
 fi
 
@@ -43,14 +43,18 @@ fi
 # Install dependencies (without vcs history or dev tools)
 php "$TARGET/composer.phar" install --no-dev --prefer-dist -o -d "$TARGET"
 
+cd $TARGET 
 npm install
 npm audit fix
 npm run build
+cd ..
 
 mkdir -p "$TARGET/config" "$TARGET/metadata" "$TARGET/cert" "$TARGET/log" "$TARGET/data"
 cp -rv "$TARGET/config-templates/"* "$TARGET/config/"
 cp -rv "$TARGET/metadata-templates/"* "$TARGET/metadata/"
 rm -rf "$TARGET/.git"
+rm -rf "$TARGET/node_modules"
+rm "$TARGET/www/assets/js/stylesheet.js"*
 rm "$TARGET/.coveralls.yml"
 rm "$TARGET/.editorconfig"
 rm "$TARGET/.gitattributes"
-- 
GitLab