Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE - Generate a CAP mta.yaml configuration, supporting managed or standalone #2821

Open
5 tasks
longieirl opened this issue Jan 23, 2025 · 0 comments
Open
5 tasks

Comments

@longieirl
Copy link
Contributor

longieirl commented Jan 23, 2025

_As a persona,
As a Fiori developer using a Fiori application within a NodeJS CAP project, I'd like to be able to add deployment configuration even if there isn't already an MTA.yaml file in my CAP project.

Description
Currently, the deployment config generator prohibits users from adding deployment config if there isn't already an MTA.yaml file in the associated CAP project. The requirement is to allow the Fiori deployment generator to optionally allow the user to create an MTA file on the fly as part of the deployment configuration, if none already exists, and then permit the user to add the Fiori deployment configuration to that MTA file.

Description

Generate an MTA configuration and supporting deployment configurations, similar to the sample CAP apps shown here;

https://github.com/SAP-samples/fiori-tools-samples/tree/main/cap

There is an existing method called generateBaseConfig which will generate a base configuration using predefined templates and scripts. We need to leverage the cds package to generate and append services, for example;

cds init captestproject 
cds add mta xsuaa destination html5-repo

This will generate a mta.yaml with specific resources solely used for CAP projects. For example, the destination service will append a destination instance with the CAP server API exposed to allow HTML5 apps to consume the CAP OData services when deployed to CF.

To invoke this method generateCAPConfig, the user should be provided with a new prompt rather than existing the process showing the error that you cant add a deployment configuration since its missing MTA.

Existing error shown;

[2025-02-05 15:27:25] ERROR: The SAP Fiori application is within a CAP project and deployment should be configured as part of the CAP project. Please ensure you have a mta.yaml file defined for this project.

Here is a sample screenshot of the new prompt;

Image

The sample text;

There is no mta.yaml file defined for this project. In order to add deployment configuration for this application, this file must be present. Do you want to create an mta.yaml to continue?

Technical Design

  • enhance cf-config-writer
  • enhance @sap-ux/cf-deploy-config-sub-generator
  • expose a new generate method to specifically handle CAP mta
  • expose a new prompt to handle CAP project and missing MTA

Acceptance Criteria

GivenWhenThen format (https://martinfowler.com/bliki/GivenWhenThen.html)

Given I have an existing CAP project with no existing mta.yaml
when I execute the CAP generate method, selecting either managed or standalone approuter
then the appropriate deployment configuration is appended to the CAP project and deloy & undeploy scripts are appended to the root package.json

Given I have an existing CAP project with no existing mta.yaml
when I execute the deployment generator to append deployment configuration
then give the user a new prompt, asking them if they want to append an MTA configuration mandated | standalone to their CAP project

Notes

Tasks

  • Expose a new method called generateCAPConfig to encapsulate the CAP flow
  • Leverage existing functionality to handle updating existing configurations i.e. package.json, to append any missing scripts
  • Update @sap-ux/cf-deploy-config-sub-generator to allow deployment config to be added a CAP project if missing mta
  • Update unit tests to reflect changes
  • Test Cases defined and reflect deploying to a CF system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant