Godiva
Godiva is the command-line interface for SAPUI5. It provides a number of helpful commands that can assist you while you build your application.
Installation
$ npm install godiva -g
Prerequisites
Before starting the SAPUI5 project, you can initialize Godiva by the using init
command:
$ godiva init <namespace> [title] [options]
Arguments:
namespace Any SAPUI5 valid namespace
title Your SAPUI5 Application Title
Options:
-h, --help output usage information
-n, --new Create a new boilerplate template.
This will create a godiva.json
on your root directoy which contains all the basic configuration that Godiva will use for CLI commands. You can also edit godiva.json
afterwards according to your needs.
if the -n, --new
options is provided, this will create a boilerplate project on your current directory.
Usage
The following commands are currently supported by Godiva:
Make
The make
command consists of several utility function for generating SAPUI5 files.
Creating an index.html
file can be done via:
Usage: make:index [options] <Title>
Create a new index file.
Options:
-h, --help output usage information
Examples:
$ godiva make:index 'Hello World'
Creating a Component.js
file can be done via:
Usage: make:component [options] <DeviceModel>
Create a new component file. <DeviceModel> can be set to true to be generated.
Options:
-h, --help output usage information
Examples:
$ godiva make:component true
The statement above will not generate a device model instance on your Component.js
sapui;
Creating a *.controller.js
file can be done via:
Usage: make:controller [options] <ControllerName>
Create a new controller.
Options:
-h, --help output usage information
Examples:
$ godiva make:controller Home
By default Godiva, will create the controller folder base on your godiva.json
.
Creating a *.view.xml
file can be done via:
Usage: make:controller [options] <ViewName>
Create a new view.
Options:
-h, --help output usage information
-a, --attach Attach this view to a controller with the same name.
Examples:
$ godiva make:view Home --attach
By default Godiva, will create the view folder base on your godiva.json
. if the -a, --attach
is provided, the xml view will include a controllerName
attribute to the view.
Note: XML views are the only currently supported view types.
Creating a *.fragment.xml
file can be done via:
Usage: make:fragment [options] <FragmentName>
Create a new fragment.
Options:
-h, --help output usage information
Examples:
$ godiva make:fragment Login
Creating a module
or formatter
file can be done via:
Usage: make:module [options] <ModuleName>
Create a new module (e.g. Formatter).
Options:
-h, --help output usage information
Examples:
$ godiva make:module Formatter
Godiva also generates message bundle
or i18n
. This can be achieved by passing multiple locale
to the end of the argument:
Usage: make:i18n <lcoale> [otherLocale...] [options]
Create a new i18n file.
Options:
-h, --help output usage information
Examples:
$ godiva make:i18n en us
Deleting Files
If you want to remove the generated files, you can simply delete them on your directory. You can use init
to regenerate the godiva.json
provided you have the namespace
as the parameter.