@sap/generator-fiori
Version:
Create an SAPUI5 application using SAP Fiori elements or a freestyle approach
1 lines • 7.53 kB
JavaScript
"use strict";exports.id=51,exports.ids=[51],exports.modules={85047:function(e,i,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.promptNames=void 0;const a=n(16928),o=s(n(91170)),r=s(n(44749)),p=n(56820),l=n(4591),h=n(1484);Object.defineProperty(i,"promptNames",{enumerable:!0,get:function(){return h.promptNames}});const u=n(91637),c=n(20787),d=n(42578),f=n(98434),g=n(58012),b=n(12450),m=n(52620),v=n(78805),_=n(35222),y=n(11846);class default_1 extends o.default{appWizard;vscode;launchFlpConfigAsSubGenerator;existingApp;appRootPath;prompts;answers;abort=!1;manifest;manifestPath;extensionPromptOpts;options;setPromptsCallback;constructor(e,i){super(e,i),this.appWizard=i.appWizard??p.AppWizard.create(i),this.vscode=i.vscode,this.launchFlpConfigAsSubGenerator=i.launchFlpConfigAsSubGenerator??!1,this.appRootPath=i.data?.appRootPath??i?.appRootPath??this.destinationRoot(),this.options=i,r.default.configureLogging(this.rootGeneratorName(),this.log,this.options.logWrapper,this.options.logLevel,this.options.logger,this.vscode),this.launchFlpConfigAsSubGenerator||(this.appWizard.setHeaderTitle(m.generatorTitle),this.prompts=new p.Prompts((0,_.getYUIDetails)(this.appRootPath)),this.setPromptsCallback=e=>{this.prompts&&this.prompts.setCallback(e)},this.existingApp=!0)}async initializing(){this.env.conflicter&&(this.env.conflicter.force=this.options.force??!0),this.extensionPromptOpts=await(0,l.getExtensionGenPromptOpts)(this.env.create.bind(this.env),this.rootGeneratorName(),this.vscode),await g.TelemetryHelper.initTelemetrySettings({consumerModule:{name:"@sap-ux/flp-config-sub-generator",version:this.rootGeneratorVersion()},internalFeature:(0,f.isInternalFeaturesSettingEnabled)(),watchTelemetrySettingStore:!1}),this.existingApp&&(this.manifestPath=(0,a.join)(await(0,c.getWebappPath)(this.appRootPath),c.FileName.Manifest),this.manifest=this.fs.readJSON(this.manifestPath),this.manifest||(0,l.handleErrorMessage)(this.appWizard,{errorMsg:(0,v.t)("error.noManifest",{path:this.manifestPath})}),this.manifest["sap.app"]||(0,l.handleErrorMessage)(this.appWizard,{errorMsg:(0,v.t)("error.sapNotDefined")}))}async prompting(){if(this.launchFlpConfigAsSubGenerator&&void 0!==this.options.inboundConfig?.semanticObject&&void 0!==this.options.inboundConfig?.action&&void 0!==this.options.inboundConfig?.title&&this.options.skipPrompt)return void(this.answers={overwrite:!0,semanticObject:this.options.inboundConfig.semanticObject,action:this.options.inboundConfig.action,title:this.options.inboundConfig.title,subTitle:this.options.inboundConfig.subTitle});let e={};this.manifest?.["sap.app"]?.crossNavigation?.inbounds&&(e=this.manifest?.["sap.app"]?.crossNavigation?.inbounds);const i=this.options.overwrite;let n=await(0,h.getPrompts)(e,void 0,{silentOverwrite:i,inboundId:{hide:!0},emptyInboundsInfo:{hide:!0},additionalParameters:{hide:!0},createAnotherInbound:{hide:!0}});this.extensionPromptOpts&&!this.launchFlpConfigAsSubGenerator&&(n=(0,b.extendWithOptions)(n,this.extensionPromptOpts)),this.answers={};const s=await this.prompt(n);(!1===s.s4Continue||!1===s.overwrite&&!i)&&(this.abort=!0,process.exit(0)),""===s.subTitle&&(s.subTitle=void 0),Object.assign(this.answers,s)}async writing(){!1===this.abort&&this.existingApp&&await this._updateFiles(this.answers)}async _updateFiles({semanticObject:e,action:i,title:n,subTitle:s}){let a=!1;n&&(a=await this._updateI18n(this.manifestPath,this.manifest,{semanticObject:e,action:i,title:n,subTitle:s})),await(0,u.generateInboundNavigationConfig)(this.appRootPath,{semanticObject:e,action:i,title:a?`{{${e}-${i}.${m.i18nKeyTitle}}}`:n,subTitle:a&&s?`{{${e}-${i}.${m.i18nKeySubTitle}}}`:s},!0,this.fs)}async _updateI18n(e,i,{semanticObject:n,action:s,title:a,subTitle:o}){let l=!1;const{"sap.app":h}=await(0,c.getI18nPropertiesPaths)(e,i);try{const e=[{key:`${n}-${s}.${m.i18nKeyTitle}`,value:a}];o&&e.push({key:`${n}-${s}.${m.i18nKeySubTitle}`,value:o}),l=await(0,d.createPropertiesI18nEntries)(h,e,this.appRootPath,this.fs)}catch(e){const i=(0,v.t)("warning.updatei18n",{path:h});this.appWizard.showWarning(i,p.MessageType.notification),r.default.logger?.error(i)}return l}async end(){!1!==this.abort||this.existingApp||(this.manifestPath=(0,a.join)(await(0,c.getWebappPath)(this.appRootPath),c.FileName.Manifest),this.manifest=this.fs.readJSON(this.manifestPath),await this._updateFiles(this.answers));try{!this.options.launchFlpConfigAsSubGenerator&&!0!==this.abort&&(0,g.isExtensionInstalled)(this.vscode,g.YUI_EXTENSION_ID,g.YUI_MIN_VER_FILES_GENERATED_MSG)&&this.appWizard?.showInformation((0,v.t)("info.filesGenerated"),p.MessageType.notification),(0,g.sendTelemetry)(y.EventName.GENERATION_SUCCESS,g.TelemetryHelper.createTelemetryData({appType:"flp-config",...this.options.telemetryData})??{}).catch((e=>{r.default.logger.error((0,v.t)("error.telemetry",{error:e}))}))}catch(e){r.default.logger?.error((0,v.t)("error.endPhase",{error:e}))}}}i.default=default_1},11846:(e,i)=>{var n;Object.defineProperty(i,"__esModule",{value:!0}),i.EventName=void 0,function(e){e.GENERATION_SUCCESS="GENERATION_SUCCESS"}(n||(i.EventName=n={}))},52620:(e,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.generatorTitle=i.i18nKeySubTitle=i.i18nKeyTitle=void 0,i.i18nKeyTitle="flpTitle",i.i18nKeySubTitle="flpSubtitle",i.generatorTitle="Fiori Launchpad Configuration Generator"},70425:function(e,i,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0}),i.t=i.initI18n=void 0;const a=s(n(13858)),o=s(n(99581)),r="flp-config-generator";async function initI18n(){await a.default.init({lng:"en",fallbackLng:"en"},(()=>a.default.addResourceBundle("en",r,o.default)))}i.initI18n=initI18n,i.t=function t(e,i){return i?.ns||(i=Object.assign(i??{},{ns:r})),a.default.t(e,i)},initI18n().catch((()=>{}))},78805:function(e,i,n){var s=this&&this.__createBinding||(Object.create?function(e,i,n,s){void 0===s&&(s=n);var a=Object.getOwnPropertyDescriptor(i,n);a&&!("get"in a?!i.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return i[n]}}),Object.defineProperty(e,s,a)}:function(e,i,n,s){void 0===s&&(s=n),e[s]=i[n]}),a=this&&this.__exportStar||function(e,i){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(i,n)||s(i,e,n)};Object.defineProperty(i,"__esModule",{value:!0}),a(n(70425),i)},44749:(e,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0});const s=n(58012);class FlpGenLogger{static _logger=s.DefaultLogger;static get logger(){return FlpGenLogger._logger}static set logger(e){FlpGenLogger._logger=e}static configureLogging(e,i,n,a,o,r){const p=n??new s.LogWrapper(e,i,a,o,r);FlpGenLogger.logger=p}}i.default=FlpGenLogger},35222:(e,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getYUIDetails=void 0;const s=n(16928);i.getYUIDetails=function getYUIDetails(e){return[{name:"Fiori Launchpad Configuration",description:`Configure Fiori Launchpad settings - ${(0,s.basename)(e)}`}]}},99581:e=>{e.exports=JSON.parse('{"error":{"endPhase":"Error end phase deployment-generator:flp: {{- error}}","telemetry":"Failed to send telemetry data after FLP configuration has been added. {{- error}}","noManifest":"Manifest not found at path: {{- path}}","sapNotDefined":"Manifest is missing required section \'sap.app\'"},"warning":{"updatei18n":"Cannot update i18n properties file: {{- path}}"},"info":{"filesGenerated":"The files have been generated."}}')}};