During some of my latest projects I had to make use of custom UI5 libraries to centralize some custom controls. Personally since the release of the UI5 tooling, I’m using VS Code to do all my developments related to UI5 / Cloud.
I noticed that for creating a custom library there’s no straight forward way to generate a template for custom libraries. Actually there is one, which doesn’t seem to be maintained anymore for over 2 years.
So at that point, I was still using a template generated by SAP Web IDE. The template itself is great, but still isn’t using the latest features of the UI5 tooling. So I thought to myself, why not create a custom generator based on this template, fully enabled with the latest features of UI5 tooling.
Generating a new library using the UI5 Library Generator
First install Yeoman and the UI5 Library Generator using the command line.
npm install -g yo npm install -g generator-ui5-library
Anwer the questions posed by the generator:
After choosing the framework you want to use, the generator will create your new UI5 library and you’re up and running right away.
You can test the demo control using:
npm run start
Which will result in the UI5 tooling launching the demo control:
This is the first version of the UI5 Library Generator. The essence of the generator is in place: generating a custom UI5 Library in a matter of minutes. But still there are a few things I have in mind to add, like:
- Automated testing for the generator
- CI / CD setup for automated deployment to NPM
- Deploy configuration
- Sub generators for e.g. creating a new control
So still a lot of things to do, contributions are always highly appreciated!
Enjoy kickstarting your custom UI5 library projects!