@sap/generator-fiori
Version:
Create an SAPUI5 application using SAP Fiori elements or a freestyle approach
1 lines • 11.1 kB
JavaScript
"use strict";exports.id=703,exports.ids=[703],exports.modules={29735:(e,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DeployProjectType=i.indexHtmlExists=i.getAbapQuestions=void 0;const s=n(28196),o=n(4591),a=n(58012),r=n(83740),p=n(99214),l=n(10736),c=n(8231),d=n(20787),h=n(2218),u=n(84229),g=n(48546),f=n(17910),y=n(22366),w=n(90409),b=n(98434),m=n(75199),A=n(17313);class default_1 extends o.DeploymentGenerator{appWizard;vscode;launchDeployConfigAsSubGenerator;launchStandaloneFromYui;abort=!1;backendConfig;indexGenerationAllowed;configExists;answers;projectType;constructor(e,i){super(e,i),this.launchDeployConfigAsSubGenerator=i.launchDeployConfigAsSubGenerator??!1,this.launchStandaloneFromYui=i.launchStandaloneFromYui,this.appWizard=i.appWizard||s.AppWizard.create(i),this.vscode=i.vscode,this.options=i}async initializing(){await super.initializing(),await(0,w.initI18n)(),this.env.conflicter&&(this.env.conflicter.force=this.options.force??!0),o.DeploymentGenerator.logger?.debug((0,u.t)("debug.initTelemetry")),await(0,l.initTelemetrySettings)({consumerModule:{name:"@sap-ux/abap-deploy-config-sub-generator",version:this.rootGeneratorVersion()},internalFeature:(0,b.isInternalFeaturesSettingEnabled)(),watchTelemetrySettingStore:!1}),this.launchDeployConfigAsSubGenerator||await this._initializing()}_initDestinationRoot(){this.options.appRootPath&&(this.destinationRoot(this.options.appRootPath),o.DeploymentGenerator.logger?.debug((0,u.t)("debug.appRootPath",{appRootPath:this.options.appRootPath})))}_processProjectConfig(){this.options.base=this.options.base||d.FileName.Ui5Yaml,this.options.config=this.options.config||d.FileName.UI5DeployYaml;this.fs.exists(this.destinationPath(this.options.base))||(this.abort=!0,(0,u.handleProjectDoesNotExist)(this.appWizard,this.destinationPath(this.options.base))),this.configExists=this.fs.exists(this.destinationPath(this.options.config)),this.configExists&&o.DeploymentGenerator.logger?.debug((0,u.t)("debug.configExists",{configPath:this.destinationPath(this.options.config)}))}async _processIndexHtmlConfig(){if(this.projectType===y.DeployProjectType.Library)this.indexGenerationAllowed=!1;else{await(0,u.indexHtmlExists)(this.fs,this.destinationPath())?(this.indexGenerationAllowed=!1,this.options.index&&o.DeploymentGenerator.logger?.debug((0,u.t)("debug.indexExists")),delete this.options.index):this.indexGenerationAllowed=!0}}async _initBackendConfig(){const e=await c.UI5Config.newInstance(this.fs.read(this.destinationPath(this.options.base??d.FileName.Ui5Yaml)));this.projectType="library"===e.getType()?y.DeployProjectType.Library:y.DeployProjectType.Application,this.backendConfig=e.getBackendConfigsFromFioriToolsProxydMiddleware()[0]}async _initializing(){this._initDestinationRoot();try{this._processProjectConfig(),await this._initBackendConfig(),await this._processIndexHtmlConfig()}catch(e){if(e!==o.ERROR_TYPE.ABORT_SIGNAL)throw e;o.DeploymentGenerator.logger?.debug((0,u.t)("debug.initFailed",{error:o.ErrorHandler.getErrorMsgFromType(o.ERROR_TYPE.ABORT_SIGNAL)}))}}async prompting(){if(this.answers={},!this.abort){if(!this.launchDeployConfigAsSubGenerator){const{prompts:e,answers:i={}}=await(0,g.getAbapQuestions)({appRootPath:this.destinationRoot(),connectedSystem:this.options.connectedSystem,backendConfig:this.backendConfig,configFile:this.options.config,indexGenerationAllowed:this.indexGenerationAllowed,showOverwriteQuestion:(0,o.showOverwriteQuestion)(this.launchDeployConfigAsSubGenerator,this.launchStandaloneFromYui,this.options.overwrite,this.configExists),projectType:this.projectType,logger:o.DeploymentGenerator.logger}),n=await this.prompt(e);this.answers=(0,r.reconcileAnswers)(n,i)}this._reconcileAnswersWithOptions()}}_processAbapTargetAnswers(){this.answers.destination=this.options.destination||this.answers.destination,this.answers.url=this.options.url||this.answers.url,this.answers.client=this.options.client||this.answers.client,this.answers.scp=this.options.scp||this.answers.scp,this.answers.isS4HC=this.options.isS4HC||this.answers.isS4HC,!(0,m.isAppStudio)()&&this.answers.scp&&delete this.answers.client}_processBspAppAnswers(){this.answers.ui5AbapRepo=(this.options.ui5AbapRepo||this.answers.ui5AbapRepo)?.toUpperCase(),this.answers.description=this.options.description||this.answers.description,this.answers.package||(this.answers.package=(0,r.getPackageAnswer)(this.options,this.options.package)||(0,r.getPackageAnswer)(this.answers)||(this.answers.scp?"":A.DEFAULT_PACKAGE_ABAP)),this.answers.transport||(this.answers.transport=(0,r.getTransportAnswer)(this.options)||(0,r.getTransportAnswer)(this.answers))}_reconcileAnswersWithOptions(){this._processAbapTargetAnswers(),this._processBspAppAnswers(),this.answers.index=this.options.index??this.answers.index,this.answers.overwrite=this.options.overwrite??this.answers.overwrite}async writing(){this.launchDeployConfigAsSubGenerator||await this._writing()}async _writing(){this.abort||!1===this.answers.overwrite||await(0,p.generate)(this.destinationPath(),{target:{url:this.answers.url,client:this.answers.client,scp:this.answers.scp,destination:this.answers.destination,authenticationType:this.answers.isS4HC?h.AuthenticationType.ReentranceTicket:void 0},app:{name:this.answers.ui5AbapRepo,description:this.answers.description,package:this.answers.package,transport:this.answers.transport},index:this.answers.index},{baseFile:this.options.base,deployFile:this.options.config},this.fs)}install(){this.launchDeployConfigAsSubGenerator||!1===this.answers.overwrite||this._install()}_install(){this.options.skipInstall?o.DeploymentGenerator.logger?.info((0,u.t)("info.skippedInstallation")):this.spawnCommand("npm",["install","--no-audit","--no-fund","--silent","--prefer-offline","--no-progress"])}async end(){this.abort||!1===this.answers.overwrite||(this.launchDeployConfigAsSubGenerator&&(await this._initializing(),await this._writing(),this._install()),this.launchStandaloneFromYui&&(0,a.isExtensionInstalled)(this.vscode,a.YUI_EXTENSION_ID,a.YUI_MIN_VER_FILES_GENERATED_MSG)&&this.appWizard?.showInformation((0,u.t)("info.filesGenerated"),s.MessageType.notification),(0,a.sendTelemetry)(f.EventName.DEPLOY_CONFIG,a.TelemetryHelper.createTelemetryData({DeployTarget:"ABAP",...this.options.telemetryData})??{},this.destinationRoot())?.catch((e=>{o.DeploymentGenerator.logger.error((0,u.t)("error.telemetry",{error:e}))})))}}i.default=default_1;var P=n(48546);Object.defineProperty(i,"getAbapQuestions",{enumerable:!0,get:function(){return P.getAbapQuestions}});var _=n(84229);Object.defineProperty(i,"indexHtmlExists",{enumerable:!0,get:function(){return _.indexHtmlExists}});var x=n(22366);Object.defineProperty(i,"DeployProjectType",{enumerable:!0,get:function(){return x.DeployProjectType}})},48546:(e,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getAbapQuestions=async function getAbapQuestions({appRootPath:e,connectedSystem:i,backendConfig:n,configFile:c=o.FileName.UI5DeployYaml,indexGenerationAllowed:d=!1,showOverwriteQuestion:h=!1,projectType:u=l.DeployProjectType.Application,logger:g}){const{backendSystem:f,serviceProvider:y,destination:w}=i||{};let b;try{const i=await(0,o.readUi5Yaml)(e,c);b=i.findCustomTask(p.ABAP_DEPLOY_TASK)?.configuration}catch{}const m=function getAbapTarget(e,i,n,s){let o,a,p,l,c;(0,r.isAppStudio)()&&e?l=e.Name:i?(o=i.url,p=i.client,a=!!i.serviceKeys,c=i.authenticationType):n?.target?(o=n.target.url,p=n.target.client,a=n.target.scp,c=n.target.authenticationType,l=n.target.destination):s&&(o=s.url,a=s.scp,p=s.client,c=s.authenticationType,l=s?.destination);return{url:o,scp:a,client:p||"",destination:l,authenticationType:c}}(w,f,b,n),A=b?.app;return g?.debug(`Retrieve ABAP prompts using: \n App path: ${e}, \n ABAPTarget: ${JSON.stringify(m)}, SystemName: ${f?.name}, \n ServiceProvider: ${!!y}, showOverwriteQuestion ${h}, indexGenerationAllowed ${d}`),(0,s.getPrompts)({backendTarget:{abapTarget:m,systemName:f?.name,serviceProvider:y,type:u},ui5AbapRepo:{default:A?.name},description:{default:A?.description},packageManual:{default:A?.package},transportManual:{default:A?.transport},index:{indexGenerationAllowed:d},packageAutocomplete:{useAutocomplete:!0},overwrite:{hide:!h}},g,(0,a.getHostEnvironment)()!==a.hostEnvironment.cli)};const s=n(83740),o=n(20787),a=n(58012),r=n(75199),p=n(62268),l=n(22366)},22366:(e,i)=>{var n;Object.defineProperty(i,"__esModule",{value:!0}),i.DeployProjectType=void 0,function(e){e.Application="application",e.Library="library"}(n||(i.DeployProjectType=n={}))},17910:(e,i)=>{var n;Object.defineProperty(i,"__esModule",{value:!0}),i.EventName=void 0,function(e){e.DEPLOY_CONFIG="DEPLOY_CONFIG"}(n||(i.EventName=n={}))},62268:(e,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ABAP_DEPLOY_TASK=void 0,i.ABAP_DEPLOY_TASK="deploy-to-abap"},48706:(e,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.handleProjectDoesNotExist=function handleProjectDoesNotExist(e,i){const n=s.ErrorHandler.fileDoesNotExist(i);throw(0,s.handleErrorMessage)(e,{errorMsg:n}),s.ERROR_TYPE.ABORT_SIGNAL};const s=n(4591)},90409: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.initI18n=initI18n,i.t=function t(e,i){i?.ns||(i=Object.assign(i??{},{ns:r}));return o.default.t(e,i)};const o=s(n(44082)),a=s(n(46649)),r="abap-deploy-config-sub-generator";async function initI18n(){await o.default.init({lng:"en",fallbackLng:"en"},(()=>o.default.addResourceBundle("en",r,a.default)))}initI18n().catch((()=>{}))},84229:(e,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.t=i.handleProjectDoesNotExist=i.indexHtmlExists=void 0;var s=n(36620);Object.defineProperty(i,"indexHtmlExists",{enumerable:!0,get:function(){return s.indexHtmlExists}});var o=n(48706);Object.defineProperty(i,"handleProjectDoesNotExist",{enumerable:!0,get:function(){return o.handleProjectDoesNotExist}});var a=n(90409);Object.defineProperty(i,"t",{enumerable:!0,get:function(){return a.t}})},36620:(e,i,n)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.indexHtmlExists=async function indexHtmlExists(e,i){const n=await(0,s.getWebappPath)(i),a=(0,o.join)(n,"index.html");return e.exists(a)};const s=n(20787),o=n(16928)},46649:e=>{e.exports=JSON.parse('{"error":{"telemetry":"Failed to send telemetry data after deployment configuration has been added. {{- error}}"},"info":{"filesGenerated":"The files have been generated.","skippedInstallation":"Option `--skipInstall` was specified. Installation of dependencies will be skipped."},"debug":{"configExists":"Existing deployment configuration file found at {{- configPath}}","configNotFound":"No existing deployment configuration file found","indexExists":"\'webapp/index.html\' already exists and won\'t be overwritten","initFailed":"Initializing failed, unable to process project configuration. {{- error}}","initTelemetry":"Initializing telemetry in ABAP deployment configuration generator","appRootPath":"App loaded from {{- appRootPath}}"}}')}};