X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fsparky-fe.git;a=blobdiff_plain;f=scripts%2Fbuild%2Fbuild.sh;h=b87d08ee777d27dede29f56e0bd5cb086802f1e5;hp=9fd9fd2c08611d5989f28b7eac99424852090044;hb=e513a1ce93b9a70f01b62ca7560dbe52376cc5bd;hpb=d4fd54113808e9efa637719719b2831e0597996e diff --git a/scripts/build/build.sh b/scripts/build/build.sh index 9fd9fd2..b87d08e 100644 --- a/scripts/build/build.sh +++ b/scripts/build/build.sh @@ -1,13 +1,13 @@ -#!/bin/bash +#!/bin/bash -x ############################################################################### # # UpdateFEwithExtensions # -# Description: Update files in the FE code based on the content of the -# extensions. For this to work, extensions are required to fill +# Description: Update files in the FE code based on the content of the +# extensions. For this to work, extensions are required to fill # some files. The current script does not care too much about -# their locations (other than being in the component +# their locations (other than being in the component # nodes-modules) but the file name must match. # ############################################################################### @@ -39,7 +39,7 @@ UpdateFEwithExtensions(){ # Get extensible json additions echo "build.sh --- Appending to resources/views/extensibleViews.json" extConfig=`find node_modules/ -name "extensibleViews.json"` - if [ ! -z "$extConfig" ]; then + if [ ! -z "$extConfig" ]; then jq -n 'input | . +=[inputs]' resources/views/extensibleViews.json $extConfig > tmp mv tmp resources/views/extensibleViews.json fi @@ -58,7 +58,7 @@ UpdateFEwithExtensions(){ # Get overlay json additions echo "build.sh --- Appending to resources/overlays/overlaysDetails.json" extConfig=`find node_modules/ -name "overlaysDetails.json"` - if [ ! -z "$extConfig" ]; then + if [ ! -z "$extConfig" ]; then jq -n 'input | . +=[inputs]' resources/overlays/overlaysDetails.json $extConfig > tmp mv tmp resources/overlays/overlaysDetails.json fi @@ -67,11 +67,11 @@ UpdateFEwithExtensions(){ echo "build.sh --- Appending to resources/scss/customViews.scss" touch resources/scss/customViews.scss extSCSS=`find -name "extensibility.scss"` - for i in $extSCSS; do + for i in $extSCSS; do cat $i >> resources/scss/customViews.scss done - - + + } updateStyle() @@ -101,8 +101,8 @@ updateStyle() if [ -f tmp.style.imports ]; then sed -i /"import 'resources\/scss\/style\.scss';"/d src/app/main.app.jsx fi - - # Update bootstrap + + # Update bootstrap echo "build.sh --- Update resources/scss/bootstrap.scss" bootImports=`find extStyle/ -name "bootstrap.scss"` for i in $bootImports; do @@ -115,32 +115,28 @@ updateStyle() fi } +UpdateFEWithCustomViews(){ + # Append statements to src/app/configurableViews/index.js + echo "build.sh --- Appending to src/app/configurableViews/index.js" + custViewImports=`find -name "confViewIndex"` + for i in $custViewImports; do + cat $i | grep import > tmp.imports + cat $i | grep 'components\[' > tmp.components + + sed -i '/Import section/ r tmp.imports' src/app/configurableViews/index.js + sed -i '/Components section/ r tmp.components' src/app/configurableViews/index.js + done +} + ############################################################################### # # Main # ############################################################################### -extensionList=$@ - -# npm install -echo "build.sh --- Running npm install" -npm install - -# npm install extensions -echo "build.sh --- parameter provided $extensionList" -if [ -z "$extensionList" ]; then - echo "build.sh --- No extension provided" -else - echo "build.sh --- Running npm --save ${extensionList}" - npm install --save ${extensionList} - # copy content when there are extensions - UpdateFEwithExtensions -fi +# Copy some extension content to the core sparky +UpdateFEwithExtensions # Copy style updateStyle -# npm run build -echo "build.sh --- Running npm run build" -npm run build \ No newline at end of file