@sap-ux/fiori-app-sub-generator 0.2.10 → 0.4.0

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.
@@ -194,8 +194,9 @@ class FioriAppGenerator extends yeoman_generator_1.default {
194
194
  (0, subgenHelpers_1.addDeployGen)({
195
195
  service: this.state.service,
196
196
  projectName: this.state.project.name,
197
+ promptSettings: generatorOptions.promptSettings,
197
198
  targetFolder: this.state.project.targetFolder,
198
- applicationType: 'FF' // Telemetry data
199
+ applicationType: this.state.floorplan === types_1.FloorplanFF.FF_SIMPLE ? 'FF' : 'FE' // Telemetry data
199
200
  }, this.composeWith.bind(this), FioriAppGenerator.logger, this.appWizard);
200
201
  }
201
202
  if (this.state.project?.addFlpConfig) {
@@ -267,7 +268,7 @@ class FioriAppGenerator extends yeoman_generator_1.default {
267
268
  }
268
269
  // Write after app, using values from the transformed state so defaults have been applied
269
270
  const readMeUpdated = { ui5Version: appConfig.ui5?.minUI5Version };
270
- await (0, writing_1.writeReadMe)(this.state, types_1.generatorName, this.generatorVersion, destRoot, this.fs, readMeUpdated);
271
+ await (0, writing_1.writeAppGenInfoFiles)(this.state, types_1.generatorName, this.generatorVersion, destRoot, this.fs, readMeUpdated);
271
272
  }
272
273
  catch (error) {
273
274
  FioriAppGenerator.logger.fatal(`${(0, utils_1.t)('error.errorWritingApplicationFiles')} : ${error}`);
@@ -1,22 +1,24 @@
1
1
  import type { AppWizard } from '@sap-devx/yeoman-ui-types';
2
2
  import type { ILogWrapper } from '@sap-ux/fiori-generator-shared';
3
3
  import type Generator from 'yeoman-generator';
4
- import { type Service } from '../types';
4
+ import { type FioriAppGeneratorPromptSettings, type Service } from '../types';
5
5
  /**
6
6
  * Add the '@sap/fiori:fiori-deployment' generator as a subgenerator.
7
7
  *
8
- * @param root0
9
- * @param root0.service
10
- * @param root0.projectName
11
- * @param root0.targetFolder
12
- * @param root0.applicationType
13
- * @param composeWith
14
- * @param logger
15
- * @param appWizard
8
+ * @param deployGenOpts
9
+ * @param deployGenOpts.service - service object
10
+ * @param deployGenOpts.projectName - project name
11
+ * @param deployGenOpts.promptSettings - prompt settings for the deployment generator
12
+ * @param deployGenOpts.targetFolder - target folder for the deployment configuration
13
+ * @param deployGenOpts.applicationType - application type, used for telemetry (FF | FE)
14
+ * @param composeWith - the composeWith function from the Yeoman generator
15
+ * @param logger - logger instance
16
+ * @param appWizard - instance of the AppWizard
16
17
  */
17
- export declare function addDeployGen({ service, projectName, targetFolder, applicationType }: {
18
+ export declare function addDeployGen({ service, projectName, promptSettings, targetFolder, applicationType }: {
18
19
  service: Partial<Service>;
19
20
  projectName: string;
21
+ promptSettings?: FioriAppGeneratorPromptSettings;
20
22
  targetFolder: string;
21
23
  applicationType: string;
22
24
  }, composeWith: Generator['composeWith'], logger: ILogWrapper, appWizard?: AppWizard): void;
@@ -8,16 +8,17 @@ const utils_1 = require("../utils");
8
8
  /**
9
9
  * Add the '@sap/fiori:fiori-deployment' generator as a subgenerator.
10
10
  *
11
- * @param root0
12
- * @param root0.service
13
- * @param root0.projectName
14
- * @param root0.targetFolder
15
- * @param root0.applicationType
16
- * @param composeWith
17
- * @param logger
18
- * @param appWizard
11
+ * @param deployGenOpts
12
+ * @param deployGenOpts.service - service object
13
+ * @param deployGenOpts.projectName - project name
14
+ * @param deployGenOpts.promptSettings - prompt settings for the deployment generator
15
+ * @param deployGenOpts.targetFolder - target folder for the deployment configuration
16
+ * @param deployGenOpts.applicationType - application type, used for telemetry (FF | FE)
17
+ * @param composeWith - the composeWith function from the Yeoman generator
18
+ * @param logger - logger instance
19
+ * @param appWizard - instance of the AppWizard
19
20
  */
20
- function addDeployGen({ service, projectName, targetFolder, applicationType }, composeWith, logger, appWizard) {
21
+ function addDeployGen({ service, projectName, promptSettings, targetFolder, applicationType }, composeWith, logger, appWizard) {
21
22
  composeWith('@sap/fiori:deploy-config', {
22
23
  launchDeployConfigAsSubGenerator: true,
23
24
  appGenServiceHost: service.host,
@@ -30,7 +31,8 @@ function addDeployGen({ service, projectName, targetFolder, applicationType }, c
30
31
  projectPath: targetFolder,
31
32
  appWizard: appWizard,
32
33
  telemetryData: { appType: applicationType },
33
- logWrapper: logger
34
+ logWrapper: logger,
35
+ subGenPromptOptions: promptSettings?.['@sap-ux/deploy-config-sub-generator']
34
36
  });
35
37
  }
36
38
  /**
@@ -1,21 +1,23 @@
1
- import type { ReadMe } from '@sap-ux/fiori-generator-shared';
1
+ import type { AppGenInfo } from '@sap-ux/fiori-generator-shared';
2
2
  import type { Editor } from 'mem-fs-editor';
3
3
  import type { ApiHubConfig, State } from '../types';
4
4
  /**
5
- * Writes a README.md file based on project, service, and additional readme properties.
5
+ * Writes app related information files - README.md & .appGenInfo.json.
6
+ * The files are based on the project, service, and additional properties.
6
7
  *
7
8
  * @param state
8
9
  * @param state.project
9
10
  * @param state.service
10
11
  * @param state.floorplan
11
12
  * @param state.entityRelatedConfig
13
+ * @param state.appGenInfo
12
14
  * @param generatorName
13
15
  * @param generatorVersion
14
16
  * @param targetPath
15
17
  * @param fs
16
- * @param readMe
18
+ * @param existingAppGenInfo
17
19
  */
18
- export declare function writeReadMe({ project, service, floorplan, entityRelatedConfig }: State, generatorName: string, generatorVersion: string, targetPath: string, fs: Editor, readMe?: Partial<ReadMe>): Promise<void>;
20
+ export declare function writeAppGenInfoFiles({ project, service, floorplan, entityRelatedConfig, appGenInfo }: State, generatorName: string, generatorVersion: string, targetPath: string, fs: Editor, existingAppGenInfo?: Partial<AppGenInfo>): Promise<void>;
19
21
  /**
20
22
  * Create the files for apiHub integration.
21
23
  *
@@ -1,82 +1,85 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeReadMe = writeReadMe;
3
+ exports.writeAppGenInfoFiles = writeAppGenInfoFiles;
4
4
  exports.writeAPIHubKeyFiles = writeAPIHubKeyFiles;
5
5
  const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
6
6
  const path_1 = require("path");
7
7
  const types_1 = require("../types");
8
8
  const utils_1 = require("../utils");
9
9
  /**
10
- * Writes a README.md file based on project, service, and additional readme properties.
10
+ * Writes app related information files - README.md & .appGenInfo.json.
11
+ * The files are based on the project, service, and additional properties.
11
12
  *
12
13
  * @param state
13
14
  * @param state.project
14
15
  * @param state.service
15
16
  * @param state.floorplan
16
17
  * @param state.entityRelatedConfig
18
+ * @param state.appGenInfo
17
19
  * @param generatorName
18
20
  * @param generatorVersion
19
21
  * @param targetPath
20
22
  * @param fs
21
- * @param readMe
23
+ * @param existingAppGenInfo
22
24
  */
23
- async function writeReadMe({ project, service, floorplan, entityRelatedConfig }, generatorName, generatorVersion, targetPath, fs, readMe) {
25
+ async function writeAppGenInfoFiles({ project, service, floorplan, entityRelatedConfig, appGenInfo }, generatorName, generatorVersion, targetPath, fs, existingAppGenInfo) {
24
26
  const templateLabel = (0, utils_1.t)(`floorplans.label.${floorplan}`, {
25
27
  odataVersion: service.version
26
28
  });
27
29
  const datasourceLabel = (0, utils_1.getReadMeDataSourceLabel)(service.source, (0, utils_1.isBTPHosted)(service.connectedSystem), service.apiHubConfig?.apiHubType);
28
30
  // Assign any custom overriding properties that may be provided via headless, adaptors
29
- const readMeCustom = Object.assign({
31
+ const appGenInfoCustom = Object.assign({
30
32
  generatorName,
31
33
  generatorVersion,
32
34
  template: templateLabel,
33
35
  serviceType: datasourceLabel,
34
36
  serviceUrl: `${service.capService ? types_1.DEFAULT_CAP_HOST : service.host ?? ''}${service.servicePath ?? ''}` ||
35
37
  (0, utils_1.t)('texts.notApplicable')
36
- }, readMe);
37
- readMeCustom.additionalEntries ??= [];
38
+ }, existingAppGenInfo, appGenInfo);
39
+ appGenInfoCustom.entityRelatedConfig ??= [];
38
40
  if (entityRelatedConfig?.mainEntity) {
39
- readMeCustom.additionalEntries.push({
40
- label: (0, utils_1.t)('readme.label.mainEntity'),
41
+ appGenInfoCustom.entityRelatedConfig.push({
42
+ type: (0, utils_1.t)('readme.label.mainEntity'),
41
43
  value: entityRelatedConfig.mainEntity.entitySetName
42
44
  });
43
45
  }
44
46
  if (entityRelatedConfig?.navigationEntity) {
45
- readMeCustom.additionalEntries.push({
46
- label: (0, utils_1.t)('readme.label.navigationEntity'),
47
+ appGenInfoCustom.entityRelatedConfig.push({
48
+ type: (0, utils_1.t)('readme.label.navigationEntity'),
47
49
  value: entityRelatedConfig.navigationEntity.navigationPropertyName || 'None'
48
50
  });
49
51
  }
50
52
  if (entityRelatedConfig?.filterEntitySet) {
51
- readMeCustom.additionalEntries.push({
52
- label: (0, utils_1.t)('readme.label.filterEntityType'),
53
+ appGenInfoCustom.entityRelatedConfig.push({
54
+ type: (0, utils_1.t)('readme.label.filterEntityType'),
53
55
  value: entityRelatedConfig.filterEntitySet.entitySetName
54
56
  });
55
57
  }
56
58
  const launchText = await (0, utils_1.getLaunchText)(service.capService, project.name, !!project.enableTypeScript, project.namespace);
57
- const readme = {
58
- generationDate: readMeCustom?.generationDate ?? new Date().toString(),
59
- generatorPlatform: readMeCustom?.generatorPlatform ?? (0, fiori_generator_shared_1.getHostEnvironment)().name,
60
- serviceType: readMeCustom?.serviceType,
59
+ const genInfo = {
60
+ generationDate: appGenInfoCustom?.generationDate ?? new Date().toString(),
61
+ generatorPlatform: appGenInfoCustom?.generatorPlatform ?? (0, fiori_generator_shared_1.getHostEnvironment)().name,
62
+ serviceType: appGenInfoCustom?.serviceType,
61
63
  metadataFilename: service.localEdmxFilePath ? (0, path_1.basename)(service.localEdmxFilePath) : '',
62
- serviceUrl: readMeCustom?.serviceUrl,
64
+ serviceUrl: appGenInfoCustom?.serviceUrl,
63
65
  appName: project.name,
64
66
  appTitle: project.title,
65
67
  appDescription: project.description,
66
68
  appNamespace: project.namespace ?? '',
67
69
  ui5Theme: project.ui5Theme,
68
- ui5Version: readMeCustom?.ui5Version || project.manifestMinUI5Version || project.ui5Version,
70
+ ui5Version: appGenInfoCustom?.ui5Version || project.manifestMinUI5Version || project.ui5Version,
69
71
  enableCodeAssist: project.enableCodeAssist,
70
72
  enableEslint: project.enableEslint,
71
73
  enableTypeScript: project.enableTypeScript,
72
74
  showMockDataInfo: !!service.edmx && !service.capService,
73
- generatorVersion: readMeCustom?.generatorVersion ?? '',
74
- template: readMeCustom?.template ?? '',
75
- generatorName: readMeCustom?.generatorName ?? '',
76
- additionalEntries: readMeCustom?.additionalEntries ?? [],
75
+ generatorVersion: appGenInfoCustom?.generatorVersion ?? '',
76
+ template: appGenInfoCustom?.template ?? '',
77
+ generatorName: appGenInfoCustom?.generatorName ?? '',
78
+ entityRelatedConfig: appGenInfoCustom?.entityRelatedConfig ?? [],
79
+ externalParameters: appGenInfoCustom?.externalParameters,
77
80
  launchText
78
81
  };
79
- (0, fiori_generator_shared_1.generateReadMe)(targetPath, readme, fs);
82
+ (0, fiori_generator_shared_1.generateAppGenInfo)(targetPath, genInfo, fs);
80
83
  }
81
84
  /**
82
85
  * Create the files for apiHub integration.
@@ -1,5 +1,7 @@
1
1
  import type { DatasourceType, OdataServicePromptOptions, OdataVersion, promptNames } from '@sap-ux/odata-service-inquirer';
2
2
  import type { UI5ApplicationPromptOptions } from '@sap-ux/ui5-application-inquirer';
3
+ import type { AbapDeployConfigPromptOptions } from '@sap-ux/abap-deploy-config-inquirer';
4
+ import type { CfDeployConfigPromptOptions } from '@sap-ux/cf-deploy-config-inquirer';
3
5
  /**
4
6
  * package.json script entries (commands and tasks)
5
7
  */
@@ -14,7 +16,9 @@ export type WorkspaceFolder = {
14
16
  folderName: string;
15
17
  path: string;
16
18
  };
17
- export type FioriAppGeneratorPromptSettings = UI5ApplicationPromptOptions & Pick<OdataServicePromptOptions, promptNames.systemSelection>;
19
+ export type FioriAppGeneratorPromptSettings = UI5ApplicationPromptOptions & Pick<OdataServicePromptOptions, promptNames.systemSelection | promptNames.serviceSelection> & {
20
+ '@sap-ux/deploy-config-sub-generator'?: AbapDeployConfigPromptOptions | CfDeployConfigPromptOptions;
21
+ };
18
22
  /**
19
23
  * Custom environment type until yeoman-environment provides one
20
24
  */
@@ -5,6 +5,7 @@ import type { TableSelectionMode } from '@sap-ux/fiori-elements-writer';
5
5
  import type { CapService, DatasourceType, EntityRelatedAnswers, OdataServiceAnswers, OdataVersion } from '@sap-ux/odata-service-inquirer';
6
6
  import type { ApiHubType, SapSystemSourceType } from '../types/constants';
7
7
  import type { Script } from './common';
8
+ import type { AppGenInfo } from '@sap-ux/fiori-generator-shared';
8
9
  export interface Project {
9
10
  targetFolder: string;
10
11
  addDeployConfig?: boolean;
@@ -113,6 +114,10 @@ export interface State {
113
114
  * The template selected by the user, maybe FE or FF
114
115
  */
115
116
  floorplan: Floorplan;
117
+ /**
118
+ * General information about the application - used for README and appGenInfo.json
119
+ */
120
+ appGenInfo?: Partial<AppGenInfo>;
116
121
  }
117
122
  /** Only used by headless */
118
123
  export interface ALPOptions {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-app-sub-generator",
3
3
  "description": "A yeoman (sub) generator that can generate Fiori applications. Not for standalone use.",
4
- "version": "0.2.10",
4
+ "version": "0.4.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -32,19 +32,19 @@
32
32
  "@sap-ux/annotation-generator": "0.3.34",
33
33
  "@sap-ux/axios-extension": "1.21.1",
34
34
  "@sap-ux/btp-utils": "1.1.0",
35
- "@sap-ux/cap-config-writer": "0.10.1",
35
+ "@sap-ux/cap-config-writer": "0.10.2",
36
36
  "@sap-ux/feature-toggle": "0.3.0",
37
- "@sap-ux/fiori-elements-writer": "2.4.6",
38
- "@sap-ux/fiori-freestyle-writer": "2.4.3",
39
- "@sap-ux/fiori-generator-shared": "0.12.1",
37
+ "@sap-ux/fiori-elements-writer": "2.4.7",
38
+ "@sap-ux/fiori-freestyle-writer": "2.4.4",
39
+ "@sap-ux/fiori-generator-shared": "0.12.2",
40
40
  "@sap-ux/fiori-tools-settings": "0.2.0",
41
41
  "@sap-ux/launch-config": "0.10.1",
42
- "@sap-ux/odata-service-inquirer": "2.4.6",
42
+ "@sap-ux/odata-service-inquirer": "2.4.7",
43
43
  "@sap-ux/odata-service-writer": "0.27.3",
44
44
  "@sap-ux/project-access": "1.30.1",
45
45
  "@sap-ux/store": "1.1.0",
46
- "@sap-ux/telemetry": "0.6.1",
47
- "@sap-ux/ui5-application-inquirer": "0.14.2",
46
+ "@sap-ux/telemetry": "0.6.2",
47
+ "@sap-ux/ui5-application-inquirer": "0.14.3",
48
48
  "@sap-ux/ui5-info": "0.11.0"
49
49
  },
50
50
  "devDependencies": {
@@ -62,9 +62,11 @@
62
62
  "mock-spawn": "0.2.6",
63
63
  "rimraf": "5.0.5",
64
64
  "yeoman-test": "6.3.0",
65
- "@sap-ux/flp-config-sub-generator": "0.2.8",
66
- "@sap-ux/inquirer-common": "0.7.2",
67
- "@sap-ux/jest-file-matchers": "0.2.1",
65
+ "@sap-ux/abap-deploy-config-inquirer": "1.4.5",
66
+ "@sap-ux/cf-deploy-config-inquirer": "0.3.3",
67
+ "@sap-ux/flp-config-sub-generator": "0.2.9",
68
+ "@sap-ux/inquirer-common": "0.7.3",
69
+ "@sap-ux/jest-file-matchers": "0.2.2",
68
70
  "@sap-ux/logger": "0.7.0"
69
71
  },
70
72
  "engines": {