Hello again.
Since you are here, i guess you managed to get through my
first blog about setting up your local environment.
[Update] I've added a little table of content below for quicker navigation
This blog we will start to add some more features to our app and make sure it runs the right SAPui5 version.
I found a
NPM package that does exactly what I was looking for.
So let's try it out.
Run
npm install -D sapui5-runtime
to install it.
Now we need to edit the package.json file to add our specific sap-ui5 runtime. My version is 1.60.18. So I added an entry in to the file like this
"sapui5-runtime": {
"version": "1.60.18"
}
If you added this like I did after the install, then run to add the version.
npm rebuild
[Update] I've deleted a section of this blog, where I couldn't get the above to work. With the new version 1.4.0 it is now possible to add the proxy configuration via the following environment variables:
$ export HTTP_PROXY http://hostname:port
$ export HTTPS_PROXY https://hostname:port
Thanks sebastian.limbach for your prompt response!
If you chose the content delivery network as part of your yeoman setup, then we need to change the index.html file to use some local resources. So replace the sapui5.ondemand.com with a ... So the bootstrap is
<script id="sap-ui-bootstrap"
src="../resources/sap-ui-core.js"
data-sap-ui-theme="sap_belize"
data-sap-ui-resourceroots='{
"au.com.agilux.test_tooling": "./"
}'
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true"
data-sap-ui-frameOptions="trusted">
</script>
Now because we want the app with local resources,
vobu wrote an excellent
blog about some of the tooling plugins to use.
Now let's install the plugin ui5-middleware-servestatic to serve the ui5 resources from our newly downloaded runtime.
run command:
npm install ui5-middleware-servestatic --save-dev
Add the following to the package.json file
"ui5": {
"dependencies": [
"ui5-middleware-servestatic"
]
}
And add to your ui5.yaml the following:
server:
customMiddleware:
- name: ui5-middleware-servestatic
afterMiddleware: compression
mountPath: /resources
configuration:
rootPath: "../sapui5-1.60.18/resources"
So I've installed my sapui5 runtime up folder back from my root of the project so it can be reused by other apps as well.
Now when I run npm start again. My server doesn't start. I realized that the UI5 tooling version was too low and needed to be updated. I realised that I had another version of my ui5-tooling sitting globally that needed an update. So maybe I should have listened to myself in the previous blog and ran npm install -g @ui5/cli
And we are now running the app with our own local version of UI5.
Now let's install the livereload module.
npm install ui5-middleware-livereload --save-dev
Now add the dependency as well as the yaml file as according to Volkers blog. Now when you run npm start again, you should have live reload abilities.
Alright, so we got a pretty good basic setup now. Let's move on to exploring VS code plugins and tackle our OData gateway issue in our next
blog