Skip to content

garriscp/Backbase-CLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bbscaff 0.0.11 Build Status

bbscaff is a command line tool that helps you generating and importing components to Backbase CXP 5.5.x. You can easily create widgets, containers and automatically add to your portal catalog with just one command.

Requirements

Install

$ npm install -g bbscaff

Usage

Generating Widgets

Inside /yourBundleName/widgets type:

$ bbscaff generate widget

Generating Containers

Inside /yourBundleName/containers type:

$ bbscaff generate container

Creating your own templates

Create your own template might be useful either to replace an existing bbscaff template or to create your custom template. When you type bbscaff generate <template> the CLI will first try to find the template in your ~/.bbscaff/ folder and after on the built-in templates.

Folder structure

2 The name of your folder insite ~/.bbscaff/ is your template name. This is how a template folder should look like:

.
├── template                # All files that need to be copied
└── bbscaff.js              # Configuartion file

API

bbscaff.js is basically a node.js module. You need to export a function that receives a new instance off bbscaff as the first argument.

module.exports = function(bbscaff){}

bbscaff.prompt(questions, callback)

Prompt necessary questions to inject data in your templates. Please see Inquirer for more details.

bbscaff.prompt([{
		name: 'name',
		message: 'Name'
	}], function(answers){

	})
})

bbscaff.generate(data, destination_path, callback)

Copy files from template to the current folder. bbscaff will parse all your files as Lo-Dash templates. You can print variables <%=myVariable%>, make loops and so on. If you want to rename files, just put the variable in the name of your file between mustaches. {myVariable}.js

bbscaff.generate(answers, answers.widget_name, function(){})

bbscaff.getCurrentBundle()

Returns the current bundle name.


bbscaff.getPrefix(string)

Returns string as prefix. Ex: my-bundle => mb


bbscaff.toCamelCase(string)

Returns string in CamelCase. Ex: my-bundle => MyBundle


bbscaff.request(request_object, callback)

Used to make requests to the portalserver REST Api. It handles authentication and sets proper headers. Please see request for more details.

fs.readFile('file.xml'), "utf8", function(err, content){
	if(err) return;
	bbscaff.request({url: 'http://localhost:7777/portalserver/catalog', body: content}, function(err, httpResponse, body){})
})

Example of a basic bbscaff.js

module.exports = function(bbscaff){
	bbscaff.prompt([
		{
			name: 'name',
			message: 'Name'
		}
	], function(answers){
		bbscaff.generate(answers, answers.name)
	})
}