@sap-ux/cf-deploy-config-sub-generator 0.3.6 → 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.
@@ -1,11 +1,8 @@
1
- import { ApiHubType } from '@sap-ux/cf-deploy-config-writer';
2
1
  import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
3
- import { DESTINATION_AUTHTYPE_NOTFOUND, API_BUSINESS_HUB_ENTERPRISE_PREFIX } from '../utils';
4
- import { loadManifest } from './utils';
5
- import { getCFQuestions } from './questions';
6
- import type { ApiHubConfig } from '@sap-ux/cf-deploy-config-writer';
7
- import { CfDeployConfigOptions } from './types';
8
- import { type CfDeployConfigQuestions, type CfDeployConfigPromptOptions, CfDeployConfigAnswers } from '@sap-ux/cf-deploy-config-inquirer';
2
+ import { DESTINATION_AUTHTYPE_NOTFOUND, API_BUSINESS_HUB_ENTERPRISE_PREFIX } from '../utils/index.js';
3
+ import { loadManifest } from './utils.js';
4
+ import { getCFQuestions } from './questions.js';
5
+ import type { CfDeployConfigOptions } from './types.js';
9
6
  /**
10
7
  * Cloud Foundry deployment configuration generator.
11
8
  */
@@ -87,5 +84,8 @@ export default class extends DeploymentGenerator {
87
84
  }
88
85
  export { getCFQuestions, loadManifest };
89
86
  export { API_BUSINESS_HUB_ENTERPRISE_PREFIX, DESTINATION_AUTHTYPE_NOTFOUND };
90
- export { CfDeployConfigOptions, CfDeployConfigAnswers, CfDeployConfigQuestions, CfDeployConfigPromptOptions, ApiHubConfig, ApiHubType };
87
+ export type { CfDeployConfigAnswers, CfDeployConfigQuestions, CfDeployConfigPromptOptions } from '@sap-ux/cf-deploy-config-inquirer';
88
+ export type { CfDeployConfigOptions } from './types.js';
89
+ export type { ApiHubConfig } from '@sap-ux/cf-deploy-config-writer';
90
+ export { ApiHubType } from '@sap-ux/cf-deploy-config-writer';
91
91
  //# sourceMappingURL=index.d.ts.map
@@ -1,29 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DESTINATION_AUTHTYPE_NOTFOUND = exports.API_BUSINESS_HUB_ENTERPRISE_PREFIX = exports.loadManifest = exports.getCFQuestions = void 0;
4
- const node_path_1 = require("node:path");
5
- const node_os_1 = require("node:os");
6
- const hasbin = require("hasbin");
7
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
8
- const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
9
- const feature_toggle_1 = require("@sap-ux/feature-toggle");
10
- const btp_utils_1 = require("@sap-ux/btp-utils");
11
- const cf_deploy_config_writer_1 = require("@sap-ux/cf-deploy-config-writer");
12
- const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
13
- const utils_1 = require("../utils");
14
- Object.defineProperty(exports, "DESTINATION_AUTHTYPE_NOTFOUND", { enumerable: true, get: function () { return utils_1.DESTINATION_AUTHTYPE_NOTFOUND; } });
15
- Object.defineProperty(exports, "API_BUSINESS_HUB_ENTERPRISE_PREFIX", { enumerable: true, get: function () { return utils_1.API_BUSINESS_HUB_ENTERPRISE_PREFIX; } });
16
- const utils_2 = require("./utils");
17
- Object.defineProperty(exports, "loadManifest", { enumerable: true, get: function () { return utils_2.loadManifest; } });
18
- const project_access_1 = require("@sap-ux/project-access");
19
- const telemetryEvents_1 = require("../telemetryEvents");
20
- const questions_1 = require("./questions");
21
- Object.defineProperty(exports, "getCFQuestions", { enumerable: true, get: function () { return questions_1.getCFQuestions; } });
22
- const cf_deploy_config_inquirer_1 = require("@sap-ux/cf-deploy-config-inquirer");
1
+ import { join, dirname } from 'node:path';
2
+ import { platform } from 'node:os';
3
+ import * as hasbin from 'hasbin';
4
+ import { AppWizard, MessageType } from '@sap-devx/yeoman-ui-types';
5
+ import { sendTelemetry, TelemetryHelper, isExtensionInstalled, YUI_EXTENSION_ID, YUI_MIN_VER_FILES_GENERATED_MSG, setYeomanEnvConflicterForce } from '@sap-ux/fiori-generator-shared';
6
+ import { isInternalFeaturesSettingEnabled } from '@sap-ux/feature-toggle';
7
+ import { isFullUrlDestination } from '@sap-ux/btp-utils';
8
+ import { generateAppConfig, generateCAPConfig, ApiHubType, useAbapDirectServiceBinding, DefaultMTADestination } from '@sap-ux/cf-deploy-config-writer';
9
+ import { DeploymentGenerator, showOverwriteQuestion, bail, handleErrorMessage, ErrorHandler, ERROR_TYPE, mtaExecutable, cdsExecutable, generateDestinationName, getDestination } from '@sap-ux/deploy-config-generator-shared';
10
+ import { t, initI18n, DESTINATION_AUTHTYPE_NOTFOUND, API_BUSINESS_HUB_ENTERPRISE_PREFIX } from '../utils/index.js';
11
+ import { loadManifest } from './utils.js';
12
+ import { getMtaPath, findCapProjectRoot, FileName } from '@sap-ux/project-access';
13
+ import { EventName } from '../telemetryEvents/index.js';
14
+ import { getCFQuestions, getCAPMTAQuestions } from './questions.js';
15
+ import { RouterModuleType } from '@sap-ux/cf-deploy-config-inquirer';
23
16
  /**
24
17
  * Cloud Foundry deployment configuration generator.
25
18
  */
26
- class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
19
+ export default class extends DeploymentGenerator {
27
20
  appWizard;
28
21
  vscode;
29
22
  launchDeployConfigAsSubGenerator;
@@ -55,7 +48,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
55
48
  super(args, opts);
56
49
  this.launchDeployConfigAsSubGenerator = opts.launchDeployConfigAsSubGenerator ?? false;
57
50
  this.launchStandaloneFromYui = opts.launchStandaloneFromYui;
58
- this.appWizard = opts.appWizard ?? yeoman_ui_types_1.AppWizard.create(opts);
51
+ this.appWizard = opts.appWizard ?? AppWizard.create(opts);
59
52
  this.vscode = opts.vscode;
60
53
  this.options = opts;
61
54
  this.destinationName = opts.destinationName ?? '';
@@ -70,17 +63,17 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
70
63
  }
71
64
  async initializing() {
72
65
  await super.initializing();
73
- await (0, utils_1.initI18n)();
74
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('cfGen.debug.initTelemetry'));
66
+ await initI18n();
67
+ DeploymentGenerator.logger?.debug(t('cfGen.debug.initTelemetry'));
75
68
  // hack to suppress yeoman's overwrite prompt when files already exist
76
69
  // required when running the deploy config generator in standalone mode
77
- (0, fiori_generator_shared_1.setYeomanEnvConflicterForce)(this.env, this.options.force);
78
- await fiori_generator_shared_1.TelemetryHelper.initTelemetrySettings({
70
+ setYeomanEnvConflicterForce(this.env, this.options.force);
71
+ await TelemetryHelper.initTelemetrySettings({
79
72
  consumerModule: {
80
73
  name: '@sap-ux/cf-deploy-config-sub-generator',
81
74
  version: this.rootGeneratorVersion()
82
75
  },
83
- internalFeature: (0, feature_toggle_1.isInternalFeaturesSettingEnabled)(),
76
+ internalFeature: isInternalFeaturesSettingEnabled(),
84
77
  watchTelemetrySettingStore: false
85
78
  });
86
79
  // Note: the init phase has to be delayed when loaded as a sub-gen as the yaml configurations are not available.
@@ -90,13 +83,13 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
90
83
  }
91
84
  async _init() {
92
85
  // mta executable is required as mta-lib is used
93
- if (!hasbin.sync(deploy_config_generator_shared_1.mtaExecutable)) {
86
+ if (!hasbin.sync(mtaExecutable)) {
94
87
  this.abort = true;
95
- (0, deploy_config_generator_shared_1.handleErrorMessage)(this.appWizard, { errorType: deploy_config_generator_shared_1.ERROR_TYPE.NO_MTA_BIN });
88
+ handleErrorMessage(this.appWizard, { errorType: ERROR_TYPE.NO_MTA_BIN });
96
89
  }
97
90
  await this._processProjectPaths();
98
91
  await this._processProjectConfigs();
99
- this.isAbapDirectServiceBinding = await (0, cf_deploy_config_writer_1.useAbapDirectServiceBinding)(this.appPath, false, this.mtaPath);
92
+ this.isAbapDirectServiceBinding = await useAbapDirectServiceBinding(this.appPath, false, this.mtaPath);
100
93
  // restricting local changes is only applicable for CAP flows
101
94
  if (!this.isCap) {
102
95
  this.lcapModeOnly = false;
@@ -107,25 +100,25 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
107
100
  * Checks if the project is a CAP project or contains an mta.
108
101
  */
109
102
  async _processProjectPaths() {
110
- const mtaPathResult = await (0, project_access_1.getMtaPath)(this.appPath);
103
+ const mtaPathResult = await getMtaPath(this.appPath);
111
104
  this.mtaPath = mtaPathResult?.mtaPath;
112
- const capRoot = await (0, project_access_1.findCapProjectRoot)(this.appPath, true, this.fs);
105
+ const capRoot = await findCapProjectRoot(this.appPath, true, this.fs);
113
106
  if (capRoot) {
114
- if (!hasbin.sync(deploy_config_generator_shared_1.cdsExecutable)) {
115
- (0, deploy_config_generator_shared_1.bail)(deploy_config_generator_shared_1.ErrorHandler.getErrorMsgFromType(deploy_config_generator_shared_1.ERROR_TYPE.NO_CDS_BIN));
107
+ if (!hasbin.sync(cdsExecutable)) {
108
+ bail(ErrorHandler.getErrorMsgFromType(ERROR_TYPE.NO_CDS_BIN));
116
109
  }
117
110
  this.isCap = true;
118
111
  this.projectRoot = capRoot;
119
112
  try {
120
113
  this.packageName =
121
- this.fs.readJSON((0, node_path_1.join)(this.projectRoot, project_access_1.FileName.Package))?.name ?? '';
114
+ this.fs.readJSON(join(this.projectRoot, FileName.Package))?.name ?? '';
122
115
  }
123
116
  catch {
124
117
  // Ignore errors while reading the package.json file, will be handled in the validators of the respective modules
125
118
  }
126
119
  }
127
120
  else if (this.mtaPath) {
128
- this.projectRoot = (0, node_path_1.dirname)(this.mtaPath);
121
+ this.projectRoot = dirname(this.mtaPath);
129
122
  }
130
123
  }
131
124
  /**
@@ -133,12 +126,12 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
133
126
  * Checks if the base config file exists.
134
127
  */
135
128
  async _processProjectConfigs() {
136
- const baseConfigFile = this.options.base ?? project_access_1.FileName.Ui5Yaml;
137
- const baseConfigExists = this.fs.exists((0, node_path_1.join)(this.appPath, baseConfigFile));
129
+ const baseConfigFile = this.options.base ?? FileName.Ui5Yaml;
130
+ const baseConfigExists = this.fs.exists(join(this.appPath, baseConfigFile));
138
131
  if (!baseConfigExists) {
139
- (0, deploy_config_generator_shared_1.bail)(deploy_config_generator_shared_1.ErrorHandler.noBaseConfig(baseConfigFile));
132
+ bail(ErrorHandler.noBaseConfig(baseConfigFile));
140
133
  }
141
- this.deployConfigExists = this.fs.exists((0, node_path_1.join)(this.appPath, this.options.config ?? project_access_1.FileName.Ui5Yaml));
134
+ this.deployConfigExists = this.fs.exists(join(this.appPath, this.options.config ?? FileName.Ui5Yaml));
142
135
  }
143
136
  async prompting() {
144
137
  if (this.abort) {
@@ -152,15 +145,15 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
152
145
  async _prompting() {
153
146
  const isCAPMissingMTA = this.isCap && this.projectRoot && !this.mtaPath;
154
147
  if (isCAPMissingMTA) {
155
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('cfGen.debug.capMissingMTA'));
156
- this.appRouterAnswers = (await this.prompt(await (0, questions_1.getCAPMTAQuestions)({ projectRoot: this.projectRoot ?? process.cwd() })));
148
+ DeploymentGenerator.logger?.debug(t('cfGen.debug.capMissingMTA'));
149
+ this.appRouterAnswers = (await this.prompt(await getCAPMTAQuestions({ projectRoot: this.projectRoot ?? process.cwd() })));
157
150
  if (this.appRouterAnswers.addCapMtaContinue !== true) {
158
151
  this.abort = true;
159
152
  return;
160
153
  }
161
154
  // Configure defaults
162
155
  this.appRouterAnswers.mtaId = this.packageName; // Required for the MTA validation
163
- this.destinationName = cf_deploy_config_writer_1.DefaultMTADestination;
156
+ this.destinationName = DefaultMTADestination;
164
157
  this.options.overwrite = true; // Don't prompt the user to overwrite files we've just written!
165
158
  this.answers = {};
166
159
  this.answers.destinationName = this.destinationName;
@@ -177,13 +170,13 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
177
170
  */
178
171
  async _handleApiHubConfig() {
179
172
  // generate a new instance dest name for api hub
180
- if (this.apiHubConfig?.apiHubType === "API_HUB_ENTERPRISE" /* ApiHubType.apiHubEnterprise */) {
173
+ if (this.apiHubConfig?.apiHubType === ApiHubType.apiHubEnterprise) {
181
174
  // full service path is only available from the manifest.json
182
175
  if (!this.servicePath) {
183
- const manifest = await (0, utils_2.loadManifest)(this.fs, this.appPath);
176
+ const manifest = await loadManifest(this.fs, this.appPath);
184
177
  this.servicePath = manifest?.['sap.app']?.dataSources?.mainService?.uri;
185
178
  }
186
- this.destinationName = (0, deploy_config_generator_shared_1.generateDestinationName)(utils_1.API_BUSINESS_HUB_ENTERPRISE_PREFIX, this.servicePath);
179
+ this.destinationName = generateDestinationName(API_BUSINESS_HUB_ENTERPRISE_PREFIX, this.servicePath);
187
180
  }
188
181
  }
189
182
  /**
@@ -192,12 +185,12 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
192
185
  * @returns {Promise<CfDeployConfigQuestions[]>} - Cloud Foundry deployment configuration questions
193
186
  */
194
187
  async _getCFQuestions() {
195
- return (0, questions_1.getCFQuestions)({
188
+ return getCFQuestions({
196
189
  projectRoot: this.projectRoot,
197
190
  isAbapDirectServiceBinding: this.isAbapDirectServiceBinding,
198
191
  cfDestination: this.destinationName,
199
192
  isCap: this.isCap,
200
- addOverwrite: (0, deploy_config_generator_shared_1.showOverwriteQuestion)(this.deployConfigExists, this.launchDeployConfigAsSubGenerator, this.launchStandaloneFromYui, this.options.overwrite),
193
+ addOverwrite: showOverwriteQuestion(this.deployConfigExists, this.launchDeployConfigAsSubGenerator, this.launchStandaloneFromYui, this.options.overwrite),
201
194
  apiHubConfig: this.apiHubConfig
202
195
  });
203
196
  }
@@ -206,15 +199,18 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
206
199
  */
207
200
  async _reconcileAnswersWithOptions() {
208
201
  const destinationName = this.destinationName || this.answers.destinationName;
209
- const destination = await (0, deploy_config_generator_shared_1.getDestination)(destinationName);
210
- const isDestinationFullUrl = this.options.isFullUrlDest ?? (destination && (0, btp_utils_1.isFullUrlDestination)(destination)) ?? false;
202
+ const destination = await getDestination(destinationName);
203
+ const isDestinationFullUrl = this.options.isFullUrlDest ?? (destination && isFullUrlDestination(destination)) ?? false;
204
+ if (isDestinationFullUrl) {
205
+ DeploymentGenerator.logger?.warn(t('cfGen.warn.fullUrlDestination'));
206
+ }
211
207
  const addManagedAppRouter = this.options.addManagedAppRouter ??
212
- (this.options.routerType === cf_deploy_config_inquirer_1.RouterModuleType.Managed ||
213
- this.answers.routerType === cf_deploy_config_inquirer_1.RouterModuleType.Managed);
208
+ (this.options.routerType === RouterModuleType.Managed ||
209
+ this.answers.routerType === RouterModuleType.Managed);
214
210
  const addAppFrontendRouter = this.options.addAppFrontendRouter ??
215
- (this.options.routerType === cf_deploy_config_inquirer_1.RouterModuleType.AppFront ||
216
- this.answers.routerType === cf_deploy_config_inquirer_1.RouterModuleType.AppFront);
217
- const destinationAuthentication = this.options.destinationAuthType ?? destination?.Authentication ?? utils_1.DESTINATION_AUTHTYPE_NOTFOUND;
211
+ (this.options.routerType === RouterModuleType.AppFront ||
212
+ this.answers.routerType === RouterModuleType.AppFront);
213
+ const destinationAuthentication = this.options.destinationAuthType ?? destination?.Authentication ?? DESTINATION_AUTHTYPE_NOTFOUND;
218
214
  const overwrite = this.options.overwrite ?? this.answers.overwrite;
219
215
  this.answers = {
220
216
  destinationName,
@@ -242,14 +238,14 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
242
238
  try {
243
239
  // Step1. (Optional) Generate CAP MTA with specific approuter type managed | standalone
244
240
  if (this.appRouterAnswers) {
245
- await (0, cf_deploy_config_writer_1.generateCAPConfig)(this.appRouterAnswers, this.fs, deploy_config_generator_shared_1.DeploymentGenerator.logger);
241
+ await generateCAPConfig(this.appRouterAnswers, this.fs, DeploymentGenerator.logger);
246
242
  }
247
243
  // Step2. Append HTML5 app to MTA
248
- await (0, cf_deploy_config_writer_1.generateAppConfig)(this._getAppConfig(), this.fs, deploy_config_generator_shared_1.DeploymentGenerator.logger);
244
+ await generateAppConfig(this._getAppConfig(), this.fs, DeploymentGenerator.logger);
249
245
  }
250
246
  catch (error) {
251
247
  this.abort = true;
252
- (0, deploy_config_generator_shared_1.handleErrorMessage)(this.appWizard, { errorMsg: (0, utils_1.t)('cfGen.error.writing', { error }) });
248
+ handleErrorMessage(this.appWizard, { errorMsg: t('cfGen.error.writing', { error }) });
253
249
  }
254
250
  }
255
251
  /**
@@ -287,11 +283,11 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
287
283
  }
288
284
  }
289
285
  catch (error) {
290
- (0, deploy_config_generator_shared_1.handleErrorMessage)(this.appWizard, { errorMsg: (0, utils_1.t)('cfGen.error.install', { error: error.message }) });
286
+ handleErrorMessage(this.appWizard, { errorMsg: t('cfGen.error.install', { error: error.message }) });
291
287
  }
292
288
  }
293
289
  else {
294
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.info((0, utils_1.t)('cfGen.info.skippedInstallation'));
290
+ DeploymentGenerator.logger?.info(t('cfGen.info.skippedInstallation'));
295
291
  }
296
292
  }
297
293
  /**
@@ -300,7 +296,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
300
296
  * @param path - the path to run npm install
301
297
  */
302
298
  async _runNpmInstall(path) {
303
- const npm = (0, node_os_1.platform)() === 'win32' ? 'npm.cmd' : 'npm';
299
+ const npm = platform() === 'win32' ? 'npm.cmd' : 'npm';
304
300
  // install dependencies
305
301
  await this.spawnCommand(npm, ['install', '--no-audit', '--no-fund', '--silent', '--prefer-offline', '--no-progress'], {
306
302
  cwd: path
@@ -312,25 +308,27 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
312
308
  return;
313
309
  }
314
310
  if ((this.options.launchStandaloneFromYui || !this.launchDeployConfigAsSubGenerator) &&
315
- (0, fiori_generator_shared_1.isExtensionInstalled)(this.vscode, fiori_generator_shared_1.YUI_EXTENSION_ID, fiori_generator_shared_1.YUI_MIN_VER_FILES_GENERATED_MSG)) {
316
- this.appWizard?.showInformation((0, utils_1.t)('cfGen.info.filesGenerated'), yeoman_ui_types_1.MessageType.notification);
311
+ isExtensionInstalled(this.vscode, YUI_EXTENSION_ID, YUI_MIN_VER_FILES_GENERATED_MSG)) {
312
+ this.appWizard?.showInformation(t('cfGen.info.filesGenerated'), MessageType.notification);
317
313
  }
318
314
  await this._sendTelemetry();
319
315
  }
320
316
  catch (error) {
321
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.error((0, utils_1.t)('cfGen.error.end', { error }));
317
+ DeploymentGenerator.logger?.error(t('cfGen.error.end', { error }));
322
318
  }
323
319
  }
324
320
  async _sendTelemetry() {
325
- const telemetryData = fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
321
+ const telemetryData = TelemetryHelper.createTelemetryData({
326
322
  DeployTarget: 'CF',
327
323
  ManagedApprouter: this.answers.addManagedAppRouter,
328
324
  AppFrontendRouter: this.answers.addAppFrontendRouter,
329
325
  MTA: this.mtaPath ? 'true' : 'false',
330
326
  ...this.options.telemetryData
331
327
  }) ?? {};
332
- await (0, fiori_generator_shared_1.sendTelemetry)(telemetryEvents_1.EventName.DEPLOY_CONFIG, telemetryData, this.appPath);
328
+ await sendTelemetry(EventName.DEPLOY_CONFIG, telemetryData, this.appPath);
333
329
  }
334
330
  }
335
- exports.default = default_1;
331
+ export { getCFQuestions, loadManifest };
332
+ export { API_BUSINESS_HUB_ENTERPRISE_PREFIX, DESTINATION_AUTHTYPE_NOTFOUND };
333
+ export { ApiHubType } from '@sap-ux/cf-deploy-config-writer';
336
334
  //# sourceMappingURL=index.js.map
@@ -1,15 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCFQuestions = getCFQuestions;
4
- exports.getCAPMTAQuestions = getCAPMTAQuestions;
5
- const btp_utils_1 = require("@sap-ux/btp-utils");
6
- const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
7
- const project_access_1 = require("@sap-ux/project-access");
8
- const cf_deploy_config_inquirer_1 = require("@sap-ux/cf-deploy-config-inquirer");
9
- const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
10
- const utils_1 = require("./utils");
11
- const utils_2 = require("../utils");
12
- const inquirer_common_1 = require("@sap-ux/inquirer-common");
1
+ import { isAppStudio } from '@sap-ux/btp-utils';
2
+ import { DeploymentGenerator, getConfirmMtaContinuePrompt } from '@sap-ux/deploy-config-generator-shared';
3
+ import { getMtaPath } from '@sap-ux/project-access';
4
+ import { appRouterPromptNames, getAppRouterPrompts, getPrompts, promptNames } from '@sap-ux/cf-deploy-config-inquirer';
5
+ import { getHostEnvironment, hostEnvironment } from '@sap-ux/fiori-generator-shared';
6
+ import { destinationQuestionDefaultOption, getCFChoices } from './utils.js';
7
+ import { t } from '../utils/index.js';
8
+ import { withCondition } from '@sap-ux/inquirer-common';
13
9
  /**
14
10
  * Fetches the Cloud Foundry deployment configuration questions.
15
11
  *
@@ -23,10 +19,10 @@ const inquirer_common_1 = require("@sap-ux/inquirer-common");
23
19
  * @param options.promptOptions - additional prompt options.
24
20
  * @returns the cf deploy config questions.
25
21
  */
26
- async function getCFQuestions({ projectRoot, isAbapDirectServiceBinding, cfDestination, isCap, addOverwrite, apiHubConfig, promptOptions }) {
27
- const isBAS = (0, btp_utils_1.isAppStudio)();
28
- const mtaYamlExists = !!(await (0, project_access_1.getMtaPath)(projectRoot));
29
- const cfChoices = await (0, utils_1.getCFChoices)({
22
+ export async function getCFQuestions({ projectRoot, isAbapDirectServiceBinding, cfDestination, isCap, addOverwrite, apiHubConfig, promptOptions }) {
23
+ const isBAS = isAppStudio();
24
+ const mtaYamlExists = !!(await getMtaPath(projectRoot));
25
+ const cfChoices = await getCFChoices({
30
26
  projectRoot,
31
27
  isCap,
32
28
  cfDestination,
@@ -34,20 +30,20 @@ async function getCFQuestions({ projectRoot, isAbapDirectServiceBinding, cfDesti
34
30
  apiHubConfigType: apiHubConfig?.apiHubType
35
31
  });
36
32
  const options = {
37
- [cf_deploy_config_inquirer_1.promptNames.destinationName]: {
38
- defaultValue: (0, utils_1.destinationQuestionDefaultOption)(isAbapDirectServiceBinding, isBAS, cfDestination),
33
+ [promptNames.destinationName]: {
34
+ defaultValue: destinationQuestionDefaultOption(isAbapDirectServiceBinding, isBAS, cfDestination),
39
35
  hint: !!isAbapDirectServiceBinding,
40
- useAutocomplete: (0, fiori_generator_shared_1.getHostEnvironment)() === fiori_generator_shared_1.hostEnvironment.cli,
36
+ useAutocomplete: getHostEnvironment() === hostEnvironment.cli,
41
37
  addBTPDestinationList: isBAS ? !isAbapDirectServiceBinding : false,
42
38
  additionalChoiceList: cfChoices,
43
39
  ...promptOptions?.destinationName
44
40
  },
45
- [cf_deploy_config_inquirer_1.promptNames.addManagedAppRouter]: { hide: true, ...promptOptions?.addManagedAppRouter },
46
- [cf_deploy_config_inquirer_1.promptNames.routerType]: { hide: mtaYamlExists || isCap, ...promptOptions?.routerType },
47
- [cf_deploy_config_inquirer_1.promptNames.overwriteCfConfig]: { hide: !addOverwrite, ...promptOptions?.overwriteCfConfig }
41
+ [promptNames.addManagedAppRouter]: { hide: true, ...promptOptions?.addManagedAppRouter },
42
+ [promptNames.routerType]: { hide: mtaYamlExists || isCap, ...promptOptions?.routerType },
43
+ [promptNames.overwriteCfConfig]: { hide: !addOverwrite, ...promptOptions?.overwriteCfConfig }
48
44
  };
49
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_2.t)('cfGen.debug.promptOptions', { options: JSON.stringify(options) }));
50
- return (0, cf_deploy_config_inquirer_1.getPrompts)(options, deploy_config_generator_shared_1.DeploymentGenerator.logger);
45
+ DeploymentGenerator.logger?.debug(t('cfGen.debug.promptOptions', { options: JSON.stringify(options) }));
46
+ return getPrompts(options, DeploymentGenerator.logger);
51
47
  }
52
48
  /**
53
49
  * Retrieve the CF Approuter questions, certain prompts are restricted to support CAP project.
@@ -59,15 +55,15 @@ async function getCFQuestions({ projectRoot, isAbapDirectServiceBinding, cfDesti
59
55
  async function getCFApprouterQuestionsForCap({ projectRoot }) {
60
56
  // Disable some prompts, not required for CAP flow
61
57
  const appRouterPromptOptions = {
62
- [cf_deploy_config_inquirer_1.appRouterPromptNames.mtaPath]: projectRoot,
63
- [cf_deploy_config_inquirer_1.appRouterPromptNames.mtaId]: false, // CDS Flow will auto generate this based on the package.json name property
64
- [cf_deploy_config_inquirer_1.appRouterPromptNames.mtaDescription]: false,
65
- [cf_deploy_config_inquirer_1.appRouterPromptNames.mtaVersion]: false,
66
- [cf_deploy_config_inquirer_1.appRouterPromptNames.routerType]: true,
67
- [cf_deploy_config_inquirer_1.appRouterPromptNames.addConnectivityService]: true,
68
- [cf_deploy_config_inquirer_1.appRouterPromptNames.addABAPServiceBinding]: false
58
+ [appRouterPromptNames.mtaPath]: projectRoot,
59
+ [appRouterPromptNames.mtaId]: false, // CDS Flow will auto generate this based on the package.json name property
60
+ [appRouterPromptNames.mtaDescription]: false,
61
+ [appRouterPromptNames.mtaVersion]: false,
62
+ [appRouterPromptNames.routerType]: true,
63
+ [appRouterPromptNames.addConnectivityService]: true,
64
+ [appRouterPromptNames.addABAPServiceBinding]: false
69
65
  };
70
- return (0, cf_deploy_config_inquirer_1.getAppRouterPrompts)(appRouterPromptOptions);
66
+ return getAppRouterPrompts(appRouterPromptOptions);
71
67
  }
72
68
  /**
73
69
  * Generate CF Approuter questions for CAP project with an existing HTML5 app and missing MTA configuration.
@@ -76,13 +72,13 @@ async function getCFApprouterQuestionsForCap({ projectRoot }) {
76
72
  * @param options.projectRoot - the root path of the project.
77
73
  * @returns the cf approuter config questions, restricting prompts being shown to the user
78
74
  */
79
- async function getCAPMTAQuestions({ projectRoot }) {
75
+ export async function getCAPMTAQuestions({ projectRoot }) {
80
76
  // If launched as root generator, add a prompt to allow user decide if they want to add an MTA config
81
77
  let questions = (await getCFApprouterQuestionsForCap({
82
78
  projectRoot
83
79
  }));
84
- questions = (0, inquirer_common_1.withCondition)(questions, (answers) => answers.addCapMtaContinue === true);
85
- questions.unshift(...(0, deploy_config_generator_shared_1.getConfirmMtaContinuePrompt)());
80
+ questions = withCondition(questions, (answers) => answers.addCapMtaContinue === true);
81
+ questions.unshift(...getConfirmMtaContinuePrompt());
86
82
  return questions;
87
83
  }
88
84
  //# sourceMappingURL=questions.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
@@ -1,14 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCFChoices = getCFChoices;
4
- exports.destinationQuestionDefaultOption = destinationQuestionDefaultOption;
5
- exports.loadManifest = loadManifest;
6
- const btp_utils_1 = require("@sap-ux/btp-utils");
7
- const project_access_1 = require("@sap-ux/project-access");
8
- const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
9
- const cf_deploy_config_writer_1 = require("@sap-ux/cf-deploy-config-writer");
10
- const node_path_1 = require("node:path");
11
- const utils_1 = require("../utils");
1
+ import { isAppStudio } from '@sap-ux/btp-utils';
2
+ import { FileName, getMtaPath, getWebappPath } from '@sap-ux/project-access';
3
+ import { DeploymentGenerator, bail, ErrorHandler, ERROR_TYPE } from '@sap-ux/deploy-config-generator-shared';
4
+ import { ApiHubType, MtaConfig } from '@sap-ux/cf-deploy-config-writer';
5
+ import { join } from 'node:path';
6
+ import { t, DEFAULT_MTA_DESTINATION, DESTINATION_CHOICE_NONE, DESTINATION_CHOICE_DIRECT_SERVICE_BINDING } from '../utils/index.js';
12
7
  /**
13
8
  * Get the destination choices from API Hub | Local Store | mta.yaml.
14
9
  *
@@ -20,16 +15,16 @@ const utils_1 = require("../utils");
20
15
  * @param options.apiHubConfigType - the API Hub configuration.
21
16
  * @returns the cf deploy config questions.
22
17
  */
23
- async function getCFChoices({ projectRoot, isAbapDirectServiceBinding, cfDestination, isCap, apiHubConfigType }) {
18
+ export async function getCFChoices({ projectRoot, isAbapDirectServiceBinding, cfDestination, isCap, apiHubConfigType }) {
24
19
  let choices = [];
25
20
  const abapBindingChoice = [
26
21
  {
27
- name: (0, utils_1.t)('cfGen.prompts.abapBinding.name'),
28
- value: utils_1.DESTINATION_CHOICE_DIRECT_SERVICE_BINDING
22
+ name: t('cfGen.prompts.abapBinding.name'),
23
+ value: DESTINATION_CHOICE_DIRECT_SERVICE_BINDING
29
24
  }
30
25
  ];
31
26
  // If API Hub Enterprise configuration is used, return the CF destination
32
- if (apiHubConfigType === "API_HUB_ENTERPRISE" /* ApiHubType.apiHubEnterprise */) {
27
+ if (apiHubConfigType === ApiHubType.apiHubEnterprise) {
33
28
  choices = [
34
29
  {
35
30
  name: cfDestination,
@@ -38,7 +33,7 @@ async function getCFChoices({ projectRoot, isAbapDirectServiceBinding, cfDestina
38
33
  ];
39
34
  }
40
35
  else {
41
- const cfChoices = !isAbapDirectServiceBinding && (0, btp_utils_1.isAppStudio)()
36
+ const cfChoices = !isAbapDirectServiceBinding && isAppStudio()
42
37
  ? await getCFSystemChoices(projectRoot, isCap, cfDestination)
43
38
  : [];
44
39
  choices = isAbapDirectServiceBinding ? abapBindingChoice : cfChoices;
@@ -59,21 +54,21 @@ async function getCFSystemChoices(projectRoot, isCap, cfDestination) {
59
54
  let mtaDestinations = [];
60
55
  // Append mta destinations to support instance based destination flows
61
56
  if (isCap) {
62
- const mtaConfig = await cf_deploy_config_writer_1.MtaConfig.newInstance(projectRoot);
57
+ const mtaConfig = await MtaConfig.newInstance(projectRoot);
63
58
  mtaDestinations = mtaConfig.getExposedDestinations();
64
59
  if (mtaDestinations?.length) {
65
60
  // Add default option
66
61
  choices.push({
67
- name: (0, utils_1.t)('cfGen.prompts.capInstanceBasedDest.name'),
68
- value: utils_1.DEFAULT_MTA_DESTINATION
62
+ name: t('cfGen.prompts.capInstanceBasedDest.name'),
63
+ value: DEFAULT_MTA_DESTINATION
69
64
  });
70
65
  }
71
66
  }
72
67
  else {
73
- const mtaResult = await (0, project_access_1.getMtaPath)(projectRoot);
74
- const mtaDir = mtaResult?.mtaPath?.split(project_access_1.FileName.MtaYaml)[0];
68
+ const mtaResult = await getMtaPath(projectRoot);
69
+ const mtaDir = mtaResult?.mtaPath?.split(FileName.MtaYaml)[0];
75
70
  if (mtaDir) {
76
- const mtaConfig = await cf_deploy_config_writer_1.MtaConfig.newInstance(mtaDir);
71
+ const mtaConfig = await MtaConfig.newInstance(mtaDir);
77
72
  mtaDestinations = mtaConfig.getExposedDestinations(true);
78
73
  }
79
74
  }
@@ -82,17 +77,17 @@ async function getCFSystemChoices(projectRoot, isCap, cfDestination) {
82
77
  // Load additional destinations exposed by the mta.yaml
83
78
  mtaDestinations.forEach((dest) => {
84
79
  choices.push({
85
- name: (0, utils_1.t)('cfGen.prompts.instanceBasedDest.name', { destination: dest }),
80
+ name: t('cfGen.prompts.instanceBasedDest.name', { destination: dest }),
86
81
  value: dest
87
82
  });
88
83
  });
89
84
  }
90
85
  }
91
86
  catch (error) {
92
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('cfGen.error.mtaDestinations', { error }));
87
+ DeploymentGenerator.logger?.debug(t('cfGen.error.mtaDestinations', { error }));
93
88
  }
94
89
  if (!cfDestination) {
95
- choices.splice(0, 0, { name: (0, utils_1.t)('cfGen.prompts.none.name'), value: utils_1.DESTINATION_CHOICE_NONE });
90
+ choices.splice(0, 0, { name: t('cfGen.prompts.none.name'), value: DESTINATION_CHOICE_NONE });
96
91
  }
97
92
  return choices;
98
93
  }
@@ -104,7 +99,7 @@ async function getCFSystemChoices(projectRoot, isCap, cfDestination) {
104
99
  * @param cfDestination - The pre-configured Cloud Foundry destination (if available).
105
100
  * @returns {string} The default destination option.
106
101
  */
107
- function destinationQuestionDefaultOption(isAbapDirectServiceBinding, isBAS, cfDestination) {
102
+ export function destinationQuestionDefaultOption(isAbapDirectServiceBinding, isBAS, cfDestination) {
108
103
  let defaultDestination = '';
109
104
  if (!isBAS) {
110
105
  defaultDestination = cfDestination ?? '';
@@ -113,10 +108,10 @@ function destinationQuestionDefaultOption(isAbapDirectServiceBinding, isBAS, cfD
113
108
  defaultDestination = cfDestination;
114
109
  }
115
110
  else if (isAbapDirectServiceBinding) {
116
- defaultDestination = utils_1.DESTINATION_CHOICE_DIRECT_SERVICE_BINDING;
111
+ defaultDestination = DESTINATION_CHOICE_DIRECT_SERVICE_BINDING;
117
112
  }
118
113
  else if (isBAS) {
119
- defaultDestination = utils_1.DESTINATION_CHOICE_NONE;
114
+ defaultDestination = DESTINATION_CHOICE_NONE;
120
115
  }
121
116
  return defaultDestination;
122
117
  }
@@ -127,14 +122,14 @@ function destinationQuestionDefaultOption(isAbapDirectServiceBinding, isBAS, cfD
127
122
  * @param appPath - path to the project
128
123
  * @returns manifest object
129
124
  */
130
- async function loadManifest(fs, appPath) {
131
- const manifestPath = (0, node_path_1.join)(await (0, project_access_1.getWebappPath)(appPath), project_access_1.FileName.Manifest);
125
+ export async function loadManifest(fs, appPath) {
126
+ const manifestPath = join(await getWebappPath(appPath), FileName.Manifest);
132
127
  const manifest = fs.readJSON(manifestPath);
133
128
  if (!manifest) {
134
- (0, deploy_config_generator_shared_1.bail)(deploy_config_generator_shared_1.ErrorHandler.getErrorMsgFromType(deploy_config_generator_shared_1.ERROR_TYPE.NO_MANIFEST));
129
+ bail(ErrorHandler.getErrorMsgFromType(ERROR_TYPE.NO_MANIFEST));
135
130
  }
136
131
  if (!manifest['sap.app']?.id) {
137
- (0, deploy_config_generator_shared_1.bail)(deploy_config_generator_shared_1.ErrorHandler.getErrorMsgFromType(deploy_config_generator_shared_1.ERROR_TYPE.NO_APP_NAME));
132
+ bail(ErrorHandler.getErrorMsgFromType(ERROR_TYPE.NO_APP_NAME));
138
133
  }
139
134
  return manifest;
140
135
  }
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultMtaVersion = exports.prompts = exports.generatorTitle = void 0;
4
- exports.generatorTitle = 'Application Router Generator';
5
- exports.prompts = [
1
+ export const generatorTitle = 'Application Router Generator';
2
+ export const prompts = [
6
3
  {
7
4
  name: 'Application Router Configuration',
8
5
  description: 'Configure the Cloud Foundry application router'
9
6
  }
10
7
  ];
11
- exports.defaultMtaVersion = '0.0.1';
8
+ export const defaultMtaVersion = '0.0.1';
12
9
  //# sourceMappingURL=constants.js.map
@@ -1,5 +1,5 @@
1
1
  import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
2
- import type { CfApprouterGenOptions } from './types';
2
+ import type { CfApprouterGenOptions } from './types.js';
3
3
  /**
4
4
  * Generator for creating an application router.
5
5
  *
@@ -1,20 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_path_1 = require("node:path");
4
- const hasbin = require("hasbin");
5
- const node_os_1 = require("node:os");
6
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
7
- const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
8
- const cf_deploy_config_inquirer_1 = require("@sap-ux/cf-deploy-config-inquirer");
9
- const cf_deploy_config_writer_1 = require("@sap-ux/cf-deploy-config-writer");
10
- const utils_1 = require("../utils");
11
- const constants_1 = require("./constants");
1
+ import { join } from 'node:path';
2
+ import * as hasbin from 'hasbin';
3
+ import { platform } from 'node:os';
4
+ import { AppWizard, Prompts } from '@sap-devx/yeoman-ui-types';
5
+ import { DeploymentGenerator, ERROR_TYPE, handleErrorMessage, mtaExecutable } from '@sap-ux/deploy-config-generator-shared';
6
+ import { getAppRouterPrompts, appRouterPromptNames } from '@sap-ux/cf-deploy-config-inquirer';
7
+ import { generateBaseConfig } from '@sap-ux/cf-deploy-config-writer';
8
+ import { t, initI18n } from '../utils/index.js';
9
+ import { defaultMtaVersion, generatorTitle, prompts } from './constants.js';
12
10
  /**
13
11
  * Generator for creating an application router.
14
12
  *
15
13
  * @extends DeploymentGenerator
16
14
  */
17
- class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
15
+ export default class extends DeploymentGenerator {
18
16
  appWizard;
19
17
  prompts;
20
18
  answers;
@@ -28,10 +26,10 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
28
26
  */
29
27
  constructor(args, opts) {
30
28
  super(args, opts);
31
- this.appWizard = opts.appWizard ?? yeoman_ui_types_1.AppWizard.create(opts);
29
+ this.appWizard = opts.appWizard ?? AppWizard.create(opts);
32
30
  this.options = opts;
33
- this.appWizard.setHeaderTitle(constants_1.generatorTitle);
34
- this.prompts = new yeoman_ui_types_1.Prompts(constants_1.prompts);
31
+ this.appWizard.setHeaderTitle(generatorTitle);
32
+ this.prompts = new Prompts(prompts);
35
33
  this.setPromptsCallback = (fn) => {
36
34
  if (this.prompts) {
37
35
  this.prompts.setCallback(fn);
@@ -40,13 +38,13 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
40
38
  }
41
39
  async initializing() {
42
40
  await super.initializing();
43
- await (0, utils_1.initI18n)();
41
+ await initI18n();
44
42
  this._initFromProjectConfig();
45
43
  }
46
44
  _initFromProjectConfig() {
47
45
  // mta executable is required as mta-lib is used
48
- if (!hasbin.sync(deploy_config_generator_shared_1.mtaExecutable)) {
49
- (0, deploy_config_generator_shared_1.handleErrorMessage)(this.appWizard, { errorType: deploy_config_generator_shared_1.ERROR_TYPE.NO_MTA_BIN });
46
+ if (!hasbin.sync(mtaExecutable)) {
47
+ handleErrorMessage(this.appWizard, { errorType: ERROR_TYPE.NO_MTA_BIN });
50
48
  this.abort = true;
51
49
  }
52
50
  }
@@ -56,23 +54,23 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
56
54
  }
57
55
  // assign prompt options
58
56
  const appRouterPromptOptions = {
59
- [cf_deploy_config_inquirer_1.appRouterPromptNames.mtaPath]: this.destinationRoot() ?? process.cwd(),
60
- [cf_deploy_config_inquirer_1.appRouterPromptNames.mtaId]: true,
61
- [cf_deploy_config_inquirer_1.appRouterPromptNames.mtaDescription]: true,
62
- [cf_deploy_config_inquirer_1.appRouterPromptNames.mtaVersion]: false, // prompt switched off as 0.0.1 is written by default
63
- [cf_deploy_config_inquirer_1.appRouterPromptNames.routerType]: true,
64
- [cf_deploy_config_inquirer_1.appRouterPromptNames.addConnectivityService]: true,
65
- [cf_deploy_config_inquirer_1.appRouterPromptNames.addABAPServiceBinding]: true
57
+ [appRouterPromptNames.mtaPath]: this.destinationRoot() ?? process.cwd(),
58
+ [appRouterPromptNames.mtaId]: true,
59
+ [appRouterPromptNames.mtaDescription]: true,
60
+ [appRouterPromptNames.mtaVersion]: false, // prompt switched off as 0.0.1 is written by default
61
+ [appRouterPromptNames.routerType]: true,
62
+ [appRouterPromptNames.addConnectivityService]: true,
63
+ [appRouterPromptNames.addABAPServiceBinding]: true
66
64
  };
67
- const prompts = await (0, cf_deploy_config_inquirer_1.getAppRouterPrompts)(appRouterPromptOptions);
65
+ const prompts = await getAppRouterPrompts(appRouterPromptOptions);
68
66
  this.answers = await this.prompt(prompts);
69
67
  }
70
68
  async writing() {
71
69
  if (this.abort) {
72
70
  return;
73
71
  }
74
- this.destinationRoot((0, node_path_1.join)(this.answers.mtaPath, this.answers.mtaId));
75
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('appRouterGen.debug.projectPath', { destinationPath: this.destinationRoot() }));
72
+ this.destinationRoot(join(this.answers.mtaPath, this.answers.mtaId));
73
+ DeploymentGenerator.logger?.debug(t('appRouterGen.debug.projectPath', { destinationPath: this.destinationRoot() }));
76
74
  let abapServiceProvider;
77
75
  if (this.answers.addABAPServiceBinding) {
78
76
  abapServiceProvider = {
@@ -87,16 +85,16 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
87
85
  mtaId: this.answers.mtaId,
88
86
  mtaPath: this.destinationRoot(),
89
87
  mtaDescription: this.answers.mtaDescription,
90
- mtaVersion: constants_1.defaultMtaVersion
88
+ mtaVersion: defaultMtaVersion
91
89
  };
92
- await (0, cf_deploy_config_writer_1.generateBaseConfig)(cfBaseConfig, this.fs, deploy_config_generator_shared_1.DeploymentGenerator.logger);
90
+ await generateBaseConfig(cfBaseConfig, this.fs, DeploymentGenerator.logger);
93
91
  }
94
92
  install() {
95
93
  this._install();
96
94
  }
97
95
  _install() {
98
96
  if (!this.abort && !this.options.skipInstall) {
99
- const npm = (0, node_os_1.platform)() === 'win32' ? 'npm.cmd' : 'npm';
97
+ const npm = platform() === 'win32' ? 'npm.cmd' : 'npm';
100
98
  // install dependencies in project root
101
99
  this.spawnCommand(npm, ['install', '--no-audit', '--no-fund', '--silent', '--prefer-offline', '--no-progress'], {
102
100
  cwd: this.destinationRoot()
@@ -104,5 +102,4 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
104
102
  }
105
103
  }
106
104
  }
107
- exports.default = default_1;
108
105
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventName = void 0;
4
- var EventName;
1
+ export var EventName;
5
2
  (function (EventName) {
6
3
  EventName["DEPLOY_CONFIG"] = "DEPLOY_CONFIG";
7
- })(EventName || (exports.EventName = EventName = {}));
4
+ })(EventName || (EventName = {}));
8
5
  //# sourceMappingURL=index.js.map
@@ -24,6 +24,9 @@
24
24
  "install": "An error occurred in the install phase: {{- error}}",
25
25
  "end": "An error occurred in the end phase: {{- error}}"
26
26
  },
27
+ "warn": {
28
+ "fullUrlDestination": "The deployment destination is configured as a full URL destination. The deployed app may not render correctly. See SAP Guided Answers for migration instructions: https://ga.support.sap.com/index.html#/tree/3046/actions/45995:52881:52892:68172"
29
+ },
27
30
  "debug": {
28
31
  "promptOptions": "Retrieving CF prompts using: \n {{- options}}",
29
32
  "initTelemetry": "Initializing telemetry in CF deployment configuration generator...",
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DESTINATION_CHOICE_DIRECT_SERVICE_BINDING = exports.DESTINATION_CHOICE_NONE = exports.DESTINATION_AUTHTYPE_NOTFOUND = exports.DEFAULT_MTA_DESTINATION = exports.API_BUSINESS_HUB_ENTERPRISE_PREFIX = void 0;
4
- exports.API_BUSINESS_HUB_ENTERPRISE_PREFIX = 'ABHE';
5
- exports.DEFAULT_MTA_DESTINATION = 'fiori-default-srv-api';
6
- exports.DESTINATION_AUTHTYPE_NOTFOUND = 'NotAvailable';
7
- exports.DESTINATION_CHOICE_NONE = 'NONE';
8
- exports.DESTINATION_CHOICE_DIRECT_SERVICE_BINDING = 'DIRECT_SERVICE_BINDING';
1
+ export const API_BUSINESS_HUB_ENTERPRISE_PREFIX = 'ABHE';
2
+ export const DEFAULT_MTA_DESTINATION = 'fiori-default-srv-api';
3
+ export const DESTINATION_AUTHTYPE_NOTFOUND = 'NotAvailable';
4
+ export const DESTINATION_CHOICE_NONE = 'NONE';
5
+ export const DESTINATION_CHOICE_DIRECT_SERVICE_BINDING = 'DIRECT_SERVICE_BINDING';
9
6
  //# sourceMappingURL=constants.js.map
@@ -1,27 +1,19 @@
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.i18n = void 0;
7
- exports.initI18n = initI18n;
8
- exports.t = t;
9
- const i18next_1 = __importDefault(require("i18next"));
10
- const cf_deploy_config_sub_generator_i18n_json_1 = __importDefault(require("../translations/cf-deploy-config-sub-generator.i18n.json"));
11
- const inquirer_common_1 = require("@sap-ux/inquirer-common");
1
+ import i18next from 'i18next';
2
+ import translations from '../translations/cf-deploy-config-sub-generator.i18n.json' with { type: 'json' };
3
+ import { addi18nResourceBundle as addInquirerCommonTexts } from '@sap-ux/inquirer-common';
12
4
  const cfAppRouterGenNs = 'cf-deploy-config-generator';
13
- exports.i18n = i18next_1.default.createInstance();
5
+ export const i18n = i18next.createInstance();
14
6
  /**
15
7
  * Initialize i18next with the translations for this module.
16
8
  */
17
- async function initI18n() {
18
- await exports.i18n.init({
9
+ export async function initI18n() {
10
+ await i18n.init({
19
11
  lng: 'en',
20
12
  fallbackLng: 'en',
21
13
  showSupportNotice: false
22
14
  });
23
- exports.i18n.addResourceBundle('en', cfAppRouterGenNs, cf_deploy_config_sub_generator_i18n_json_1.default);
24
- (0, inquirer_common_1.addi18nResourceBundle)();
15
+ i18n.addResourceBundle('en', cfAppRouterGenNs, translations);
16
+ addInquirerCommonTexts();
25
17
  }
26
18
  /**
27
19
  * Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
@@ -30,13 +22,11 @@ async function initI18n() {
30
22
  * @param options additional options
31
23
  * @returns {string} localized string stored for the given key
32
24
  */
33
- function t(key, options) {
25
+ export function t(key, options) {
34
26
  if (!options?.ns) {
35
27
  options = Object.assign(options ?? {}, { ns: cfAppRouterGenNs });
36
28
  }
37
- return exports.i18n.t(key, options);
29
+ return i18n.t(key, options);
38
30
  }
39
- initI18n().catch(() => {
40
- // Needed for lint
41
- });
31
+ void initI18n().catch(() => undefined);
42
32
  //# sourceMappingURL=i18n.js.map
@@ -1,3 +1,3 @@
1
- export * from './constants';
2
- export * from './i18n';
1
+ export * from './constants.js';
2
+ export * from './i18n.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,19 +1,3 @@
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("./constants"), exports);
18
- __exportStar(require("./i18n"), exports);
1
+ export * from './constants.js';
2
+ export * from './i18n.js';
19
3
  //# sourceMappingURL=index.js.map
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.3.6",
4
+ "version": "1.0.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -10,6 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue"
12
12
  },
13
+ "type": "module",
13
14
  "license": "Apache-2.0",
14
15
  "main": "generators/app/index.js",
15
16
  "files": [
@@ -23,16 +24,17 @@
23
24
  "hasbin": "1.2.3",
24
25
  "i18next": "25.10.10",
25
26
  "yeoman-generator": "5.10.0",
26
- "@sap-ux/btp-utils": "1.2.1",
27
- "@sap-ux/cf-deploy-config-writer": "0.4.4",
28
- "@sap-ux/cf-deploy-config-inquirer": "0.6.6",
29
- "@sap-ux/deploy-config-generator-shared": "0.2.6",
30
- "@sap-ux/feature-toggle": "0.4.0",
31
- "@sap-ux/fiori-generator-shared": "0.15.6",
32
- "@sap-ux/inquirer-common": "0.13.5",
33
- "@sap-ux/project-access": "1.38.1"
27
+ "@sap-ux/btp-utils": "2.0.0",
28
+ "@sap-ux/cf-deploy-config-writer": "1.0.0",
29
+ "@sap-ux/cf-deploy-config-inquirer": "1.0.0",
30
+ "@sap-ux/deploy-config-generator-shared": "1.0.0",
31
+ "@sap-ux/feature-toggle": "1.0.0",
32
+ "@sap-ux/fiori-generator-shared": "1.0.0",
33
+ "@sap-ux/inquirer-common": "1.0.0",
34
+ "@sap-ux/project-access": "2.0.0"
34
35
  },
35
36
  "devDependencies": {
37
+ "@jest/globals": "30.3.0",
36
38
  "@types/hasbin": "1.2.2",
37
39
  "@types/inquirer": "8.2.6",
38
40
  "@types/js-yaml": "4.0.9",
@@ -45,7 +47,7 @@
45
47
  "rimraf": "6.1.3",
46
48
  "unionfs": "4.6.0",
47
49
  "yeoman-test": "6.3.0",
48
- "@sap-ux/logger": "0.9.0"
50
+ "@sap-ux/logger": "1.0.0"
49
51
  },
50
52
  "engines": {
51
53
  "node": ">=22.x"
@@ -56,8 +58,8 @@
56
58
  "watch": "tsc --watch",
57
59
  "lint": "eslint",
58
60
  "lint:fix": "eslint --fix",
59
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
60
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
61
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
62
+ "test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
61
63
  "link": "pnpm link --global",
62
64
  "unlink": "pnpm unlink --global"
63
65
  }