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

2821/add cap mta prompting #2889

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

2821/add cap mta prompting #2889

wants to merge 23 commits into from

Conversation

longieirl
Copy link
Contributor

@longieirl longieirl commented Feb 7, 2025

Fix for #2821

  • Add new prompt to confirm if user wants to continue with deployment, initialised if a CAP project is detected and is missing mta configuration
  • Add sample CAP Project with no mta config and containing an existing HTML5, used for testing purposes
  • Add new unit tests

Please note, Add deployment option is not shown to the user on the project attributes page if the mta config is missing, this, this is an as-is flow and is not changing. Launching the deployment generator as a root generator is where this change is only triggered.

@longieirl longieirl self-assigned this Feb 7, 2025
Copy link

changeset-bot bot commented Feb 7, 2025

🦋 Changeset detected

Latest commit: 77fffb4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@sap-ux/cf-deploy-config-sub-generator Patch
@sap-ux/deploy-config-generator-shared Patch
@sap-ux/cf-deploy-config-inquirer Patch
@sap-ux/cf-deploy-config-writer Patch
@sap-ux/abap-deploy-config-sub-generator Patch
@sap-ux/flp-config-sub-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@longieirl longieirl force-pushed the 2821/add-cap-mta-prompting branch from 5ac258b to bbf0d8a Compare February 7, 2025 11:24
@longieirl longieirl marked this pull request as ready for review February 14, 2025 13:49
@longieirl longieirl requested a review from a team as a code owner February 14, 2025 13:49
@longieirl longieirl force-pushed the 2821/add-cap-mta-prompting branch from 22ae923 to bcb7c7d Compare February 19, 2025 12:12
Comment on lines +188 to +207
if (isCAPMissingMTA) {
DeploymentGenerator.logger?.debug(t('cfGen.debug.capMissingMTA'));
// If launched as root generator, add a prompt to allow user decide if they want to add an MTA config
let questions = (await getCFApprouterQuestionsForCap({
projectRoot: this.projectRoot ?? process.cwd()
})) as Question[];
questions = withCondition(questions, (answers: Answers) => answers.addCapMtaContinue === true);
questions.unshift(...getConfirmMtaContinuePrompt());
this.appRouterAnswers = (await this.prompt(questions)) as CfAppRouterDeployConfigAnswers;
if ((this.appRouterAnswers as Answers).addCapMtaContinue !== true) {
this.abort = true;
return;
}
// Configure defaults
this.destinationName = DefaultMTADestination;
this.options.overwrite = true; // Don't prompt the user to overwrite files we've just written!
this.answers = {};
this.answers.destinationName = this.destinationName;
this.answers.addManagedAppRouter = false;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put all the mta related code in this condition into a new function? But its just a suggestion.

Copy link
Contributor

@IainSAP IainSAP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @longieirl

  • Code is clear
  • Good test coverage added
  • Not tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants