3 ###############################################################################
5 # UpdateFEwithExtensions
7 # Description: Update files in the FE code based on the content of the
8 # extensions. For this to work, extensions are required to fill
9 # some files. The current script does not care too much about
10 # their locations (other than being in the component
11 # nodes-modules) but the file name must match.
13 ###############################################################################
15 UpdateFEwithExtensions(){
17 # Append statements to src/app/extensibility/index.js
18 echo "build.sh --- Appending to src/app/extensibility/index.js"
19 extImports=`find -name "extIndex"`
20 for i in $extImports; do
21 cat $i | grep import > tmp.imports
22 cat $i | grep 'components\[' > tmp.components
24 sed -i '/Import section/ r tmp.imports' src/app/extensibility/index.js
25 sed -i '/Components section/ r tmp.components' src/app/extensibility/index.js
28 # Append Reducers to src/views/extensibility/ExtensibilityReducer.js
29 echo "build.sh --- Appending to src/app/extensibility/ExtensibilityReducer.js"
30 extRed=`find -name "extensibilityReducer"`
32 cat $i | grep import | grep -v '{combineReducers}' > tmp.imports.red
33 cat $i | grep ".*:.*," > tmp.exports.red
35 sed -i '/import {combineReducers}/ r tmp.imports.red' src/app/extensibility/ExtensibilityReducer.js
36 sed -i '/export default combineReducers/ r tmp.exports.red' src/app/extensibility/ExtensibilityReducer.js
39 # Get extensible json additions
40 echo "build.sh --- Appending to resources/views/extensibleViews.json"
41 extConfig=`find node_modules/ -name "extensibleViews.json"`
42 if [ ! -z "$extConfig" ]; then
43 jq -n 'input | . +=[inputs]' resources/views/extensibleViews.json $extConfig > tmp
44 mv tmp resources/views/extensibleViews.json
47 # Append statements to src/app/overlays/OverlayImports.js
48 echo "build.sh --- Appending to src/app/overlays/OverlayImports.js"
49 extImports=`find -name "OverlayImport.js"`
50 for i in $extImports; do
51 cat $i | grep import > tmp.overlay.imports
52 cat $i | grep 'overlays\[' > tmp.overlays
54 sed -i '/Import section/ r tmp.overlay.imports' src/app/overlays/OverlayImports.js
55 sed -i '/Overlays section/ r tmp.overlays' src/app/overlays/OverlayImports.js
58 # Get overlay json additions
59 echo "build.sh --- Appending to resources/overlays/overlaysDetails.json"
60 extConfig=`find node_modules/ -name "overlaysDetails.json"`
61 if [ ! -z "$extConfig" ]; then
62 jq -n 'input | . +=[inputs]' resources/overlays/overlaysDetails.json $extConfig > tmp
63 mv tmp resources/overlays/overlaysDetails.json
66 # Append scss statements
67 echo "build.sh --- Appending to resources/scss/customViews.scss"
68 touch resources/scss/customViews.scss
69 extSCSS=`find -name "extensibility.scss"`
71 cat $i >> resources/scss/customViews.scss
79 echo "build.sh --- Updating style"
81 echo "build.sh --- adding fonts"
82 extFonts=`find extStyle/ -name "fonts"`
83 for i in $extFonts; do
84 cp -fr $i/* ./resources/fonts/
87 echo "build.sh --- adding scss"
88 extScss=`find extStyle/ -name "scss"`
90 cp -fr $i/* ./resources/scss/
93 # Append style import to src/app/main.app.jsx
94 echo "build.sh --- Append style import to src/app/main.app.jsx"
95 extImports=`find extStyle/ -name "main.app.jsx"`
96 for i in $extImports; do
97 cat $i | grep import > tmp.style.imports
98 sed -i '/Import Style Section/ r tmp.style.imports' src/app/main.app.jsx
101 if [ -f tmp.style.imports ]; then
102 sed -i /"import 'resources\/scss\/style\.scss';"/d src/app/main.app.jsx
106 echo "build.sh --- Update resources/scss/bootstrap.scss"
107 bootImports=`find extStyle/ -name "bootstrap.scss"`
108 for i in $bootImports; do
109 cat $i | grep import > tmp.bootstrap.import
110 sed -i '/Import Typography Section/ r tmp.bootstrap.import' resources/scss/bootstrap.scss
113 if [ -f tmp.bootstrap.import ]; then
114 sed -i /"@import \"common\/typography\";"/d resources/scss/bootstrap.scss
118 UpdateFEWithCustomViews(){
119 # Append statements to src/app/configurableViews/index.js
120 echo "build.sh --- Appending to src/app/configurableViews/index.js"
121 custViewImports=`find -name "confViewIndex"`
122 for i in $custViewImports; do
123 cat $i | grep import > tmp.imports
124 cat $i | grep 'components\[' > tmp.components
126 sed -i '/Import section/ r tmp.imports' src/app/configurableViews/index.js
127 sed -i '/Components section/ r tmp.components' src/app/configurableViews/index.js
131 ###############################################################################
135 ###############################################################################
140 echo "build.sh --- Running npm install"
143 # npm install extensions
144 echo "build.sh --- parameter provided $extensionList"
145 if [ -z "$extensionList" ]; then
146 echo "build.sh --- No extension provided"
148 echo "build.sh --- Running npm --save ${extensionList}"
149 npm install --save ${extensionList}
150 # copy content when there are extensions
151 UpdateFEwithExtensions
158 echo "build.sh --- Running npm run build"