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.
$ npm install -g bbscaff
Inside /yourBundleName/widgets
type:
$ bbscaff generate widget
Inside /yourBundleName/containers
type:
$ bbscaff generate container
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.
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
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){}
Prompt necessary questions to inject data in your templates. Please see Inquirer for more details.
bbscaff.prompt([{
name: 'name',
message: 'Name'
}], function(answers){
})
})
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(){})
Returns the current bundle name.
Returns string as prefix. Ex: my-bundle
=> mb
Returns string in CamelCase. Ex: my-bundle
=> MyBundle
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){})
})
module.exports = function(bbscaff){
bbscaff.prompt([
{
name: 'name',
message: 'Name'
}
], function(answers){
bbscaff.generate(answers, answers.name)
})
}