@sap-ux/fiori-app-sub-generator 0.15.21 → 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.
Files changed (52) hide show
  1. package/generators/app/index.d.ts +1 -1
  2. package/generators/app/index.js +2 -4
  3. package/generators/app-headless/index.d.ts +2 -2
  4. package/generators/app-headless/index.js +17 -21
  5. package/generators/app-headless/resolve.js +11 -16
  6. package/generators/app-headless/transforms.d.ts +1 -1
  7. package/generators/app-headless/transforms.js +35 -38
  8. package/generators/fiori-app-generator/end.d.ts +1 -1
  9. package/generators/fiori-app-generator/end.js +23 -25
  10. package/generators/fiori-app-generator/fioriAppGenerator.d.ts +2 -2
  11. package/generators/fiori-app-generator/fioriAppGenerator.js +92 -99
  12. package/generators/fiori-app-generator/fioriAppGeneratorOptions.d.ts +1 -1
  13. package/generators/fiori-app-generator/fioriAppGeneratorOptions.js +1 -2
  14. package/generators/fiori-app-generator/index.d.ts +2 -2
  15. package/generators/fiori-app-generator/index.js +2 -18
  16. package/generators/fiori-app-generator/install.js +10 -13
  17. package/generators/fiori-app-generator/prompting.d.ts +1 -1
  18. package/generators/fiori-app-generator/prompting.js +60 -70
  19. package/generators/fiori-app-generator/subgenHelpers.d.ts +1 -1
  20. package/generators/fiori-app-generator/subgenHelpers.js +8 -12
  21. package/generators/fiori-app-generator/transforms.d.ts +2 -3
  22. package/generators/fiori-app-generator/transforms.js +63 -66
  23. package/generators/fiori-app-generator/writing.d.ts +1 -1
  24. package/generators/fiori-app-generator/writing.js +18 -22
  25. package/generators/index.d.ts +5 -5
  26. package/generators/index.js +5 -21
  27. package/generators/types/common.js +1 -2
  28. package/generators/types/constants.d.ts +1 -1
  29. package/generators/types/constants.js +59 -52
  30. package/generators/types/external.d.ts +5 -4
  31. package/generators/types/external.js +40 -45
  32. package/generators/types/index.d.ts +6 -6
  33. package/generators/types/index.js +6 -22
  34. package/generators/types/state.d.ts +2 -2
  35. package/generators/types/state.js +1 -2
  36. package/generators/types/telemetryEvents.js +1 -2
  37. package/generators/types/yeomanUiStepConfig.js +1 -2
  38. package/generators/utils/appWizardCache.d.ts +1 -1
  39. package/generators/utils/appWizardCache.js +9 -15
  40. package/generators/utils/command-runner.js +9 -13
  41. package/generators/utils/common.d.ts +3 -3
  42. package/generators/utils/common.js +64 -81
  43. package/generators/utils/eventHooks.js +6 -10
  44. package/generators/utils/i18n.js +15 -23
  45. package/generators/utils/index.d.ts +8 -8
  46. package/generators/utils/index.js +8 -24
  47. package/generators/utils/sapuxLayer.js +3 -6
  48. package/generators/utils/stepsHelper.d.ts +3 -4
  49. package/generators/utils/stepsHelper.js +10 -17
  50. package/generators/utils/telemetry.d.ts +1 -1
  51. package/generators/utils/telemetry.js +9 -12
  52. package/package.json +27 -25
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandRunner = void 0;
4
- const i18n_1 = require("./i18n");
5
- const node_child_process_1 = require("node:child_process");
1
+ import { t } from './i18n.js';
2
+ import { spawn } from 'node:child_process';
6
3
  /**
7
4
  *
8
5
  */
9
- class CommandRunner {
6
+ export class CommandRunner {
10
7
  log;
11
8
  /**
12
9
  *
@@ -44,7 +41,7 @@ class CommandRunner {
44
41
  if (process.platform === 'win32') {
45
42
  optsLocal.shell = true;
46
43
  }
47
- const spawnedCmd = (0, node_child_process_1.spawn)(cmd, args, optsLocal);
44
+ const spawnedCmd = spawn(cmd, args, optsLocal);
48
45
  let response;
49
46
  if (enableLog) {
50
47
  this.formatLog('Running: ', command);
@@ -63,26 +60,25 @@ class CommandRunner {
63
60
  stack.push(data.toString());
64
61
  });
65
62
  spawnedCmd.on('error', (error) => {
66
- reject(new Error(`${(0, i18n_1.t)('error.commandFailed')}: ${error.message}`));
63
+ reject(new Error(`${t('error.commandFailed')}: ${error.message}`));
67
64
  });
68
65
  spawnedCmd.on('close', (errorCode, signal) => {
69
66
  if (signal) {
70
67
  const signalCode = -1;
71
68
  if (enableLog) {
72
- this.formatLog((0, i18n_1.t)('logMessages.commandFailedWithError', { command, signalCode }));
69
+ this.formatLog(t('logMessages.commandFailedWithError', { command, signalCode }));
73
70
  }
74
- return reject(new Error((0, i18n_1.t)('logMessages.commandErrorCodeWithStack', { command, signalCode, stack: stack.join(', ') })));
71
+ return reject(new Error(t('logMessages.commandErrorCodeWithStack', { command, signalCode, stack: stack.join(', ') })));
75
72
  }
76
73
  if (errorCode !== 0) {
77
74
  if (enableLog) {
78
- this.formatLog((0, i18n_1.t)('logMessages.commandFailedWithError', { command, errorCode }));
75
+ this.formatLog(t('logMessages.commandFailedWithError', { command, errorCode }));
79
76
  }
80
- return reject(new Error((0, i18n_1.t)('logMessages.commandErrorCodeWithStack', { command, errorCode, stack: stack.join(', ') })));
77
+ return reject(new Error(t('logMessages.commandErrorCodeWithStack', { command, errorCode, stack: stack.join(', ') })));
81
78
  }
82
79
  resolve(response);
83
80
  });
84
81
  });
85
82
  }
86
83
  }
87
- exports.CommandRunner = CommandRunner;
88
84
  //# sourceMappingURL=command-runner.js.map
@@ -5,9 +5,9 @@ import { DatasourceType, OdataVersion, type ConnectedSystem, type EntityRelatedA
5
5
  import type { CdsAnnotationsInfo, EdmxAnnotationsInfo } from '@sap-ux/odata-service-writer';
6
6
  import type { CapProjectType, CdsUi5PluginInfo, CdsVersionInfo } from '@sap-ux/project-access';
7
7
  import type { Editor } from 'mem-fs-editor';
8
- import type { GenerateLaunchConfigOptions, Service } from '../types';
9
- import { ApiHubType } from '../types';
10
- import { type Floorplan } from '../types/external';
8
+ import type { GenerateLaunchConfigOptions, Service } from '../types/index.js';
9
+ import { ApiHubType } from '../types/index.js';
10
+ import { type Floorplan } from '../types/external.js';
11
11
  /**
12
12
  * Parse the specified edmx string for validitiy and return the ODataVersion of the specified edmx string.
13
13
  *
@@ -1,36 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getODataVersion = getODataVersion;
4
- exports.getAppId = getAppId;
5
- exports.buildSapClientParam = buildSapClientParam;
6
- exports.getRequiredOdataVersion = getRequiredOdataVersion;
7
- exports.getMinSupportedUI5Version = getMinSupportedUI5Version;
8
- exports.generateToolsId = generateToolsId;
9
- exports.getCdsUi5PluginInfo = getCdsUi5PluginInfo;
10
- exports.getCdsAnnotations = getCdsAnnotations;
11
- exports.isAbapCloud = isAbapCloud;
12
- exports.getReadMeDataSourceLabel = getReadMeDataSourceLabel;
13
- exports.getLaunchText = getLaunchText;
14
- exports.generateLaunchConfig = generateLaunchConfig;
15
- exports.convertCapRuntimeToCapProjectType = convertCapRuntimeToCapProjectType;
16
- exports.getAnnotations = getAnnotations;
17
- exports.restoreServiceProviderLoggers = restoreServiceProviderLoggers;
18
- const annotation_converter_1 = require("@sap-ux/annotation-converter");
19
- const btp_utils_1 = require("@sap-ux/btp-utils");
20
- const cap_config_writer_1 = require("@sap-ux/cap-config-writer");
21
- const edmx_parser_1 = require("@sap-ux/edmx-parser");
22
- const fiori_elements_writer_1 = require("@sap-ux/fiori-elements-writer");
23
- const fiori_tools_settings_1 = require("@sap-ux/fiori-tools-settings");
24
- const launch_config_1 = require("@sap-ux/launch-config");
25
- const odata_service_inquirer_1 = require("@sap-ux/odata-service-inquirer");
26
- const project_access_1 = require("@sap-ux/project-access");
27
- const node_path_1 = require("node:path");
28
- const uuid_1 = require("uuid");
29
- const types_1 = require("../types");
30
- const constants_1 = require("../types/constants");
31
- const external_1 = require("../types/external");
32
- const i18n_1 = require("./i18n");
33
- const store_1 = require("@sap-ux/store");
1
+ import { convert } from '@sap-ux/annotation-converter';
2
+ import { isAbapEnvironmentOnBtp, isAppStudio } from '@sap-ux/btp-utils';
3
+ import { checkCdsUi5PluginEnabled, getAppLaunchText } from '@sap-ux/cap-config-writer';
4
+ import { parse } from '@sap-ux/edmx-parser';
5
+ import { TemplateTypeAttributes } from '@sap-ux/fiori-elements-writer';
6
+ import { writeApplicationInfoSettings } from '@sap-ux/fiori-tools-settings';
7
+ import { createLaunchConfig } from '@sap-ux/launch-config';
8
+ import { DatasourceType, OdataVersion } from '@sap-ux/odata-service-inquirer';
9
+ import { isCapJavaProject, toReferenceUri } from '@sap-ux/project-access';
10
+ import { basename, join } from 'node:path';
11
+ import { v4 as uuidV4 } from 'uuid';
12
+ import { ApiHubType, SapSystemSourceType, FloorplanFE, minUi5VersionForPageBuildingBlock } from '../types/index.js';
13
+ import { minSupportedUi5Version, minSupportedUi5VersionV4 } from '../types/constants.js';
14
+ import { FloorplanAttributes, FloorplanFF } from '../types/external.js';
15
+ import { t } from './i18n.js';
16
+ import { getBackendSystemType } from '@sap-ux/store';
34
17
  /**
35
18
  * Parse the specified edmx string for validitiy and return the ODataVersion of the specified edmx string.
36
19
  *
@@ -38,13 +21,13 @@ const store_1 = require("@sap-ux/store");
38
21
  * @returns ODataVersion, odata version
39
22
  * @throws Error, if invalid edmx
40
23
  */
41
- function getODataVersion(edmx) {
24
+ export function getODataVersion(edmx) {
42
25
  try {
43
- const convertedMetadata = (0, annotation_converter_1.convert)((0, edmx_parser_1.parse)(edmx));
44
- return convertedMetadata.version.startsWith('4') ? odata_service_inquirer_1.OdataVersion.v4 : odata_service_inquirer_1.OdataVersion.v2;
26
+ const convertedMetadata = convert(parse(edmx));
27
+ return convertedMetadata.version.startsWith('4') ? OdataVersion.v4 : OdataVersion.v2;
45
28
  }
46
29
  catch (error) {
47
- throw Error((0, i18n_1.t)('error.appConfigUnparseableEdmx'));
30
+ throw Error(t('error.appConfigUnparseableEdmx'));
48
31
  }
49
32
  }
50
33
  /**
@@ -54,7 +37,7 @@ function getODataVersion(edmx) {
54
37
  * @param namespace
55
38
  * @returns AppId
56
39
  */
57
- function getAppId(name, namespace) {
40
+ export function getAppId(name, namespace) {
58
41
  const fullyQualifiedProjectName = [namespace, name].filter((x) => !!x).join('.');
59
42
  return fullyQualifiedProjectName.replace(/[_-]/g, '');
60
43
  }
@@ -65,7 +48,7 @@ function getAppId(name, namespace) {
65
48
  * @param sapClient
66
49
  * @returns sap-client parameter
67
50
  */
68
- function buildSapClientParam(sapClient) {
51
+ export function buildSapClientParam(sapClient) {
69
52
  return sapClient ? `sap-client=${sapClient}` : '';
70
53
  }
71
54
  /**
@@ -75,8 +58,8 @@ function buildSapClientParam(sapClient) {
75
58
  * @param floorplan a floorplan value
76
59
  * @returns - array of supported odata versions or undefined if all are supported
77
60
  */
78
- function getRequiredOdataVersion(floorplan) {
79
- const supportedVers = external_1.FloorplanAttributes[floorplan].supportedODataVersion;
61
+ export function getRequiredOdataVersion(floorplan) {
62
+ const supportedVers = FloorplanAttributes[floorplan].supportedODataVersion;
80
63
  return supportedVers.length === 1 ? supportedVers[0] : undefined;
81
64
  }
82
65
  /**
@@ -88,16 +71,16 @@ function getRequiredOdataVersion(floorplan) {
88
71
  * @param entityRelatedConfig - entity related configuration.
89
72
  * @returns The minimum supported UI5 version as a string.
90
73
  */
91
- function getMinSupportedUI5Version(version, floorplan, entityRelatedConfig) {
92
- if (floorplan === types_1.FloorplanFE.FE_FPM && entityRelatedConfig?.addPageBuildingBlock) {
93
- return types_1.minUi5VersionForPageBuildingBlock;
74
+ export function getMinSupportedUI5Version(version, floorplan, entityRelatedConfig) {
75
+ if (floorplan === FloorplanFE.FE_FPM && entityRelatedConfig?.addPageBuildingBlock) {
76
+ return minUi5VersionForPageBuildingBlock;
94
77
  }
95
78
  let minUI5Version;
96
- if (floorplan && floorplan !== external_1.FloorplanFF.FF_SIMPLE) {
97
- const templateType = external_1.FloorplanAttributes[floorplan].templateType;
98
- minUI5Version = fiori_elements_writer_1.TemplateTypeAttributes[templateType].minimumUi5Version[version];
79
+ if (floorplan && floorplan !== FloorplanFF.FF_SIMPLE) {
80
+ const templateType = FloorplanAttributes[floorplan].templateType;
81
+ minUI5Version = TemplateTypeAttributes[templateType].minimumUi5Version[version];
99
82
  }
100
- return minUI5Version ?? (version === odata_service_inquirer_1.OdataVersion.v4 ? constants_1.minSupportedUi5VersionV4 : constants_1.minSupportedUi5Version);
83
+ return minUI5Version ?? (version === OdataVersion.v4 ? minSupportedUi5VersionV4 : minSupportedUi5Version);
101
84
  }
102
85
  /**
103
86
  * Generates a v4 uuid. While not strictly necessary to wrap uuid it means we can enforce
@@ -105,8 +88,8 @@ function getMinSupportedUI5Version(version, floorplan, entityRelatedConfig) {
105
88
  *
106
89
  * @returns a uuid v4 string
107
90
  */
108
- function generateToolsId() {
109
- return (0, uuid_1.v4)();
91
+ export function generateToolsId() {
92
+ return uuidV4();
110
93
  }
111
94
  /**
112
95
  * Retrieves information related to cds version and checks if the CAP UI5 plugin is enabled.
@@ -117,11 +100,11 @@ function generateToolsId() {
117
100
  * @returns A promise that resolves to an object containing cdsinformation,
118
101
  * or `undefined` if the CAP UI5 plugin is not enabled.
119
102
  */
120
- async function getCdsUi5PluginInfo(capProjectPath, fs, cdsVersionInfo) {
103
+ export async function getCdsUi5PluginInfo(capProjectPath, fs, cdsVersionInfo) {
121
104
  // If the project is a Java project, do not pass cdsVersionInfo.
122
105
  // This ensures that hasMinCdsVersion is false for Java project, preventing certain prompts (e.g typescript, virtual endpoints) from being invoked for Java projects.
123
- const cdsVersion = (await (0, project_access_1.isCapJavaProject)(capProjectPath)) ? undefined : cdsVersionInfo;
124
- const capCdsInfo = await (0, cap_config_writer_1.checkCdsUi5PluginEnabled)(capProjectPath, fs, true, cdsVersion);
106
+ const cdsVersion = (await isCapJavaProject(capProjectPath)) ? undefined : cdsVersionInfo;
107
+ const capCdsInfo = await checkCdsUi5PluginEnabled(capProjectPath, fs, true, cdsVersion);
125
108
  return capCdsInfo === false ? undefined : capCdsInfo;
126
109
  }
127
110
  /**
@@ -131,12 +114,12 @@ async function getCdsUi5PluginInfo(capProjectPath, fs, cdsVersionInfo) {
131
114
  * @param {string} projectName - The name of the project, which is the module name.
132
115
  * @returns {Promise<CdsAnnotationsInfo>} A promise that resolves to an object containing CDS annotations information.
133
116
  */
134
- async function getCdsAnnotations(capService, projectName) {
117
+ export async function getCdsAnnotations(capService, projectName) {
135
118
  const { appPath: capAppPath = 'app', projectPath, serviceCdsPath, serviceName } = capService;
136
119
  if (serviceCdsPath) {
137
120
  // Construct the annotation path and service cds URI
138
- const annotationPath = (0, node_path_1.join)(capAppPath, projectName, 'annotation.cds').replace(/\\/g, '/');
139
- const serviceCdsUri = await (0, project_access_1.toReferenceUri)(projectPath, annotationPath, serviceCdsPath);
121
+ const annotationPath = join(capAppPath, projectName, 'annotation.cds').replace(/\\/g, '/');
122
+ const serviceCdsUri = await toReferenceUri(projectPath, annotationPath, serviceCdsPath);
140
123
  // Create the contents of the annotation CDS file
141
124
  const annotationCdsContents = `using ${serviceName} as service from '${serviceCdsUri}';`;
142
125
  // Return an object with the necessary information for cds files
@@ -154,11 +137,11 @@ async function getCdsAnnotations(capService, projectName) {
154
137
  * @param connectedSystem - The connected system object.
155
138
  * @returns {boolean} `true` if the connected system is ABAP cloud, otherwise `false`.
156
139
  */
157
- function isAbapCloud(connectedSystem) {
140
+ export function isAbapCloud(connectedSystem) {
158
141
  if (connectedSystem?.backendSystem) {
159
- return (0, store_1.getBackendSystemType)(connectedSystem.backendSystem) === 'AbapCloud';
142
+ return getBackendSystemType(connectedSystem.backendSystem) === 'AbapCloud';
160
143
  }
161
- return connectedSystem?.destination ? (0, btp_utils_1.isAbapEnvironmentOnBtp)(connectedSystem.destination) : false;
144
+ return connectedSystem?.destination ? isAbapEnvironmentOnBtp(connectedSystem.destination) : false;
162
145
  }
163
146
  /**
164
147
  * Retrieves the data source label.
@@ -168,17 +151,17 @@ function isAbapCloud(connectedSystem) {
168
151
  * @param {ApiHubType} apiHubType - The API hub type for business hubs.
169
152
  * @returns {string} The formatted data source label.
170
153
  */
171
- function getReadMeDataSourceLabel(source, abapCloud = false, apiHubType) {
154
+ export function getReadMeDataSourceLabel(source, abapCloud = false, apiHubType) {
172
155
  let dataSourceLabel;
173
- if (source === odata_service_inquirer_1.DatasourceType.sapSystem) {
174
- const labelDatasourceType = (0, i18n_1.t)(`readme.label.datasourceType.${odata_service_inquirer_1.DatasourceType.sapSystem}`);
175
- const labelSystemType = (0, i18n_1.t)(`readme.label.sapSystemType.${abapCloud ? "abapCloud" /* SapSystemSourceType.ABAP_CLOUD */ : "onPrem" /* SapSystemSourceType.ON_PREM */}`);
156
+ if (source === DatasourceType.sapSystem) {
157
+ const labelDatasourceType = t(`readme.label.datasourceType.${DatasourceType.sapSystem}`);
158
+ const labelSystemType = t(`readme.label.sapSystemType.${abapCloud ? SapSystemSourceType.ABAP_CLOUD : SapSystemSourceType.ON_PREM}`);
176
159
  dataSourceLabel = `${labelDatasourceType} (${labelSystemType})`;
177
160
  }
178
- else if (source === odata_service_inquirer_1.DatasourceType.businessHub && apiHubType === "API_HUB_ENTERPRISE" /* ApiHubType.apiHubEnterprise */) {
179
- dataSourceLabel = (0, i18n_1.t)('readme.label.datasourceType.apiBusinessHubEnterprise');
161
+ else if (source === DatasourceType.businessHub && apiHubType === ApiHubType.apiHubEnterprise) {
162
+ dataSourceLabel = t('readme.label.datasourceType.apiBusinessHubEnterprise');
180
163
  }
181
- return dataSourceLabel ?? (0, i18n_1.t)(`readme.label.datasourceType.${source}`);
164
+ return dataSourceLabel ?? t(`readme.label.datasourceType.${source}`);
182
165
  }
183
166
  /**
184
167
  * Generates the launch text for the application based on the CAP service information and project details.
@@ -191,14 +174,14 @@ function getReadMeDataSourceLabel(source, abapCloud = false, apiHubType) {
191
174
  * project name, and optionally the application ID if NPM workspaces or CDS UI5 plugin is enabled.
192
175
  * If CAP service information is not available, it returns a default launch text.
193
176
  */
194
- async function getLaunchText(capService, name, useNpmWorkspaceAppRef, namespace) {
177
+ export async function getLaunchText(capService, name, useNpmWorkspaceAppRef, namespace) {
195
178
  if (capService) {
196
179
  const appId = capService?.cdsUi5PluginInfo?.isCdsUi5PluginEnabled || useNpmWorkspaceAppRef // May be a case where isCdsUi5PluginEnabled is false but we know it will be enabled by the time the app is launched
197
180
  ? getAppId(name, namespace)
198
181
  : undefined;
199
- return (0, cap_config_writer_1.getAppLaunchText)(capService.capType ?? 'Node.js', name, appId);
182
+ return getAppLaunchText(capService.capType ?? 'Node.js', name, appId);
200
183
  }
201
- return (0, i18n_1.t)('readme.texts.runInstruction');
184
+ return t('readme.texts.runInstruction');
202
185
  }
203
186
  /**
204
187
  * Generates the launch configuration for a project based on the provided options.
@@ -216,35 +199,35 @@ async function getLaunchText(capService, name, useNpmWorkspaceAppRef, namespace)
216
199
  * @param {boolean} [writeToAppOnly] - A flag indicating whether to write the configuration only to the app folder.
217
200
  * @returns {void}
218
201
  */
219
- async function generateLaunchConfig(options, fs, vscode, log, writeToAppOnly = false) {
202
+ export async function generateLaunchConfig(options, fs, vscode, log, writeToAppOnly = false) {
220
203
  try {
221
204
  if (vscode) {
222
- const addStartCmd = options.datasourceType !== odata_service_inquirer_1.DatasourceType.metadataFile;
223
- const projectPath = (0, node_path_1.join)(options.targetFolder, options.projectName);
205
+ const addStartCmd = options.datasourceType !== DatasourceType.metadataFile;
206
+ const projectPath = join(options.targetFolder, options.projectName);
224
207
  const debugOptions = {
225
208
  vscode: vscode,
226
209
  addStartCmd,
227
210
  sapClientParam: options.sapClientParam,
228
211
  flpAppId: options?.enableVirtualEndpoints ? 'app-preview' : (options.flpAppId ?? ''),
229
212
  flpSandboxAvailable: !options?.enableVirtualEndpoints,
230
- isAppStudio: (0, btp_utils_1.isAppStudio)(),
213
+ isAppStudio: isAppStudio(),
231
214
  writeToAppOnly
232
215
  };
233
216
  if (options.odataVersion) {
234
- debugOptions.odataVersion = options.odataVersion === odata_service_inquirer_1.OdataVersion.v2 ? '2.0' : '4.0';
217
+ debugOptions.odataVersion = options.odataVersion === OdataVersion.v2 ? '2.0' : '4.0';
235
218
  }
236
219
  const fioriOptions = {
237
- name: (0, node_path_1.basename)(options.projectName),
220
+ name: basename(options.projectName),
238
221
  projectRoot: projectPath,
239
222
  startFile: options?.enableVirtualEndpoints ? 'test/flp.html' : undefined,
240
223
  debugOptions
241
224
  };
242
- await (0, launch_config_1.createLaunchConfig)(projectPath, fioriOptions, fs, log);
243
- (0, fiori_tools_settings_1.writeApplicationInfoSettings)(projectPath);
225
+ await createLaunchConfig(projectPath, fioriOptions, fs, log);
226
+ writeApplicationInfoSettings(projectPath);
244
227
  }
245
228
  }
246
229
  catch (err) {
247
- log?.error(`${(0, i18n_1.t)('error.errorWritingApplicationFiles')} : ${err}`);
230
+ log?.error(`${t('error.errorWritingApplicationFiles')} : ${err}`);
248
231
  }
249
232
  }
250
233
  /**
@@ -253,7 +236,7 @@ async function generateLaunchConfig(options, fs, vscode, log, writeToAppOnly = f
253
236
  * @param {CapRuntime} capRuntime - The CAP runtime type. Default is 'Node.js'.
254
237
  * @returns {CapProjectType} The CAP project type.
255
238
  */
256
- function convertCapRuntimeToCapProjectType(capRuntime = 'Node.js') {
239
+ export function convertCapRuntimeToCapProjectType(capRuntime = 'Node.js') {
257
240
  return capRuntime === 'Java' ? 'CAPJava' : 'CAPNodejs';
258
241
  }
259
242
  /**
@@ -264,7 +247,7 @@ function convertCapRuntimeToCapProjectType(capRuntime = 'Node.js') {
264
247
  * @param {CapService} capService - The CAP service instance used to retrieve CDS annotations.
265
248
  * @returns {Promise<CdsAnnotationsInfo | EdmxAnnotationsInfo>} A promise that resolves to either CDS annotations info or EDMX annotations info.
266
249
  */
267
- async function getAnnotations(projectName, annotations, capService) {
250
+ export async function getAnnotations(projectName, annotations, capService) {
268
251
  // Add annotations to fiori app
269
252
  if (capService) {
270
253
  return getCdsAnnotations(capService, projectName);
@@ -285,7 +268,7 @@ async function getAnnotations(projectName, annotations, capService) {
285
268
  * @param serviceProvider - The service provider object that may have missing loggers.
286
269
  * @returns The service provider with restored loggers.
287
270
  */
288
- function restoreServiceProviderLoggers(logger, serviceProvider) {
271
+ export function restoreServiceProviderLoggers(logger, serviceProvider) {
289
272
  // Restore the loggers if missing.
290
273
  for (const service in serviceProvider?.services) {
291
274
  if (serviceProvider.services?.[service].log && !serviceProvider.services[service].log.info) {
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_POST_APP_GEN_COMMAND = void 0;
4
- exports.runHooks = runHooks;
5
- const i18n_1 = require("./i18n");
6
- exports.DEFAULT_POST_APP_GEN_COMMAND = 'sap.ux.application.generated.handler';
1
+ import { t } from './i18n.js';
2
+ export const DEFAULT_POST_APP_GEN_COMMAND = 'sap.ux.application.generated.handler';
7
3
  /**
8
4
  * Run the post generation events. This can be used to run any follow up commands.
9
5
  *
@@ -12,12 +8,12 @@ exports.DEFAULT_POST_APP_GEN_COMMAND = 'sap.ux.application.generated.handler';
12
8
  * @param logger The logger to use
13
9
  * @returns
14
10
  */
15
- async function runHooks(event, context, logger) {
11
+ export async function runHooks(event, context, logger) {
16
12
  if (event === 'app-generated') {
17
13
  return postGenerationHook(context, logger);
18
14
  }
19
15
  else {
20
- throw new Error((0, i18n_1.t)('error.unsupportedPostGenerationEvent', { event }));
16
+ throw new Error(t('error.unsupportedPostGenerationEvent', { event }));
21
17
  }
22
18
  }
23
19
  /**
@@ -29,8 +25,8 @@ async function runHooks(event, context, logger) {
29
25
  async function postGenerationHook(context, logger) {
30
26
  if (context.vscodeInstance) {
31
27
  try {
32
- const command = context.options?.command ?? exports.DEFAULT_POST_APP_GEN_COMMAND;
33
- logger?.info((0, i18n_1.t)('logMessages.attemptingToExecutePostGenerationCommand', { command }));
28
+ const command = context.options?.command ?? DEFAULT_POST_APP_GEN_COMMAND;
29
+ logger?.info(t('logMessages.attemptingToExecutePostGenerationCommand', { command }));
34
30
  await context.vscodeInstance.commands?.executeCommand?.(command, context.hookParameters);
35
31
  }
36
32
  catch (e) {
@@ -1,37 +1,29 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.defaultProjectNumber = exports.fioriAppSubGeneratorNs = exports.i18n = void 0;
7
- exports.initI18nFioriAppSubGenerator = initI18nFioriAppSubGenerator;
8
- exports.t = t;
9
- const i18next_1 = __importDefault(require("i18next"));
10
- const fioriAppSubGenerator_i18n_json_1 = __importDefault(require("../translations/fioriAppSubGenerator.i18n.json"));
11
- exports.i18n = i18next_1.default.createInstance();
12
- exports.fioriAppSubGeneratorNs = 'fiori-app-sub-generator';
13
- exports.defaultProjectNumber = 1;
1
+ import i18next from 'i18next';
2
+ import i18ntranslations from '../translations/fioriAppSubGenerator.i18n.json' with { type: 'json' };
3
+ export const i18n = i18next.createInstance();
4
+ export const fioriAppSubGeneratorNs = 'fiori-app-sub-generator';
5
+ export const defaultProjectNumber = 1;
14
6
  /**
15
7
  * Initialize i18next with the translations for this module.
16
8
  */
17
- async function initI18nFioriAppSubGenerator() {
18
- await exports.i18n.init({
9
+ export async function initI18nFioriAppSubGenerator() {
10
+ await i18n.init({
19
11
  resources: {
20
12
  en: {
21
- [exports.fioriAppSubGeneratorNs]: fioriAppSubGenerator_i18n_json_1.default
13
+ [fioriAppSubGeneratorNs]: i18ntranslations
22
14
  }
23
15
  },
24
16
  lng: 'en',
25
17
  fallbackLng: 'en',
26
- defaultNS: exports.fioriAppSubGeneratorNs,
27
- ns: [exports.fioriAppSubGeneratorNs],
18
+ defaultNS: fioriAppSubGeneratorNs,
19
+ ns: [fioriAppSubGeneratorNs],
28
20
  showSupportNotice: false,
29
21
  interpolation: {
30
22
  format: function odataVersionFormatter(odataVersion) {
31
23
  return odataVersion ? ` V${odataVersion}` : '';
32
24
  },
33
25
  defaultVariables: {
34
- defaultProjectNumber: exports.defaultProjectNumber
26
+ defaultProjectNumber
35
27
  }
36
28
  },
37
29
  missingInterpolationHandler: () => '' // Called when interpolation values are undefined, prevents outputting of `{{undefinedProperty}}`
@@ -44,13 +36,13 @@ async function initI18nFioriAppSubGenerator() {
44
36
  * @param options additional options
45
37
  * @returns {string} localized string stored for the given key
46
38
  */
47
- function t(key, options) {
39
+ export function t(key, options) {
48
40
  if (!options?.ns) {
49
- options = Object.assign(options ?? {}, { ns: exports.fioriAppSubGeneratorNs });
41
+ options = Object.assign(options ?? {}, { ns: fioriAppSubGeneratorNs });
50
42
  }
51
- return exports.i18n.t(key, options);
43
+ return i18n.t(key, options);
52
44
  }
53
45
  initI18nFioriAppSubGenerator().catch(() => {
54
- // Needed for lint
46
+ // Ignore any errors since the checks will still work
55
47
  });
56
48
  //# sourceMappingURL=i18n.js.map
@@ -1,9 +1,9 @@
1
- export * from './i18n';
2
- export * from './telemetry';
3
- export * from './common';
4
- export * from './stepsHelper';
5
- export * from './command-runner';
6
- export * from './eventHooks';
7
- export * from './sapuxLayer';
8
- export * from './appWizardCache';
1
+ export * from './i18n.js';
2
+ export * from './telemetry.js';
3
+ export * from './common.js';
4
+ export * from './stepsHelper.js';
5
+ export * from './command-runner.js';
6
+ export * from './eventHooks.js';
7
+ export * from './sapuxLayer.js';
8
+ export * from './appWizardCache.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1,25 +1,9 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./i18n"), exports);
18
- __exportStar(require("./telemetry"), exports);
19
- __exportStar(require("./common"), exports);
20
- __exportStar(require("./stepsHelper"), exports);
21
- __exportStar(require("./command-runner"), exports);
22
- __exportStar(require("./eventHooks"), exports);
23
- __exportStar(require("./sapuxLayer"), exports);
24
- __exportStar(require("./appWizardCache"), exports);
1
+ export * from './i18n.js';
2
+ export * from './telemetry.js';
3
+ export * from './common.js';
4
+ export * from './stepsHelper.js';
5
+ export * from './command-runner.js';
6
+ export * from './eventHooks.js';
7
+ export * from './sapuxLayer.js';
8
+ export * from './appWizardCache.js';
25
9
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assignSapUxLayerValue = assignSapUxLayerValue;
4
- const feature_toggle_1 = require("@sap-ux/feature-toggle");
1
+ import { isInternalFeaturesSettingEnabled } from '@sap-ux/feature-toggle';
5
2
  /**
6
3
  * Determines the SAP UX layer based on isCap enabled or not.
7
4
  *
@@ -14,11 +11,11 @@ const feature_toggle_1 = require("@sap-ux/feature-toggle");
14
11
  * @param {boolean} isCap - Indicates if the project is a CAP project.
15
12
  * @returns {UI5FlexLayer | undefined} - The assigned SAP UX layer or `undefined` for CAP projects.
16
13
  */
17
- function assignSapUxLayerValue(isCap = false) {
14
+ export function assignSapUxLayerValue(isCap = false) {
18
15
  if (isCap) {
19
16
  // Skip for CAP projects
20
17
  return undefined;
21
18
  }
22
- return (0, feature_toggle_1.isInternalFeaturesSettingEnabled)() ? 'VENDOR' : 'CUSTOMER_BASE';
19
+ return isInternalFeaturesSettingEnabled() ? 'VENDOR' : 'CUSTOMER_BASE';
23
20
  }
24
21
  //# sourceMappingURL=sapuxLayer.js.map
@@ -1,6 +1,5 @@
1
- import type { IPrompt as YeomanUiStep } from '@sap-devx/yeoman-ui-types';
2
- import { Prompts as YeomanUiSteps } from '@sap-devx/yeoman-ui-types';
3
- import type { FioriStep, YeomanUiStepConfig } from '../types/yeomanUiStepConfig';
1
+ import type { IPrompt as YeomanUiStep, Prompts as YeomanUiStepsType } from '@sap-devx/yeoman-ui-types';
2
+ import type { FioriStep, YeomanUiStepConfig } from '../types/yeomanUiStepConfig.js';
4
3
  /**
5
4
  * Update the dependent step in the active steps of the Yeoman UI steps. Ultimately this will result in a new step being added to the Application Wizard.
6
5
  *
@@ -17,7 +16,7 @@ export declare function updateDependentStep(currentStepName: string, stepConfigL
17
16
  * @param yuiSteps
18
17
  * @returns
19
18
  */
20
- export declare function hasActiveStep(stepName: string, yuiSteps: YeomanUiSteps): boolean;
19
+ export declare function hasActiveStep(stepName: string, yuiSteps: YeomanUiStepsType): boolean;
21
20
  /**
22
21
  * Check if a step is present in the steps array. Non-present steps are not added to the Application Wizard, essentially skipping them.
23
22
  *