@backbase/generator-ext-ng
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -0,15 +1,29 @@ | ||
const nameConventionRegex = /^ext-([^\-]+)-(.*?)(?:-(ng))?$/; | ||
const prompts = (api, presets) => { | ||
const description = Object.assign({}, presets.description, { | ||
default: function(answers) { | ||
return answers.name.replace(/ext-bb-(.+?)(?:-ng|$)/, function(a, b) { | ||
return b ? 'Default extension for widget-bb-' + b + '-ng' : answers.name; | ||
}); | ||
} | ||
default: answers => answers.name.replace( | ||
/ext-bb-(.+?)(?:-ng|$)/, | ||
(a, b) => (b ? `Default extension for widget-bb-${b}-ng` : answers.name) | ||
), | ||
}); | ||
const controllerName = (name) => { | ||
const baseName = nameConventionRegex.test(name) | ||
? name.match(nameConventionRegex)[2] | ||
: name; | ||
return `${api.filter.upperFirst(api.filter.camelCase(baseName))}Controller`; | ||
}; | ||
const controller = { | ||
name: 'controller', | ||
message: 'Widget Controller', | ||
default: answers => controllerName(answers.name), | ||
}; | ||
return [ | ||
presets.name, | ||
description, | ||
presets.version | ||
controller, | ||
presets.version, | ||
]; | ||
@@ -20,7 +34,5 @@ }; | ||
module.exports = function(api, presets) { | ||
return api( | ||
prompts(api, presets), | ||
config | ||
); | ||
}; | ||
module.exports = (api, presets) => api( | ||
prompts(api, presets), | ||
config | ||
); |
@@ -7,1 +7,5 @@ // uncomment below to include CSS in your extension | ||
export const hooks = {}; | ||
export const helpers = {}; | ||
export const events = {}; |
{ | ||
"name": "@backbase/generator-ext-ng", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Generate angular widget extension feature", | ||
@@ -5,0 +5,0 @@ "main": "default/index.js", |
Sorry, the diff of this file is not supported yet
2071
40