@sap-ux/generator-adp 0.3.28 → 0.3.30

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.
@@ -1,5 +1,5 @@
1
1
  import Generator from 'yeoman-generator';
2
- import type { AdpGeneratorOptions } from './types';
2
+ import { type AdpGeneratorOptions } from './types';
3
3
  /**
4
4
  * Generator for creating an Adaptation Project.
5
5
  *
@@ -67,6 +67,10 @@ export default class extends Generator {
67
67
  * Indicates if the current layer is based on a customer base.
68
68
  */
69
69
  private isCustomerBase;
70
+ /**
71
+ * Base application inbounds, if the base application is an FLP app.
72
+ */
73
+ private baseAppInbounds?;
70
74
  /**
71
75
  * Creates an instance of the generator.
72
76
  *
@@ -99,6 +103,11 @@ export default class extends Generator {
99
103
  * Initialize the project generator from a json.
100
104
  */
101
105
  private _initFromJson;
106
+ /**
107
+ * Updates the FLP wizard steps in the prompt sequence if the FLP configuration page(s) does not already exist.
108
+ *
109
+ */
110
+ private _updateWizardStepsAfterNavigation;
102
111
  }
103
112
  export type { AdpGeneratorOptions };
104
113
  //# sourceMappingURL=index.d.ts.map
@@ -91,6 +91,10 @@ class default_1 extends yeoman_generator_1.default {
91
91
  * Indicates if the current layer is based on a customer base.
92
92
  */
93
93
  isCustomerBase;
94
+ /**
95
+ * Base application inbounds, if the base application is an FLP app.
96
+ */
97
+ baseAppInbounds;
94
98
  /**
95
99
  * Creates an instance of the generator.
96
100
  *
@@ -161,19 +165,25 @@ class default_1 extends yeoman_generator_1.default {
161
165
  prompts: this.prompts
162
166
  };
163
167
  const defaultFolder = (0, fiori_generator_shared_1.getDefaultTargetFolder)(this.options.vscode) ?? process.cwd();
168
+ if (this.prompter.isCloud) {
169
+ this.baseAppInbounds = await (0, adp_tooling_1.getBaseAppInbounds)(this.configAnswers.application.id, this.prompter.provider);
170
+ }
164
171
  const options = {
165
172
  targetFolder: { default: defaultFolder },
166
173
  ui5ValidationCli: { hide: !isCLI },
167
- enableTypeScript: { hide: this.shouldCreateExtProject }
174
+ enableTypeScript: { hide: this.shouldCreateExtProject },
175
+ addFlpConfig: { hasBaseAppInbounds: !!this.baseAppInbounds }
168
176
  };
169
177
  const attributesQuestions = (0, attributes_1.getPrompts)(this.destinationPath(), promptConfig, options);
170
178
  this.attributeAnswers = await this.prompt(attributesQuestions);
179
+ // Steps need to be updated here to be available after back navigation in Yeoman UI.
180
+ this._updateWizardStepsAfterNavigation();
171
181
  this.logger.info(`Project Attributes: ${JSON.stringify(this.attributeAnswers, null, 2)}`);
172
182
  if (this.attributeAnswers?.addFlpConfig) {
173
183
  (0, subgenHelpers_1.addFlpGen)({
184
+ vscode: this.vscode,
174
185
  projectRootPath: this._getProjectPath(),
175
- system: this.configAnswers.system,
176
- manifest: this.prompter.manifest
186
+ inbounds: this.baseAppInbounds
177
187
  }, this.composeWith.bind(this), this.logger, this.appWizard);
178
188
  }
179
189
  if (this.attributeAnswers.addDeployConfig) {
@@ -335,6 +345,21 @@ class default_1 extends yeoman_generator_1.default {
335
345
  enableTypeScript: false
336
346
  };
337
347
  }
348
+ /**
349
+ * Updates the FLP wizard steps in the prompt sequence if the FLP configuration page(s) does not already exist.
350
+ *
351
+ */
352
+ _updateWizardStepsAfterNavigation() {
353
+ const pages = this.prompts['items'];
354
+ const flpPagesExist = pages.some((p) => p.name === (0, i18n_1.t)('yuiNavSteps.flpConfigName'));
355
+ const deployPageExists = pages.some((p) => p.name === (0, i18n_1.t)('yuiNavSteps.deployConfigName'));
356
+ if (!deployPageExists) {
357
+ (0, steps_1.updateWizardSteps)(this.prompts, (0, steps_1.getDeployPage)(), (0, i18n_1.t)('yuiNavSteps.projectAttributesName'), this.attributeAnswers.addDeployConfig);
358
+ }
359
+ if (!flpPagesExist) {
360
+ (0, steps_1.updateFlpWizardSteps)(!!this.baseAppInbounds, this.prompts, this.attributeAnswers.projectName, this.attributeAnswers.addFlpConfig);
361
+ }
362
+ }
338
363
  }
339
364
  exports.default = default_1;
340
365
  //# sourceMappingURL=index.js.map
@@ -30,9 +30,9 @@ export declare function getAddDeployConfigPrompt(prompts: YeomanUiSteps, _?: Add
30
30
  *
31
31
  * @param {YeomanUiSteps} prompts - The Yeoman UI pages.
32
32
  * @param {boolean} isCloudProject - Whether the project is for a cloud-based system.
33
- * @param {AddFlpConfigPromptOptions} [_] - Optional prompt options to control visibility.
33
+ * @param {AddFlpConfigPromptOptions} options - Optional prompt options to control visibility.
34
34
  * @returns {AttributesQuestion} The prompt configuration for Add FLP config confirmation.
35
35
  */
36
- export declare function getFlpConfigPrompt(prompts: YeomanUiSteps, isCloudProject: boolean, _?: AddFlpConfigPromptOptions): AttributesQuestion;
36
+ export declare function getFlpConfigPrompt(prompts: YeomanUiSteps, isCloudProject: boolean, options?: AddFlpConfigPromptOptions): AttributesQuestion;
37
37
  export {};
38
38
  //# sourceMappingURL=attributes.d.ts.map
@@ -226,10 +226,10 @@ function getAddDeployConfigPrompt(prompts, _) {
226
226
  *
227
227
  * @param {YeomanUiSteps} prompts - The Yeoman UI pages.
228
228
  * @param {boolean} isCloudProject - Whether the project is for a cloud-based system.
229
- * @param {AddFlpConfigPromptOptions} [_] - Optional prompt options to control visibility.
229
+ * @param {AddFlpConfigPromptOptions} options - Optional prompt options to control visibility.
230
230
  * @returns {AttributesQuestion} The prompt configuration for Add FLP config confirmation.
231
231
  */
232
- function getFlpConfigPrompt(prompts, isCloudProject, _) {
232
+ function getFlpConfigPrompt(prompts, isCloudProject, options) {
233
233
  return {
234
234
  type: 'confirm',
235
235
  name: types_1.attributePromptNames.addFlpConfig,
@@ -239,8 +239,8 @@ function getFlpConfigPrompt(prompts, isCloudProject, _) {
239
239
  breadcrumb: true
240
240
  },
241
241
  when: () => isCloudProject,
242
- validate: (value) => {
243
- (0, steps_1.updateWizardSteps)(prompts, (0, steps_1.getFlpPage)(), (0, i18n_1.t)('yuiNavSteps.deployConfigName'), value);
242
+ validate: (value, answers) => {
243
+ (0, steps_1.updateFlpWizardSteps)(!!options?.hasBaseAppInbounds, prompts, answers.projectName, value);
244
244
  return true;
245
245
  }
246
246
  };
@@ -124,6 +124,7 @@ export interface AddDeployConfigPromptOptions {
124
124
  }
125
125
  export interface AddFlpConfigPromptOptions {
126
126
  hide?: boolean;
127
+ hasBaseAppInbounds?: boolean;
127
128
  }
128
129
  export type AttributePromptOptions = Partial<{
129
130
  [attributePromptNames.projectName]: ProjectNamePromptOptions;
@@ -5,7 +5,7 @@
5
5
  "projectAttributesName": "Project Attributes",
6
6
  "projectAttributesDescr": "Configure the main project attributes.",
7
7
  "flpConfigName": "SAP Fiori Launchpad Configuration",
8
- "flpConfigDescr": "Configure SAP Fiori launchpad settings for {{- projectName}}.",
8
+ "tileSettingsName": "SAP Fiori Launchpad Configuration - Tile Settings for {{- projectName}}",
9
9
  "deployConfigName": "Deployment Configuration",
10
10
  "deployConfigDescr": "Configure deployment settings."
11
11
  },
@@ -8,9 +8,20 @@ export declare function getWizardPages(): IPrompt[];
8
8
  /**
9
9
  * Returns the FLP configuration page step.
10
10
  *
11
+ * @param {boolean} showTileSettingsPage - Flag to determine if the tile settings page should be shown.
12
+ * @param {string} projectName - The name of the project.
11
13
  * @returns {IPrompt} The FLP configuration wizard page.
12
14
  */
13
- export declare function getFlpPage(): IPrompt;
15
+ export declare function getFlpPages(showTileSettingsPage: boolean, projectName: string): IPrompt[];
16
+ /**
17
+ * Updates the FLP wizard steps by adding or removing FLP-related pages based on the presence of a base app inbound.
18
+ *
19
+ * @param {boolean} hasBaseAppInbound - Indicates if the base app inbound exists.
20
+ * @param {YeomanUiSteps} prompts - The Yeoman UI Prompts container object.
21
+ * @param {string} projectName - The name of the project.
22
+ * @param {boolean} [shouldAdd] - Whether to add (`true`) or remove (`false`) the steps.
23
+ */
24
+ export declare function updateFlpWizardSteps(hasBaseAppInbound: boolean, prompts: YeomanUiSteps, projectName: string, shouldAdd?: boolean): void;
14
25
  /**
15
26
  * Returns the deploy configuration page step.
16
27
  *
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getWizardPages = getWizardPages;
4
- exports.getFlpPage = getFlpPage;
4
+ exports.getFlpPages = getFlpPages;
5
+ exports.updateFlpWizardSteps = updateFlpWizardSteps;
5
6
  exports.getDeployPage = getDeployPage;
6
7
  exports.updateWizardSteps = updateWizardSteps;
7
8
  const i18n_1 = require("./i18n");
@@ -25,13 +26,41 @@ function getWizardPages() {
25
26
  /**
26
27
  * Returns the FLP configuration page step.
27
28
  *
29
+ * @param {boolean} showTileSettingsPage - Flag to determine if the tile settings page should be shown.
30
+ * @param {string} projectName - The name of the project.
28
31
  * @returns {IPrompt} The FLP configuration wizard page.
29
32
  */
30
- function getFlpPage() {
31
- return {
32
- name: (0, i18n_1.t)('yuiNavSteps.flpConfigName'),
33
- description: (0, i18n_1.t)('yuiNavSteps.flpConfigDescr')
34
- };
33
+ function getFlpPages(showTileSettingsPage, projectName) {
34
+ const pages = [
35
+ {
36
+ name: (0, i18n_1.t)('yuiNavSteps.flpConfigName'),
37
+ description: ''
38
+ }
39
+ ];
40
+ if (showTileSettingsPage) {
41
+ pages.unshift({
42
+ name: (0, i18n_1.t)('yuiNavSteps.tileSettingsName', { projectName }),
43
+ description: ''
44
+ });
45
+ }
46
+ return pages;
47
+ }
48
+ /**
49
+ * Updates the FLP wizard steps by adding or removing FLP-related pages based on the presence of a base app inbound.
50
+ *
51
+ * @param {boolean} hasBaseAppInbound - Indicates if the base app inbound exists.
52
+ * @param {YeomanUiSteps} prompts - The Yeoman UI Prompts container object.
53
+ * @param {string} projectName - The name of the project.
54
+ * @param {boolean} [shouldAdd] - Whether to add (`true`) or remove (`false`) the steps.
55
+ */
56
+ function updateFlpWizardSteps(hasBaseAppInbound, prompts, projectName, shouldAdd = true) {
57
+ const pages = getFlpPages(hasBaseAppInbound, projectName);
58
+ if (pages.length === 2) {
59
+ updateWizardSteps(prompts, pages[0], (0, i18n_1.t)('yuiNavSteps.deployConfigName'), shouldAdd);
60
+ updateWizardSteps(prompts, pages[1], (0, i18n_1.t)('yuiNavSteps.tileSettingsName'), shouldAdd);
61
+ return;
62
+ }
63
+ updateWizardSteps(prompts, pages[0], (0, i18n_1.t)('yuiNavSteps.deployConfigName'), shouldAdd);
35
64
  }
36
65
  /**
37
66
  * Returns the deploy configuration page step.
@@ -1,6 +1,6 @@
1
1
  import type Generator from 'yeoman-generator';
2
- import { type AppWizard } from '@sap-devx/yeoman-ui-types';
3
- import type { Manifest } from '@sap-ux/project-access';
2
+ import type { AppWizard } from '@sap-devx/yeoman-ui-types';
3
+ import type { ManifestNamespace } from '@sap-ux/project-access';
4
4
  import type { ILogWrapper } from '@sap-ux/fiori-generator-shared';
5
5
  import type { ConfigAnswers, AttributesAnswers, SystemLookup } from '@sap-ux/adp-tooling';
6
6
  /**
@@ -15,9 +15,9 @@ interface ExtProjectGenProps {
15
15
  * Parameters required for composing the FLP config generator.
16
16
  */
17
17
  interface FlpGenProps {
18
+ vscode: unknown;
18
19
  projectRootPath: string;
19
- system: string;
20
- manifest: Manifest;
20
+ inbounds?: ManifestNamespace.Inbound;
21
21
  }
22
22
  /**
23
23
  * Options required to invoke the deploy-config subgenerator.
@@ -41,7 +41,7 @@ interface DeployGenOptions {
41
41
  * @param {ILogWrapper} logger - Logger instance for tracking operations and errors.
42
42
  * @param {AppWizard} appWizard - AppWizard instance for interacting with the UI (optional).
43
43
  */
44
- export declare function addFlpGen({ projectRootPath, system, manifest }: FlpGenProps, composeWith: Generator['composeWith'], logger: ILogWrapper, appWizard: AppWizard): void;
44
+ export declare function addFlpGen({ projectRootPath, vscode, inbounds }: FlpGenProps, composeWith: Generator['composeWith'], logger: ILogWrapper, appWizard: AppWizard): void;
45
45
  /**
46
46
  * Composes the Fiori deploy-config sub-generator using `composeWith`. This sub-generator configures
47
47
  * deployment for Fiori applications, such as to ABAP or Cloud Foundry environments.
@@ -17,15 +17,15 @@ const extension_project_1 = require("../app/extension-project");
17
17
  * @param {ILogWrapper} logger - Logger instance for tracking operations and errors.
18
18
  * @param {AppWizard} appWizard - AppWizard instance for interacting with the UI (optional).
19
19
  */
20
- function addFlpGen({ projectRootPath, system, manifest }, composeWith, logger, appWizard) {
20
+ function addFlpGen({ projectRootPath, vscode, inbounds }, composeWith, logger, appWizard) {
21
21
  try {
22
22
  /**
23
23
  * We are using this namespace for now because '@sap-ux/adp-flp-config-sub-generator' is not yet bundled in '@sap/generator-fiori'.
24
24
  */
25
25
  composeWith(require.resolve('@sap-ux/adp-flp-config-sub-generator/generators/app'), {
26
26
  launchAsSubGen: true,
27
- manifest,
28
- system,
27
+ vscode,
28
+ inbounds,
29
29
  data: { projectRootPath },
30
30
  appWizard
31
31
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sap-ux/generator-adp",
3
3
  "displayName": "SAPUI5 Adaptation Project",
4
4
  "description": "Adaptation project allows you to create an app variant for an existing SAP Fiori elements-based or SAPUI5 freestyle application, without changing the original application.",
5
- "version": "0.3.28",
5
+ "version": "0.3.30",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -29,18 +29,18 @@
29
29
  "i18next": "23.5.1",
30
30
  "yeoman-generator": "5.10.0",
31
31
  "uuid": "10.0.0",
32
- "@sap-ux/adp-tooling": "0.14.28",
33
- "@sap-ux/axios-extension": "1.22.2",
32
+ "@sap-ux/adp-tooling": "0.14.30",
33
+ "@sap-ux/axios-extension": "1.22.3",
34
34
  "@sap-ux/btp-utils": "1.1.0",
35
35
  "@sap-ux/feature-toggle": "0.3.0",
36
- "@sap-ux/inquirer-common": "0.7.13",
36
+ "@sap-ux/inquirer-common": "0.7.15",
37
37
  "@sap-ux/logger": "0.7.0",
38
- "@sap-ux/project-access": "1.30.2",
38
+ "@sap-ux/project-access": "1.30.3",
39
39
  "@sap-ux/store": "1.1.0",
40
- "@sap-ux/system-access": "0.6.7",
41
- "@sap-ux/project-input-validator": "0.6.3",
42
- "@sap-ux/fiori-generator-shared": "0.12.8",
43
- "@sap-ux/adp-flp-config-sub-generator": "0.1.28"
40
+ "@sap-ux/system-access": "0.6.8",
41
+ "@sap-ux/project-input-validator": "0.6.4",
42
+ "@sap-ux/fiori-generator-shared": "0.12.10",
43
+ "@sap-ux/adp-flp-config-sub-generator": "0.1.30"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@jest/types": "29.6.3",
@@ -55,7 +55,7 @@
55
55
  "fs-extra": "10.0.0",
56
56
  "rimraf": "5.0.5",
57
57
  "yeoman-test": "6.3.0",
58
- "@sap-ux/deploy-config-sub-generator": "0.3.22"
58
+ "@sap-ux/deploy-config-sub-generator": "0.3.24"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=20.x"