@sap-ux/cf-deploy-config-sub-generator 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators/app/index.d.ts +4 -2
- package/generators/app/index.js +40 -11
- package/generators/app/questions.d.ts +11 -1
- package/generators/app/questions.js +22 -1
- package/generators/app/types.d.ts +5 -1
- package/generators/translations/cf-deploy-config-sub-generator.i18n.json +2 -1
- package/package.json +6 -6
|
@@ -2,8 +2,8 @@ import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
|
|
|
2
2
|
import { DESTINATION_AUTHTYPE_NOTFOUND, API_BUSINESS_HUB_ENTERPRISE_PREFIX } from '../utils';
|
|
3
3
|
import { loadManifest } from './utils';
|
|
4
4
|
import { getCFQuestions } from './questions';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { CfDeployConfigOptions } from './types';
|
|
6
|
+
import { CfDeployConfigAnswers } from '@sap-ux/cf-deploy-config-inquirer';
|
|
7
7
|
/**
|
|
8
8
|
* Cloud Foundry deployment configuration generator.
|
|
9
9
|
*/
|
|
@@ -18,6 +18,7 @@ export default class extends DeploymentGenerator {
|
|
|
18
18
|
private readonly cloudServiceName?;
|
|
19
19
|
private readonly serviceBase?;
|
|
20
20
|
private answers;
|
|
21
|
+
private appRouterAnswers;
|
|
21
22
|
private projectRoot;
|
|
22
23
|
private mtaPath?;
|
|
23
24
|
private isCap;
|
|
@@ -47,6 +48,7 @@ export default class extends DeploymentGenerator {
|
|
|
47
48
|
*/
|
|
48
49
|
private _processProjectConfigs;
|
|
49
50
|
prompting(): Promise<void>;
|
|
51
|
+
private _prompting;
|
|
50
52
|
/**
|
|
51
53
|
* Handles specific logic for api hub configurations.
|
|
52
54
|
*/
|
package/generators/app/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const project_access_1 = require("@sap-ux/project-access");
|
|
|
19
19
|
const telemetryEvents_1 = require("../telemetryEvents");
|
|
20
20
|
const questions_1 = require("./questions");
|
|
21
21
|
Object.defineProperty(exports, "getCFQuestions", { enumerable: true, get: function () { return questions_1.getCFQuestions; } });
|
|
22
|
+
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
22
23
|
/**
|
|
23
24
|
* Cloud Foundry deployment configuration generator.
|
|
24
25
|
*/
|
|
@@ -33,6 +34,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
33
34
|
cloudServiceName;
|
|
34
35
|
serviceBase;
|
|
35
36
|
answers = {};
|
|
37
|
+
appRouterAnswers;
|
|
36
38
|
projectRoot;
|
|
37
39
|
mtaPath;
|
|
38
40
|
isCap = false;
|
|
@@ -56,7 +58,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
56
58
|
this.vscode = opts.vscode;
|
|
57
59
|
this.options = opts;
|
|
58
60
|
this.destinationName = opts.destinationName ?? '';
|
|
59
|
-
this.addMtaDestination = opts.addMTADestination ?? false; // by default it's false unless passed in i.e. headless flow
|
|
61
|
+
this.addMtaDestination = opts.addMTADestination ?? false; // by default, it's false unless passed in i.e. headless flow
|
|
60
62
|
this.lcapModeOnly = opts.lcapModeOnly ?? false;
|
|
61
63
|
this.cloudServiceName = opts.cloudServiceName || undefined;
|
|
62
64
|
this.apiHubConfig = opts.apiHubConfig;
|
|
@@ -83,6 +85,9 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
83
85
|
if (!this.launchDeployConfigAsSubGenerator) {
|
|
84
86
|
await this._init();
|
|
85
87
|
}
|
|
88
|
+
else {
|
|
89
|
+
await this._processProjectConfigs();
|
|
90
|
+
}
|
|
86
91
|
}
|
|
87
92
|
async _init() {
|
|
88
93
|
// mta executable is required as mta-lib is used
|
|
@@ -105,7 +110,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
105
110
|
async _processProjectPaths() {
|
|
106
111
|
const mtaPathResult = await (0, project_access_1.getMtaPath)(this.appPath);
|
|
107
112
|
this.mtaPath = mtaPathResult?.mtaPath;
|
|
108
|
-
const capRoot = await (0, project_access_1.findCapProjectRoot)(this.appPath);
|
|
113
|
+
const capRoot = await (0, project_access_1.findCapProjectRoot)(this.appPath, true, this.fs);
|
|
109
114
|
if (capRoot) {
|
|
110
115
|
if (!hasbin.sync(deploy_config_generator_shared_1.cdsExecutable)) {
|
|
111
116
|
(0, deploy_config_generator_shared_1.bail)(deploy_config_generator_shared_1.ErrorHandler.getErrorMsgFromType(deploy_config_generator_shared_1.ERROR_TYPE.NO_CDS_BIN));
|
|
@@ -133,18 +138,38 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
133
138
|
if (this.abort) {
|
|
134
139
|
return;
|
|
135
140
|
}
|
|
136
|
-
if (this.isCap && this.projectRoot && !this.mtaPath) {
|
|
137
|
-
// if the user is adding deploy config to a CAP project and there is no mta.yaml in the root, then log error and exit
|
|
138
|
-
this.abort = true;
|
|
139
|
-
(0, deploy_config_generator_shared_1.handleErrorMessage)(this.appWizard, { errorType: deploy_config_generator_shared_1.ERROR_TYPE.CAP_DEPLOYMENT_NO_MTA });
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
141
|
if (!this.launchDeployConfigAsSubGenerator) {
|
|
142
|
+
await this._prompting();
|
|
143
|
+
}
|
|
144
|
+
await this._reconcileAnswersWithOptions();
|
|
145
|
+
}
|
|
146
|
+
async _prompting() {
|
|
147
|
+
const isCAPMissingMTA = this.isCap && this.projectRoot && !this.mtaPath;
|
|
148
|
+
if (isCAPMissingMTA) {
|
|
149
|
+
deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('cfGen.debug.capMissingMTA'));
|
|
150
|
+
// If launched as root generator, add a prompt to allow user decide if they want to add an MTA config
|
|
151
|
+
let questions = (await (0, questions_1.getCFApprouterQuestionsForCap)({
|
|
152
|
+
projectRoot: this.projectRoot ?? process.cwd()
|
|
153
|
+
}));
|
|
154
|
+
questions = (0, inquirer_common_1.withCondition)(questions, (answers) => answers.addCapMtaContinue === true);
|
|
155
|
+
questions.unshift(...(0, deploy_config_generator_shared_1.getConfirmMtaContinuePrompt)());
|
|
156
|
+
this.appRouterAnswers = (await this.prompt(questions));
|
|
157
|
+
if (this.appRouterAnswers.addCapMtaContinue !== true) {
|
|
158
|
+
this.abort = true;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// Configure defaults
|
|
162
|
+
this.destinationName = cf_deploy_config_writer_1.DefaultMTADestination;
|
|
163
|
+
this.options.overwrite = true; // Don't prompt the user to overwrite files we've just written!
|
|
164
|
+
this.answers = {};
|
|
165
|
+
this.answers.destinationName = this.destinationName;
|
|
166
|
+
this.answers.addManagedAppRouter = false;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
143
169
|
await this._handleApiHubConfig();
|
|
144
170
|
const questions = await this._getCFQuestions();
|
|
145
171
|
this.answers = await this.prompt(questions);
|
|
146
172
|
}
|
|
147
|
-
await this._reconcileAnswersWithOptions();
|
|
148
173
|
}
|
|
149
174
|
/**
|
|
150
175
|
* Handles specific logic for api hub configurations.
|
|
@@ -203,8 +228,12 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
|
|
|
203
228
|
}
|
|
204
229
|
async _writing() {
|
|
205
230
|
try {
|
|
206
|
-
|
|
207
|
-
|
|
231
|
+
// Step1. (Optional) Generate CAP MTA with specific approuter type managed | standalone
|
|
232
|
+
if (this.appRouterAnswers) {
|
|
233
|
+
await (0, cf_deploy_config_writer_1.generateCAPConfig)(this.appRouterAnswers, this.fs, deploy_config_generator_shared_1.DeploymentGenerator.logger);
|
|
234
|
+
}
|
|
235
|
+
// Step2. Append HTML5 app to MTA
|
|
236
|
+
await (0, cf_deploy_config_writer_1.generateAppConfig)(this._getAppConfig(), this.fs, deploy_config_generator_shared_1.DeploymentGenerator.logger);
|
|
208
237
|
}
|
|
209
238
|
catch (error) {
|
|
210
239
|
this.abort = true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type CfAppRouterDeployConfigQuestions, type CfDeployConfigQuestions } from '@sap-ux/cf-deploy-config-inquirer';
|
|
1
2
|
import type { ApiHubConfig } from '@sap-ux/cf-deploy-config-writer';
|
|
2
|
-
import type { CfDeployConfigQuestions } from '@sap-ux/cf-deploy-config-inquirer';
|
|
3
3
|
/**
|
|
4
4
|
* Fetches the Cloud Foundry deployment configuration questions.
|
|
5
5
|
*
|
|
@@ -20,4 +20,14 @@ export declare function getCFQuestions({ projectRoot, isAbapDirectServiceBinding
|
|
|
20
20
|
addOverwrite: boolean;
|
|
21
21
|
apiHubConfig?: ApiHubConfig;
|
|
22
22
|
}): Promise<CfDeployConfigQuestions[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieve the CF Approuter questions, certain prompts are restricted to support CAP project.
|
|
25
|
+
*
|
|
26
|
+
* @param options - the options required for retrieving the prompts.
|
|
27
|
+
* @param options.projectRoot - the root path of the project.
|
|
28
|
+
* @returns the cf approuter config questions.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCFApprouterQuestionsForCap({ projectRoot }: {
|
|
31
|
+
projectRoot: string;
|
|
32
|
+
}): Promise<CfAppRouterDeployConfigQuestions[]>;
|
|
23
33
|
//# sourceMappingURL=questions.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCFQuestions = void 0;
|
|
3
|
+
exports.getCFApprouterQuestionsForCap = exports.getCFQuestions = void 0;
|
|
4
4
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
5
5
|
const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
|
|
6
6
|
const project_access_1 = require("@sap-ux/project-access");
|
|
@@ -45,4 +45,25 @@ async function getCFQuestions({ projectRoot, isAbapDirectServiceBinding, cfDesti
|
|
|
45
45
|
return (0, cf_deploy_config_inquirer_1.getPrompts)(options);
|
|
46
46
|
}
|
|
47
47
|
exports.getCFQuestions = getCFQuestions;
|
|
48
|
+
/**
|
|
49
|
+
* Retrieve the CF Approuter questions, certain prompts are restricted to support CAP project.
|
|
50
|
+
*
|
|
51
|
+
* @param options - the options required for retrieving the prompts.
|
|
52
|
+
* @param options.projectRoot - the root path of the project.
|
|
53
|
+
* @returns the cf approuter config questions.
|
|
54
|
+
*/
|
|
55
|
+
async function getCFApprouterQuestionsForCap({ projectRoot }) {
|
|
56
|
+
// Disable some prompts, not required for CAP flow
|
|
57
|
+
const appRouterPromptOptions = {
|
|
58
|
+
[cf_deploy_config_inquirer_1.appRouterPromptNames.mtaPath]: projectRoot,
|
|
59
|
+
[cf_deploy_config_inquirer_1.appRouterPromptNames.mtaId]: true,
|
|
60
|
+
[cf_deploy_config_inquirer_1.appRouterPromptNames.mtaDescription]: false,
|
|
61
|
+
[cf_deploy_config_inquirer_1.appRouterPromptNames.mtaVersion]: false,
|
|
62
|
+
[cf_deploy_config_inquirer_1.appRouterPromptNames.routerType]: true,
|
|
63
|
+
[cf_deploy_config_inquirer_1.appRouterPromptNames.addConnectivityService]: true,
|
|
64
|
+
[cf_deploy_config_inquirer_1.appRouterPromptNames.addABAPServiceBinding]: false
|
|
65
|
+
};
|
|
66
|
+
return (0, cf_deploy_config_inquirer_1.getAppRouterPrompts)(appRouterPromptOptions);
|
|
67
|
+
}
|
|
68
|
+
exports.getCFApprouterQuestionsForCap = getCFApprouterQuestionsForCap;
|
|
48
69
|
//# sourceMappingURL=questions.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AppWizard } from '@sap-devx/yeoman-ui-types';
|
|
2
|
-
import type
|
|
2
|
+
import { type CfDeployConfigAnswers } from '@sap-ux/cf-deploy-config-inquirer';
|
|
3
3
|
import type { ApiHubConfig } from '@sap-ux/cf-deploy-config-writer';
|
|
4
4
|
import type { TelemetryData } from '@sap-ux/fiori-generator-shared';
|
|
5
5
|
export interface CfDeployConfigOptions extends CfDeployConfigAnswers {
|
|
@@ -83,5 +83,9 @@ export interface CfDeployConfigOptions extends CfDeployConfigAnswers {
|
|
|
83
83
|
* Telemetry data to be send after deployment configuration has been added
|
|
84
84
|
*/
|
|
85
85
|
telemetryData?: TelemetryData;
|
|
86
|
+
/**
|
|
87
|
+
* Option to invoke the getConfirmMtaContinue prompt
|
|
88
|
+
*/
|
|
89
|
+
addCapMtaContinue?: boolean;
|
|
86
90
|
}
|
|
87
91
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"debug": {
|
|
28
28
|
"promptOptions": "Retrieving CF prompts using: \n {{- options}}",
|
|
29
|
-
"initTelemetry": "Initializing telemetry in CF deployment configuration generator"
|
|
29
|
+
"initTelemetry": "Initializing telemetry in CF deployment configuration generator",
|
|
30
|
+
"capMissingMTA": "CAP project detected with no MTA configuration"
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
"appRouterGen": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/cf-deploy-config-sub-generator",
|
|
3
3
|
"description": "Generators for configuring Cloud Foundry deployment configuration",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.11",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"i18next": "23.5.1",
|
|
25
25
|
"yeoman-generator": "5.10.0",
|
|
26
26
|
"@sap-ux/btp-utils": "1.0.1",
|
|
27
|
-
"@sap-ux/cf-deploy-config-writer": "0.1.
|
|
28
|
-
"@sap-ux/cf-deploy-config-inquirer": "0.2.
|
|
29
|
-
"@sap-ux/deploy-config-generator-shared": "0.0.
|
|
27
|
+
"@sap-ux/cf-deploy-config-writer": "0.1.12",
|
|
28
|
+
"@sap-ux/cf-deploy-config-inquirer": "0.2.8",
|
|
29
|
+
"@sap-ux/deploy-config-generator-shared": "0.0.27",
|
|
30
30
|
"@sap-ux/feature-toggle": "0.2.3",
|
|
31
|
-
"@sap-ux/fiori-generator-shared": "0.
|
|
31
|
+
"@sap-ux/fiori-generator-shared": "0.9.0",
|
|
32
32
|
"@sap-ux/i18n": "0.2.1",
|
|
33
|
-
"@sap-ux/inquirer-common": "0.6.
|
|
33
|
+
"@sap-ux/inquirer-common": "0.6.19",
|
|
34
34
|
"@sap-ux/project-access": "1.29.8",
|
|
35
35
|
"@sap-ux/ui5-config": "0.26.2"
|
|
36
36
|
},
|