Skip to Content
Technical Articles
Author's profile photo Maximiliano Colman

SAP CAP – Optimize your build MTA projects with several ui apps

Hello hello,

Today I bring to you a common issue & solution for SAP CAP applications with several UI apps( more than 25 fe apps ).

Let’s say that you have 25 ui applications for your SAP CAP project, by default the SAP BAS wizard will add to  the mta.yaml file the necessary information to build & deploy all this ui apps in SAP BTP.

If you pay attention to the section that describes the build phase of the ui apps then you will notice the command “npm install” in all of them, and they are dependencies just to build and not to run the ui apps, so for every time that you build the MTA project the SAP BAS will download & store the same npm devDependencies packages for every ui app.

The necessary devDependencies to successfully build a ui app needs 123 MB, so if we have 25 ui apps the total space needed in your workspace is “3 GB” just for the ui app dependencies, and of course it is taking a lot of time the build of the MTA project because it needs to download & store all this every time you perform the build, how can we optimize all this?.

 

The answer is simple, just install the devDependencies as global, and link them in all the ui apps.

 

Step 1:Install the devDependencies as global

Open a terminal in SAP BAS and execute the following commands

npm install ui5-task-zipper -g
npm install mbt -g
npm install @sap/ui5-builder-webide-extension -g

Step 2: Link them in every ui apps

Open a terminal in SAP BAS and inside of every ui app folder execute the following commands

npm link ui5-task-zipper
npm link mbt
npm link @sap/ui5-builder-webide-extension

Step 3: Remove command “npm install” in mta.yaml

Open the file “mta.yaml” go to the build section of every ui app and just delete the command “npm install”

Step 4: build your MTA project

Just right click on the file “mta.yaml” and select “build MTA project”, and see the results of your build, it will be much more faster( it is not downloading the ui app dependencies anymore !!!, it’s reusing them from the global local repository in all your ui apps).

Not forget, be curious! 😉

Max.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ashwani Goyal
      Ashwani Goyal

      Good information Max! Thanks a lot for sharing!