@sap-ux/fiori-app-sub-generator 0.15.20 → 1.0.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.
- package/generators/app/index.d.ts +1 -1
- package/generators/app/index.js +2 -4
- package/generators/app-headless/index.d.ts +2 -2
- package/generators/app-headless/index.js +17 -21
- package/generators/app-headless/resolve.js +11 -16
- package/generators/app-headless/transforms.d.ts +1 -1
- package/generators/app-headless/transforms.js +35 -38
- package/generators/fiori-app-generator/end.d.ts +1 -1
- package/generators/fiori-app-generator/end.js +23 -25
- package/generators/fiori-app-generator/fioriAppGenerator.d.ts +2 -2
- package/generators/fiori-app-generator/fioriAppGenerator.js +92 -99
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.d.ts +1 -1
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.js +1 -2
- package/generators/fiori-app-generator/index.d.ts +2 -2
- package/generators/fiori-app-generator/index.js +2 -18
- package/generators/fiori-app-generator/install.js +10 -13
- package/generators/fiori-app-generator/prompting.d.ts +1 -1
- package/generators/fiori-app-generator/prompting.js +60 -70
- package/generators/fiori-app-generator/subgenHelpers.d.ts +1 -1
- package/generators/fiori-app-generator/subgenHelpers.js +8 -12
- package/generators/fiori-app-generator/transforms.d.ts +2 -3
- package/generators/fiori-app-generator/transforms.js +63 -66
- package/generators/fiori-app-generator/writing.d.ts +1 -1
- package/generators/fiori-app-generator/writing.js +18 -22
- package/generators/index.d.ts +5 -5
- package/generators/index.js +5 -21
- package/generators/types/common.js +1 -2
- package/generators/types/constants.d.ts +1 -1
- package/generators/types/constants.js +59 -52
- package/generators/types/external.d.ts +5 -4
- package/generators/types/external.js +40 -45
- package/generators/types/index.d.ts +6 -6
- package/generators/types/index.js +6 -22
- package/generators/types/state.d.ts +2 -2
- package/generators/types/state.js +1 -2
- package/generators/types/telemetryEvents.js +1 -2
- package/generators/types/yeomanUiStepConfig.js +1 -2
- package/generators/utils/appWizardCache.d.ts +1 -1
- package/generators/utils/appWizardCache.js +9 -15
- package/generators/utils/command-runner.js +9 -13
- package/generators/utils/common.d.ts +3 -3
- package/generators/utils/common.js +64 -81
- package/generators/utils/eventHooks.js +6 -10
- package/generators/utils/i18n.js +15 -23
- package/generators/utils/index.d.ts +8 -8
- package/generators/utils/index.js +8 -24
- package/generators/utils/sapuxLayer.js +3 -6
- package/generators/utils/stepsHelper.d.ts +3 -4
- package/generators/utils/stepsHelper.js +10 -17
- package/generators/utils/telemetry.d.ts +1 -1
- package/generators/utils/telemetry.js +9 -12
- package/package.json +27 -25
package/generators/app/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const fiori_app_generator_1 = require("../fiori-app-generator");
|
|
4
|
-
exports.default = fiori_app_generator_1.FioriAppGenerator;
|
|
1
|
+
import { FioriAppGenerator } from '../fiori-app-generator/index.js';
|
|
2
|
+
export default FioriAppGenerator;
|
|
5
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FioriAppGeneratorOptions } from '../fiori-app-generator';
|
|
2
|
-
import { FioriAppGenerator } from '../fiori-app-generator';
|
|
1
|
+
import type { FioriAppGeneratorOptions } from '../fiori-app-generator/index.js';
|
|
2
|
+
import { FioriAppGenerator } from '../fiori-app-generator/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Generator that allows the creation of a Fiori applications without prompting based on a provided app config.
|
|
5
5
|
*/
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const i18n_1 = require("../utils/i18n");
|
|
8
|
-
const transforms_1 = require("./transforms");
|
|
9
|
-
const resolve_1 = require("./resolve");
|
|
1
|
+
import { isInternalFeaturesSettingEnabled } from '@sap-ux/feature-toggle';
|
|
2
|
+
import { TelemetryHelper } from '@sap-ux/fiori-generator-shared';
|
|
3
|
+
import { APP_GENERATOR_MODULE, FioriAppGenerator } from '../fiori-app-generator/index.js';
|
|
4
|
+
import { initI18nFioriAppSubGenerator, t } from '../utils/i18n.js';
|
|
5
|
+
import { transformExtState } from './transforms.js';
|
|
6
|
+
import { resolveExternalServices } from './resolve.js';
|
|
10
7
|
/**
|
|
11
8
|
* Generator that allows the creation of a Fiori applications without prompting based on a provided app config.
|
|
12
9
|
*/
|
|
13
|
-
class FioriAppGeneratorHeadless extends
|
|
10
|
+
export class FioriAppGeneratorHeadless extends FioriAppGenerator {
|
|
14
11
|
/**
|
|
15
12
|
*
|
|
16
13
|
* @param args
|
|
@@ -18,34 +15,34 @@ class FioriAppGeneratorHeadless extends fiori_app_generator_1.FioriAppGenerator
|
|
|
18
15
|
*/
|
|
19
16
|
constructor(args, opts) {
|
|
20
17
|
super(args, opts);
|
|
21
|
-
this.log(
|
|
18
|
+
this.log(t('logMessages.generatingAppWithVersion', {
|
|
22
19
|
generatorName: '@sap-ux/fiori-app-sub-generator:headless',
|
|
23
20
|
generatorVersion: this.rootGeneratorVersion()
|
|
24
21
|
}));
|
|
25
22
|
try {
|
|
26
23
|
const appConfig = this.options.appConfig;
|
|
27
24
|
if (appConfig.service?.externalServices) {
|
|
28
|
-
appConfig.service.externalServices =
|
|
25
|
+
appConfig.service.externalServices = resolveExternalServices(appConfig.service.externalServices);
|
|
29
26
|
}
|
|
30
|
-
this.state =
|
|
27
|
+
this.state = transformExtState(appConfig);
|
|
31
28
|
}
|
|
32
29
|
catch (error) {
|
|
33
|
-
this.log(
|
|
30
|
+
this.log(t('logMessages.generatorExiting'));
|
|
34
31
|
this.env.error(error);
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
async initializing() {
|
|
38
35
|
// Ensure texts used in locally generated files, e.g. log messages, readme.md labels, etc. are available
|
|
39
|
-
await
|
|
40
|
-
await
|
|
36
|
+
await initI18nFioriAppSubGenerator();
|
|
37
|
+
await TelemetryHelper.initTelemetrySettings({
|
|
41
38
|
consumerModule: {
|
|
42
|
-
name:
|
|
39
|
+
name: APP_GENERATOR_MODULE,
|
|
43
40
|
version: this.rootGeneratorVersion()
|
|
44
41
|
},
|
|
45
|
-
internalFeature:
|
|
42
|
+
internalFeature: isInternalFeaturesSettingEnabled(),
|
|
46
43
|
watchTelemetrySettingStore: false
|
|
47
44
|
});
|
|
48
|
-
|
|
45
|
+
TelemetryHelper.createTelemetryData({
|
|
49
46
|
AppGenLaunchSource: this.options.appConfig.telemetryData?.generationSourceName ?? 'Headless',
|
|
50
47
|
AppGenLaunchSourceVersion: this.options.appConfig.telemetryData?.generationSourceVersion ?? 'Not Provided'
|
|
51
48
|
});
|
|
@@ -75,6 +72,5 @@ class FioriAppGeneratorHeadless extends fiori_app_generator_1.FioriAppGenerator
|
|
|
75
72
|
await super.end();
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
exports.default = FioriAppGeneratorHeadless;
|
|
75
|
+
export default FioriAppGeneratorHeadless;
|
|
80
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.resolveMetadata = resolveMetadata;
|
|
4
|
-
exports.resolveEntityData = resolveEntityData;
|
|
5
|
-
exports.resolveExternalServices = resolveExternalServices;
|
|
6
|
-
const node_fs_1 = require("node:fs");
|
|
7
|
-
const node_path_1 = require("node:path");
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
8
3
|
/**
|
|
9
4
|
* Returns inline XML, or reads and returns the contents of the file at the given path.
|
|
10
5
|
*
|
|
11
6
|
* @param metadata The metadata XML string or the path to the metadata file.
|
|
12
7
|
*/
|
|
13
|
-
function resolveMetadata(metadata) {
|
|
8
|
+
export function resolveMetadata(metadata) {
|
|
14
9
|
if (metadata.trimStart().startsWith('<')) {
|
|
15
10
|
return metadata;
|
|
16
11
|
}
|
|
17
|
-
const filePath =
|
|
18
|
-
if (!
|
|
12
|
+
const filePath = isAbsolute(metadata) ? metadata : resolve(process.cwd(), metadata);
|
|
13
|
+
if (!existsSync(filePath)) {
|
|
19
14
|
throw new Error(`Metadata file not found: ${filePath}`);
|
|
20
15
|
}
|
|
21
16
|
try {
|
|
22
|
-
return
|
|
17
|
+
return readFileSync(filePath, 'utf-8');
|
|
23
18
|
}
|
|
24
19
|
catch (error) {
|
|
25
20
|
throw new Error(`Failed to read metadata file: ${filePath}. ${error instanceof Error ? error.message : error}`);
|
|
@@ -30,16 +25,16 @@ function resolveMetadata(metadata) {
|
|
|
30
25
|
*
|
|
31
26
|
* @param entityData The entity data array or the path to the JSON file.
|
|
32
27
|
*/
|
|
33
|
-
function resolveEntityData(entityData) {
|
|
28
|
+
export function resolveEntityData(entityData) {
|
|
34
29
|
if (Array.isArray(entityData)) {
|
|
35
30
|
return entityData;
|
|
36
31
|
}
|
|
37
|
-
const filePath =
|
|
38
|
-
if (!
|
|
32
|
+
const filePath = isAbsolute(entityData) ? entityData : resolve(process.cwd(), entityData);
|
|
33
|
+
if (!existsSync(filePath)) {
|
|
39
34
|
throw new Error(`Entity data file not found: ${filePath}`);
|
|
40
35
|
}
|
|
41
36
|
try {
|
|
42
|
-
return JSON.parse(
|
|
37
|
+
return JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
43
38
|
}
|
|
44
39
|
catch (error) {
|
|
45
40
|
throw new Error(`Failed to read or parse entity data file: ${filePath}. ${error instanceof Error ? error.message : error}`);
|
|
@@ -50,7 +45,7 @@ function resolveEntityData(entityData) {
|
|
|
50
45
|
*
|
|
51
46
|
* @param services External service configurations.
|
|
52
47
|
*/
|
|
53
|
-
function resolveExternalServices(services) {
|
|
48
|
+
export function resolveExternalServices(services) {
|
|
54
49
|
return services.map((entry) => ({
|
|
55
50
|
...entry,
|
|
56
51
|
metadata: resolveMetadata(entry.metadata),
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const node_path_1 = require("node:path");
|
|
10
|
-
const types_1 = require("../types");
|
|
11
|
-
const utils_1 = require("../utils");
|
|
1
|
+
import { OdataVersion } from '@sap-ux/fiori-elements-writer';
|
|
2
|
+
import { getCapFolderPathsSync } from '@sap-ux/fiori-generator-shared';
|
|
3
|
+
import { DatasourceType } from '@sap-ux/odata-service-inquirer';
|
|
4
|
+
import { promptNames } from '@sap-ux/ui5-application-inquirer';
|
|
5
|
+
import { getDefaultUI5Theme, supportedUi5VersionFallbacks } from '@sap-ux/ui5-info';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { ApiHubType, FloorplanFE, FloorplanFF, capTypeConversion, defaultPromptValues } from '../types/index.js';
|
|
8
|
+
import { getODataVersion, t } from '../utils/index.js';
|
|
12
9
|
const APP_CONFIG_CURRENT_VERSION = '0.2';
|
|
13
10
|
/**
|
|
14
11
|
* Transforms the external state to its internal representation.
|
|
@@ -16,18 +13,18 @@ const APP_CONFIG_CURRENT_VERSION = '0.2';
|
|
|
16
13
|
* @param appConfig - defines the application to be generated
|
|
17
14
|
* @returns the internal state representation
|
|
18
15
|
*/
|
|
19
|
-
function transformExtState(appConfig) {
|
|
16
|
+
export function transformExtState(appConfig) {
|
|
20
17
|
if (appConfig.version !== APP_CONFIG_CURRENT_VERSION) {
|
|
21
|
-
throw Error(
|
|
18
|
+
throw Error(t('error.appConfigVersion', { versions: APP_CONFIG_CURRENT_VERSION }));
|
|
22
19
|
}
|
|
23
20
|
const { project: projectConfig, service: serviceConfig, floorplan } = appConfig;
|
|
24
21
|
const state = {
|
|
25
22
|
project: _setProjectDefaults(projectConfig),
|
|
26
23
|
service: _setServiceDefaults(floorplan, serviceConfig),
|
|
27
|
-
floorplan:
|
|
24
|
+
floorplan: FloorplanFE[floorplan] ?? FloorplanFF[floorplan]
|
|
28
25
|
};
|
|
29
26
|
if (state.service.capService) {
|
|
30
|
-
state.project.targetFolder =
|
|
27
|
+
state.project.targetFolder = join(state.service.capService.projectPath, state.service.capService.appPath ?? '');
|
|
31
28
|
}
|
|
32
29
|
// FE specific state properties
|
|
33
30
|
if (floorplan !== 'FF_SIMPLE' && appConfig.entityConfig) {
|
|
@@ -95,19 +92,19 @@ function _setEntityRelatedConfig(feAppConfig) {
|
|
|
95
92
|
*/
|
|
96
93
|
function _setProjectDefaults(project) {
|
|
97
94
|
// Use latest fallback (offline) version if none specified
|
|
98
|
-
const ui5Version = project.ui5Version ||
|
|
95
|
+
const ui5Version = project.ui5Version || supportedUi5VersionFallbacks[0].version;
|
|
99
96
|
return {
|
|
100
|
-
name: project.name ??
|
|
97
|
+
name: project.name ?? t('defaults.projectName'),
|
|
101
98
|
targetFolder: project.targetFolder ?? process.cwd(),
|
|
102
99
|
namespace: project.namespace ?? '',
|
|
103
|
-
title: project.title ??
|
|
104
|
-
description: project.description ??
|
|
100
|
+
title: project.title ?? t('defaults.projectTitle'),
|
|
101
|
+
description: project.description ?? t('default.projectDescription'),
|
|
105
102
|
ui5Version: ui5Version,
|
|
106
103
|
localUI5Version: project.localUI5Version ?? ui5Version,
|
|
107
|
-
ui5Theme: project.ui5Theme ??
|
|
108
|
-
skipAnnotations: project.skipAnnotations ??
|
|
109
|
-
enableEslint: project.enableEslint ??
|
|
110
|
-
enableTypeScript: project.enableTypeScript ??
|
|
104
|
+
ui5Theme: project.ui5Theme ?? getDefaultUI5Theme(ui5Version),
|
|
105
|
+
skipAnnotations: project.skipAnnotations ?? defaultPromptValues[promptNames.skipAnnotations],
|
|
106
|
+
enableEslint: project.enableEslint ?? defaultPromptValues[promptNames.enableEslint],
|
|
107
|
+
enableTypeScript: project.enableTypeScript ?? defaultPromptValues[promptNames.enableTypeScript],
|
|
111
108
|
sapux: project.sapux || false,
|
|
112
109
|
enableVirtualEndpoints: project.enableVirtualEndpoints ?? true,
|
|
113
110
|
flpAppId: '' // Mandatory property, will be generated in the writing phase transforms and overwritten
|
|
@@ -124,15 +121,15 @@ function _setProjectDefaults(project) {
|
|
|
124
121
|
function _setServiceDefaults(floorplan, service) {
|
|
125
122
|
let version;
|
|
126
123
|
if (service?.edmx) {
|
|
127
|
-
version =
|
|
124
|
+
version = getODataVersion(service.edmx);
|
|
128
125
|
}
|
|
129
126
|
else if (floorplan !== 'FF_SIMPLE' && !service?.capService?.projectPath) {
|
|
130
|
-
throw Error(
|
|
127
|
+
throw Error(t('error.appConfigMissingRequiredProperty', { propertyName: 'edmx' }));
|
|
131
128
|
}
|
|
132
129
|
else if (floorplan === 'FF_SIMPLE') {
|
|
133
130
|
// FF_SIMPLE with no datasource
|
|
134
131
|
return {
|
|
135
|
-
source:
|
|
132
|
+
source: DatasourceType.none
|
|
136
133
|
};
|
|
137
134
|
}
|
|
138
135
|
const serviceDefaults = {
|
|
@@ -145,41 +142,41 @@ function _setServiceDefaults(floorplan, service) {
|
|
|
145
142
|
};
|
|
146
143
|
if (service?.destination) {
|
|
147
144
|
serviceDefaults.destinationName = service.destination;
|
|
148
|
-
serviceDefaults.source =
|
|
145
|
+
serviceDefaults.source = DatasourceType.sapSystem;
|
|
149
146
|
return serviceDefaults;
|
|
150
147
|
}
|
|
151
148
|
// Only support non-enterprise api hub currently from headless generator
|
|
152
149
|
if (service?.apiHubApiKey) {
|
|
153
150
|
serviceDefaults.apiHubConfig = {
|
|
154
151
|
apiHubKey: service.apiHubApiKey,
|
|
155
|
-
apiHubType:
|
|
152
|
+
apiHubType: ApiHubType.apiHub
|
|
156
153
|
};
|
|
157
|
-
serviceDefaults.source =
|
|
154
|
+
serviceDefaults.source = DatasourceType.businessHub;
|
|
158
155
|
}
|
|
159
156
|
// Setting of DatasourceType has only partial relevance for the writing phase.
|
|
160
157
|
// Only FILE and CAP are checked during the writing phase, but these references should be (eventually) removed
|
|
161
158
|
// and replaced with generic checks for servicePath + edmx and cap service name respectively - then there is no need to set here
|
|
162
159
|
else if (service?.capService?.projectPath) {
|
|
163
160
|
if (!service.capService.serviceName) {
|
|
164
|
-
throw Error(
|
|
161
|
+
throw Error(t('error.appConfigMissingRequiredProperty', {
|
|
165
162
|
propertyName: 'capService.serviceName'
|
|
166
163
|
}));
|
|
167
164
|
}
|
|
168
165
|
serviceDefaults.capService = _setCAPServicePaths(service.capService);
|
|
169
|
-
serviceDefaults.version =
|
|
170
|
-
serviceDefaults.source =
|
|
166
|
+
serviceDefaults.version = OdataVersion.v4; // CAP is always odata 4
|
|
167
|
+
serviceDefaults.source = DatasourceType.capProject;
|
|
171
168
|
}
|
|
172
169
|
else if (!service?.servicePath && service?.edmx) {
|
|
173
|
-
serviceDefaults.source =
|
|
170
|
+
serviceDefaults.source = DatasourceType.metadataFile;
|
|
174
171
|
}
|
|
175
172
|
else if (!service?.edmx) {
|
|
176
|
-
serviceDefaults.source =
|
|
173
|
+
serviceDefaults.source = DatasourceType.none;
|
|
177
174
|
}
|
|
178
175
|
else if (service?.scp) {
|
|
179
|
-
serviceDefaults.source =
|
|
176
|
+
serviceDefaults.source = DatasourceType.sapSystem;
|
|
180
177
|
}
|
|
181
178
|
else {
|
|
182
|
-
serviceDefaults.source =
|
|
179
|
+
serviceDefaults.source = DatasourceType.odataServiceUrl;
|
|
183
180
|
}
|
|
184
181
|
return serviceDefaults;
|
|
185
182
|
}
|
|
@@ -190,7 +187,7 @@ function _setServiceDefaults(floorplan, service) {
|
|
|
190
187
|
* @returns
|
|
191
188
|
*/
|
|
192
189
|
function _setCAPServicePaths(capService) {
|
|
193
|
-
const capCustomPaths =
|
|
190
|
+
const capCustomPaths = getCapFolderPathsSync(capService.projectPath);
|
|
194
191
|
return {
|
|
195
192
|
// Use target folder for testing as capService.projectPath is an absolute path
|
|
196
193
|
projectPath: capService.projectPath,
|
|
@@ -198,7 +195,7 @@ function _setCAPServicePaths(capService) {
|
|
|
198
195
|
serviceCdsPath: capService.serviceCdsPath,
|
|
199
196
|
// targetFolder ends in /app so step-up 1 dir
|
|
200
197
|
appPath: capCustomPaths?.app,
|
|
201
|
-
capType:
|
|
198
|
+
capType: capTypeConversion(capService.capType)
|
|
202
199
|
};
|
|
203
200
|
}
|
|
204
201
|
//# sourceMappingURL=transforms.js.map
|
|
@@ -6,7 +6,7 @@ import type { Logger } from '@sap-ux/logger';
|
|
|
6
6
|
import type { DatasourceType } from '@sap-ux/odata-service-inquirer';
|
|
7
7
|
import { type BackendSystem } from '@sap-ux/store';
|
|
8
8
|
import type { Editor } from 'mem-fs-editor';
|
|
9
|
-
import type { ApiHubConfig } from '../types';
|
|
9
|
+
import type { ApiHubConfig } from '../types/index.js';
|
|
10
10
|
/**
|
|
11
11
|
* FioriBaseGeneratror end phase related functionality.
|
|
12
12
|
*
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
|
-
const utils_1 = require("../utils");
|
|
1
|
+
import { MessageType } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import { isAppStudio } from '@sap-ux/btp-utils';
|
|
3
|
+
import { getHostEnvironment, hostEnvironment, sendTelemetry, TelemetryHelper } from '@sap-ux/fiori-generator-shared';
|
|
4
|
+
import { ApiHubSettings, getService } from '@sap-ux/store';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { ApiHubType } from '../types/index.js';
|
|
7
|
+
import { buildSapClientParam, generateLaunchConfig, runHooks, t } from '../utils/index.js';
|
|
10
8
|
/**
|
|
11
9
|
* Save API Hub key to the store.
|
|
12
10
|
*
|
|
@@ -16,12 +14,12 @@ const utils_1 = require("../utils");
|
|
|
16
14
|
*/
|
|
17
15
|
async function saveApiHubApiKey(apiKey, logger) {
|
|
18
16
|
let result;
|
|
19
|
-
if (!
|
|
20
|
-
const apiHubStore = (await
|
|
17
|
+
if (!isAppStudio()) {
|
|
18
|
+
const apiHubStore = (await getService({
|
|
21
19
|
logger,
|
|
22
20
|
entityName: 'api-hub'
|
|
23
21
|
}));
|
|
24
|
-
const apiHubSettings = new
|
|
22
|
+
const apiHubSettings = new ApiHubSettings({ apiKey });
|
|
25
23
|
result = await apiHubStore.write(apiHubSettings);
|
|
26
24
|
}
|
|
27
25
|
return Boolean(result);
|
|
@@ -37,7 +35,7 @@ async function saveApiHubApiKey(apiKey, logger) {
|
|
|
37
35
|
* @param followUpCommand.cmdParams - options params for the command
|
|
38
36
|
*/
|
|
39
37
|
async function runPostGenHooks(projectPath, logger, vscode, followUpCommand) {
|
|
40
|
-
await
|
|
38
|
+
await runHooks('app-generated', {
|
|
41
39
|
hookParameters: { fsPath: projectPath, ...followUpCommand?.cmdParams },
|
|
42
40
|
vscodeInstance: vscode,
|
|
43
41
|
options: { command: followUpCommand?.cmdName }
|
|
@@ -68,29 +66,29 @@ async function runPostGenHooks(projectPath, logger, vscode, followUpCommand) {
|
|
|
68
66
|
* @param followUpCommand.cmdParams - options params for the command
|
|
69
67
|
* @returns {Promise<void>}
|
|
70
68
|
*/
|
|
71
|
-
async function runPostGenerationTasks({ service, project }, fs, logger, vscode, appWizard, followUpCommand) {
|
|
69
|
+
export async function runPostGenerationTasks({ service, project }, fs, logger, vscode, appWizard, followUpCommand) {
|
|
72
70
|
// Add launch config for non-cap projects
|
|
73
71
|
if (!service.capService) {
|
|
74
|
-
await
|
|
72
|
+
await generateLaunchConfig({
|
|
75
73
|
targetFolder: project.targetFolder,
|
|
76
74
|
projectName: project.name,
|
|
77
75
|
flpAppId: project.flpAppId,
|
|
78
|
-
sapClientParam: service.sapClient ?
|
|
76
|
+
sapClientParam: service.sapClient ? buildSapClientParam(service.sapClient) : undefined,
|
|
79
77
|
odataVersion: service.odataVersion,
|
|
80
78
|
datasourceType: service.datasourceType,
|
|
81
79
|
enableVirtualEndpoints: project.enableVirtualEndpoints
|
|
82
80
|
}, fs, vscode, logger);
|
|
83
81
|
}
|
|
84
82
|
// Persist backend system connection information
|
|
85
|
-
const hostEnv =
|
|
86
|
-
if (service.backendSystem && hostEnv !==
|
|
87
|
-
const storeService = await
|
|
83
|
+
const hostEnv = getHostEnvironment();
|
|
84
|
+
if (service.backendSystem && hostEnv !== hostEnvironment.bas && service.backendSystem.newOrUpdated) {
|
|
85
|
+
const storeService = await getService({
|
|
88
86
|
logger: logger,
|
|
89
87
|
entityName: 'system'
|
|
90
88
|
});
|
|
91
89
|
// No need to await, we cannot recover anyway
|
|
92
90
|
storeService.write(service.backendSystem, { force: true }).catch((error) => {
|
|
93
|
-
logger.error(
|
|
91
|
+
logger.error(t('logMessages.backendSystemSaveError', {
|
|
94
92
|
system: service.backendSystem?.name,
|
|
95
93
|
error: error.message
|
|
96
94
|
}));
|
|
@@ -99,17 +97,17 @@ async function runPostGenerationTasks({ service, project }, fs, logger, vscode,
|
|
|
99
97
|
// Display info message if using a cap service as it is not otherwise shown when a top level dir is not created
|
|
100
98
|
if (service.capService && appWizard) {
|
|
101
99
|
// this info message needs to be shown for cap projects as it is not shown when a top level dir is not created
|
|
102
|
-
appWizard.showInformation(
|
|
100
|
+
appWizard.showInformation(t('wizardMessages.filesGenerated'), MessageType.notification);
|
|
103
101
|
}
|
|
104
|
-
if (hostEnv !==
|
|
102
|
+
if (hostEnv !== hostEnvironment.bas && service.apiHubConfig?.apiHubType === ApiHubType.apiHub) {
|
|
105
103
|
await saveApiHubApiKey(service.apiHubConfig.apiHubKey, logger);
|
|
106
104
|
}
|
|
107
105
|
// If we got here, the generation was successful and so targetFolder and name must be defined
|
|
108
|
-
const projectPath =
|
|
109
|
-
logger.info(
|
|
106
|
+
const projectPath = join(project.targetFolder, project.name);
|
|
107
|
+
logger.info(t('logMessages.applicationGenerationSuccess', {
|
|
110
108
|
targetFolder: projectPath
|
|
111
109
|
}));
|
|
112
|
-
await
|
|
110
|
+
await sendTelemetry('GENERATION_SUCCESS', TelemetryHelper.telemetryData, projectPath);
|
|
113
111
|
await runPostGenHooks(projectPath, logger, vscode, followUpCommand);
|
|
114
112
|
}
|
|
115
113
|
//# sourceMappingURL=end.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ILogWrapper } from '@sap-ux/fiori-generator-shared';
|
|
2
2
|
import type { Logger } from '@sap-ux/logger';
|
|
3
3
|
import Generator from 'yeoman-generator';
|
|
4
|
-
import type { FioriStep, State } from '../types';
|
|
5
|
-
import type { FioriAppGeneratorOptions } from './fioriAppGeneratorOptions';
|
|
4
|
+
import type { FioriStep, State } from '../types/index.js';
|
|
5
|
+
import type { FioriAppGeneratorOptions } from './fioriAppGeneratorOptions.js';
|
|
6
6
|
export declare const APP_GENERATOR_MODULE = "@sap/generator-fiori";
|
|
7
7
|
/**
|
|
8
8
|
* The root generator for Fiori Elements and Fiori Freestyle generators.
|