UNPKG

@sap/generator-fiori

Version:

Create an SAPUI5 application using SAP Fiori elements or a freestyle approach

1 lines 3.11 kB
"use strict";exports.id=8337,exports.ids=[8337],exports.modules={13556(e,r,n){n.r(r),n.d(r,{default:()=>b});var a=n(91170),s=n(94443);class ReferenceLibGenLogger{static _logger=s.DefaultLogger;static get logger(){return ReferenceLibGenLogger._logger}static set logger(e){ReferenceLibGenLogger._logger=e}static configureLogging(e,r,n,a,i){const o=new s.LogWrapper(r,n,i,e,a);ReferenceLibGenLogger.logger=o}}const i=[{name:"Create a Reference",description:"Add library reference to an SAP Fiori application"}];var o=n(54980),c=n(73667),g=n(18345),l=n(40511),p=n(79761),d=n(68801);const h=JSON.parse('{"info":{"filesGenerated":"The files have been generated."},"error":{"endPhase":"An error occurred in the end phase of the reference library generator: {{- error}}","telemetry":"An error occurred when sending telemetry data: {{- error}}","updatingApp":"An error occurred when updating the application with the library reference. For more information, view the logs."}}'),f="ui5-library-reference-sub-generator",u=d.createInstance();function t(e,r){return r?.ns||(r=Object.assign(r??{},{ns:f})),u.t(e,r)}var L;(async function initI18n(){await u.init({lng:"en",fallbackLng:"en",showSupportNotice:!1}),u.addResourceBundle("en",f,h)})().catch(()=>{}),function(e){e.LIB_REFERENCE_ADDED="LIB_REFERENCE_ADDED"}(L||(L={}));const b=class extends a{answers={};prompts;appWizard;basePath;vscode;setPromptsCallback;constructor(e,r){super(e,r),this.appWizard=r.appWizard||c.AppWizard.create(r),this.vscode=r.vscode,ReferenceLibGenLogger.configureLogging(this.options.logger,this.rootGeneratorName(),this.log,this.options.vscode,this.options.logLevel),this.appWizard.setHeaderTitle("SAP Fiori Reusable Library"),this.prompts=new c.Prompts(i),this.setPromptsCallback=e=>{this.prompts&&this.prompts.setCallback(e)}}async initializing(){await s.TelemetryHelper.initTelemetrySettings({consumerModule:{name:"@sap-ux/ui5-library-reference-sub-generator",version:this.rootGeneratorVersion()},internalFeature:(0,l.isInternalFeaturesSettingEnabled)(),watchTelemetrySettingStore:!1}),(0,s.setYeomanEnvConflicterForce)(this.env,!0)}async prompting(){let e;e=this.env?.adapter?.actualAdapter?this.env.adapter.actualAdapter:this.env?.adapter;const r=await(0,p.J)(o.workspace.workspaceFolders,e);Object.assign(this.answers,r)}async writing(){const e=[];if(this.answers.referenceLibraries)for(const r of this.answers.referenceLibraries)e.push({name:r.name,path:r.path,type:r.type,uri:r.uri});try{this.answers.targetProjectFolder&&await(0,g.c)(this.answers.targetProjectFolder,e,this.fs)}catch(e){throw ReferenceLibGenLogger.logger.error(e),new Error(t("error.updatingApp"))}}end(){try{(0,s.isExtensionInstalled)(this.vscode,s.YUI_EXTENSION_ID,s.YUI_MIN_VER_FILES_GENERATED_MSG)&&this.appWizard?.showInformation(t("info.filesGenerated"),c.MessageType.notification);const e=s.TelemetryHelper.createTelemetryData();e&&(0,s.sendTelemetry)(L.LIB_REFERENCE_ADDED,e,this.answers.targetProjectFolder).catch(e=>{ReferenceLibGenLogger.logger.error(t("error.telemetry",{error:e}))})}catch(e){ReferenceLibGenLogger.logger.error(t("error.endPhase"))}}}}};