@sap-ux/fe-fpm-writer
Advanced tools
Comparing version 0.13.6 to 0.14.0
@@ -80,3 +80,3 @@ "use strict"; | ||
if (config.eventHandler) { | ||
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler); | ||
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler, false, config.typescript); | ||
} | ||
@@ -83,0 +83,0 @@ // enhance manifest with action definition and controller reference |
@@ -16,2 +16,3 @@ import type { Editor } from 'mem-fs-editor'; | ||
fcl?: boolean; | ||
typescript?: boolean; | ||
} | ||
@@ -18,0 +19,0 @@ export declare const MIN_VERSION = "1.94.0"; |
@@ -71,4 +71,5 @@ "use strict"; | ||
if (config.replaceAppComponent) { | ||
const componentTemplate = path_1.join(__dirname, '../../templates/app/Component.js'); | ||
fs.copyTpl(componentTemplate, path_1.join(basePath, 'webapp/Component.js'), manifest['sap.app']); | ||
const ext = config.typescript ? 'ts' : 'js'; | ||
const componentTemplate = path_1.join(__dirname, `../../templates/app/Component.${ext}`); | ||
fs.copyTpl(componentTemplate, path_1.join(basePath, `webapp/Component.${ext}`), manifest['sap.app']); | ||
} | ||
@@ -75,0 +76,0 @@ return fs; |
@@ -45,3 +45,3 @@ "use strict"; | ||
if (config.eventHandler) { | ||
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler); | ||
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler, false, config.typescript); | ||
} | ||
@@ -48,0 +48,0 @@ // generate column content |
@@ -11,5 +11,6 @@ import type { Editor } from 'mem-fs-editor'; | ||
* @param {boolean} [controllerSuffix=false] - append controller suffix to new file | ||
* @param {boolean} typescript - create Typescript file instead of Javascript | ||
* @returns {string} full namespace path to method | ||
*/ | ||
export declare function applyEventHandlerConfiguration(fs: Editor, root: string, config: Partial<InternalCustomElement>, eventHandler: EventHandlerConfiguration | true | string, controllerSuffix?: boolean): string; | ||
export declare function applyEventHandlerConfiguration(fs: Editor, root: string, config: Partial<InternalCustomElement>, eventHandler: EventHandlerConfiguration | true | string, controllerSuffix?: boolean, typescript?: boolean): string; | ||
//# sourceMappingURL=event-handler.d.ts.map |
@@ -14,5 +14,6 @@ "use strict"; | ||
* @param {boolean} [controllerSuffix=false] - append controller suffix to new file | ||
* @param {boolean} typescript - create Typescript file instead of Javascript | ||
* @returns {string} full namespace path to method | ||
*/ | ||
function applyEventHandlerConfiguration(fs, root, config, eventHandler, controllerSuffix = false) { | ||
function applyEventHandlerConfiguration(fs, root, config, eventHandler, controllerSuffix = false, typescript) { | ||
if (typeof eventHandler === 'string') { | ||
@@ -37,5 +38,6 @@ // Existing event handler is passed - no need for file creation/update | ||
} | ||
const controllerPath = path_1.join(config.path || '', `${fileName}${controllerSuffix ? '.controller' : ''}.js`); | ||
const ext = typescript ? 'ts' : 'js'; | ||
const controllerPath = path_1.join(config.path || '', `${fileName}${controllerSuffix ? '.controller' : ''}.${ext}`); | ||
if (!fs.exists(controllerPath)) { | ||
fs.copyTpl(path_1.join(root, 'common/EventHandler.js'), controllerPath, { | ||
fs.copyTpl(path_1.join(root, `common/EventHandler.${ext}`), controllerPath, { | ||
eventHandlerFnName | ||
@@ -42,0 +44,0 @@ }); |
@@ -24,2 +24,6 @@ import type { ManifestNamespace } from '@sap-ux/ui5-config'; | ||
ui5Version?: number; | ||
/** | ||
* If set to true then all code snippets are generated in Typescript instead of Javascript. | ||
*/ | ||
typescript?: boolean; | ||
} | ||
@@ -26,0 +30,0 @@ export interface InternalCustomElement extends CustomElement { |
@@ -75,5 +75,6 @@ "use strict"; | ||
} | ||
const controllerPath = path_1.join(config.path, `${config.name}.controller.js`); | ||
const ext = data.typescript ? 'ts' : 'js'; | ||
const controllerPath = path_1.join(config.path, `${config.name}.controller.${ext}`); | ||
if (!fs.exists(controllerPath)) { | ||
fs.copyTpl(path_1.join(root, 'ext/Controller.js'), controllerPath, config); | ||
fs.copyTpl(path_1.join(root, `ext/Controller.${ext}`), controllerPath, config); | ||
} | ||
@@ -80,0 +81,0 @@ return fs; |
@@ -42,3 +42,3 @@ "use strict"; | ||
if (config.eventHandler) { | ||
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler); | ||
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler, false, config.typescript); | ||
} | ||
@@ -45,0 +45,0 @@ // generate section content |
@@ -27,3 +27,3 @@ "use strict"; | ||
if (config.eventHandler) { | ||
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler, true); | ||
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler, true, config.typescript); | ||
} | ||
@@ -30,0 +30,0 @@ // existing views |
{ | ||
"name": "@sap-ux/fe-fpm-writer", | ||
"description": "SAP Fiori elements flexible programming model writer", | ||
"version": "0.13.6", | ||
"version": "0.14.0", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131418
75
2792