UNPKG

@sap/generator-fiori

Version:

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

3 lines (2 loc) 5.89 kB
const __esmImportMetaUrl = require('node:url').pathToFileURL(__filename).href; var L=Object.create;var c=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var r=(t,e)=>c(t,"name",{value:e,configurable:!0});var W=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},w=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of z(e))!Q.call(t,a)&&a!==o&&c(t,a,{get:()=>e[a],enumerable:!(i=F(e,a))||i.enumerable});return t};var P=(t,e,o)=>(o=t!=null?L(j(t)):{},w(e||!t||!t.__esModule?c(o,"default",{value:t,enumerable:!0}):o,t)),H=t=>w(c({},"__esModule",{value:!0}),t);var X={};W(X,{DeploymentGenerator:()=>p,ERROR_TYPE:()=>s,ErrorHandler:()=>g,TargetName:()=>x,bail:()=>E,cdsExecutable:()=>h,cdsPkg:()=>N,default:()=>V,generateDestinationName:()=>J,getConfirmMtaContinuePrompt:()=>v,getDestination:()=>K,getExtensionGenPromptOpts:()=>G,handleErrorMessage:()=>k,initI18n:()=>f,mtaExecutable:()=>_,mtaPkg:()=>C,mtaYaml:()=>q,showOverwriteQuestion:()=>O,t:()=>n});module.exports=H(X);var S=P(require("../../commonlibs/yeoman-generator/index.js"),1);var B=P(require("../../commonlibs/i18next/index.js"),1);var b={prompts:{confirmCAPMtaContinue:{message:"There is no `mta.yaml` file defined for this project. To add a deployment configuration for this application, this file must be present. Do you want to create an `mta.yaml` file to continue?"}},errors:{abortSignal:"Generator aborted.",fileDoesNotExist:"This file does not exist: {{- filePath}}. Check the file permissions are correct.",folderDoesNotExist:"This folder path does not exist: {{- filePath}}. Check the folder permissions are correct.",noAppName:"Cannot determine the application name from the `manifest.json` file.",noBaseConfig:"Error: could not read {{- baseConfig}}.",noBinary:'Cannot find the "{{bin}}" executable. Please add it to the path or use "npm i -g {{- pkg}}" to install it.',noManifest:"Error: could not read the file: `webapp/manifest.json`.",unrecognizedTarget:"Unrecognized target: {{target}}.",unknownError:"An unknown error occurred. Please try again."},debug:{loggerInitialised:"`LogWrapper` initialized for `DeploymentGenerator`."}};var T="deploy-config-generator-shared",d=B.default.createInstance();async function f(){await d.init({lng:"en",fallbackLng:"en",showSupportNotice:!1}),d.addResourceBundle("en",T,b)}r(f,"initI18n");function n(t,e){return e?.ns||(e=Object.assign(e??{},{ns:T})),d.t(t,e)}r(n,"t");f().catch(()=>{});function O(t,e=!0,o,i){return(e&&!o?!1:!i)&&t}r(O,"showOverwriteQuestion");var m=require("../../fiori-generator-shared/dist/index.js");var h="cds",N="@sap/cds-dk",_="mta",C="mta",q="mta.yaml",x;(function(t){t.ABAP="abap",t.CF="cf"})(x||(x={}));var I=require("../../commonlibs/yeoman-ui-types/index.js");var s;(function(t){t.ABORT_SIGNAL="ABORT_SIGNAL",t.NO_MANIFEST="NO_MANIFEST",t.NO_APP_NAME="NO_APP_NAME",t.NO_CDS_BIN="NO_CDS_BIN",t.NO_MTA_BIN="NO_MTA_BIN"})(s||(s={}));var g=class t{static{r(this,"ErrorHandler")}static cannotFindBinary=r((e,o)=>n("errors.noBinary",{bin:e,pkg:o}),"cannotFindBinary");static getErrorMsgFromType(e){return e?t._errorTypeToMsg[e]():n("errors.unknownError")}static _errorTypeToMsg={[s.ABORT_SIGNAL]:()=>n("errors.abortSignal"),[s.NO_MANIFEST]:()=>n("errors.noManifest"),[s.NO_APP_NAME]:()=>n("errors.noAppName"),[s.NO_CDS_BIN]:()=>t.cannotFindBinary("cds",N),[s.NO_MTA_BIN]:()=>t.cannotFindBinary("mta","mta")};static noBaseConfig=r(e=>n("errors.noBaseConfig",{baseConfig:e}),"noBaseConfig");static unrecognizedTarget=r(e=>n("errors.unrecognizedTarget",{target:e}),"unrecognizedTarget");static fileDoesNotExist=r(e=>n("errors.fileDoesNotExist",{filePath:e}),"fileDoesNotExist");static folderDoesNotExist=r(e=>n("errors.folderDoesNotExist",{filePath:e}),"folderDoesNotExist")};function E(t){throw new Error(t)}r(E,"bail");function k(t,{errorType:e,errorMsg:o}){let i=o??g.getErrorMsgFromType(e);(0,m.getHostEnvironment)()===m.hostEnvironment.cli?E(i):(p.logger?.debug(i),t?.showError(i,I.MessageType.notification))}r(k,"handleErrorMessage");var D=require("../../open-ux-shared/nodejs-utils/index.js");async function U(t){let e,o=await(0,D.findInstalledPackages)("fiori-gen-ext",{keyword:"fiori-generator-extension",vscWorkspaceConfig:t?.workspace?.getConfiguration()});return o.length>0&&(e=o?.[0].path),e}r(U,"getExtensionGenPath");async function G(t,e,o){let i,a=await U(o);if(a){let M=t(a,[]);i=typeof M._getExtensions=="function"?M._getExtensions()?.[e]:{}}return i}r(G,"getExtensionGenPromptOpts");var l=require("../../open-ux-shared/btp-utils/index.js");function J(t,e){return`${t}_${e?.replace(/(^\/)|(\/$)/g,"").replace(/\//g,"_")}`}r(J,"generateDestinationName");async function K(t){let e;return(0,l.isAppStudio)()&&t&&(e=(await(0,l.listDestinations)({stripS4HCApiHosts:!0}))[t]),e}r(K,"getDestination");var u=require("../../fiori-generator-shared/dist/index.js");var p=class t extends S.default{static{r(this,"DeploymentGenerator")}static _logger=u.DefaultLogger;constructor(e,o){super(e,o,{unique:"namespace"}),t._logger=this.options.logWrapper??this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode)}async initializing(){await f()}static get logger(){return this._logger}_configureLogging(e,o,i){return new u.LogWrapper(this.rootGeneratorName(),this.log,e,o,i)}};var y;(function(t){t.addCapMtaContinue="addCapMtaContinue"})(y||(y={}));function v(){return[{type:"confirm",name:y.addCapMtaContinue,message:n("prompts.confirmCAPMtaContinue.message"),default:!1}]}r(v,"getConfirmMtaContinuePrompt");var V=void 0;0&&(module.exports={DeploymentGenerator,ERROR_TYPE,ErrorHandler,TargetName,bail,cdsExecutable,cdsPkg,generateDestinationName,getConfirmMtaContinuePrompt,getDestination,getExtensionGenPromptOpts,handleErrorMessage,initI18n,mtaExecutable,mtaPkg,mtaYaml,showOverwriteQuestion,t});