@sap-ux/abap-deploy-config-sub-generator 0.4.11 → 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,5 +1,5 @@
1
1
  import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
2
- import type { AbapDeployConfigOptions } from './types';
2
+ import type { AbapDeployConfigOptions } from './types.js';
3
3
  import type { AbapDeployConfigAnswersInternal, AbapDeployConfigQuestion } from '@sap-ux/abap-deploy-config-inquirer';
4
4
  /**
5
5
  * ABAP deploy config generator.
@@ -46,8 +46,8 @@ export default class extends DeploymentGenerator {
46
46
  end(): Promise<void>;
47
47
  }
48
48
  export { AbapDeployConfigQuestion, AbapDeployConfigAnswersInternal };
49
- export { getAbapQuestions } from './questions';
50
- export { indexHtmlExists } from '../utils';
51
- export { AbapDeployConfigOptions, DeployProjectType } from './types';
52
- export { AbapDeployConfigPromptOptions } from '@sap-ux/abap-deploy-config-inquirer';
49
+ export { getAbapQuestions } from './questions.js';
50
+ export { indexHtmlExists } from '../utils/index.js';
51
+ export { type AbapDeployConfigOptions, DeployProjectType } from './types.js';
52
+ export type { AbapDeployConfigPromptOptions } from '@sap-ux/abap-deploy-config-inquirer';
53
53
  //# sourceMappingURL=index.d.ts.map
@@ -1,29 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeployProjectType = exports.indexHtmlExists = exports.getAbapQuestions = void 0;
4
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
5
- const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
6
- const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
7
- const abap_deploy_config_inquirer_1 = require("@sap-ux/abap-deploy-config-inquirer");
8
- const abap_deploy_config_writer_1 = require("@sap-ux/abap-deploy-config-writer");
9
- const ui5_config_1 = require("@sap-ux/ui5-config");
10
- const project_access_1 = require("@sap-ux/project-access");
11
- const store_1 = require("@sap-ux/store");
12
- const utils_1 = require("../utils");
13
- const questions_1 = require("./questions");
14
- const telemetryEvents_1 = require("../telemetryEvents");
15
- const types_1 = require("./types");
16
- const i18n_1 = require("../utils/i18n");
17
- const feature_toggle_1 = require("@sap-ux/feature-toggle");
18
- const btp_utils_1 = require("@sap-ux/btp-utils");
19
- const constants_1 = require("@sap-ux/abap-deploy-config-inquirer/dist/constants");
20
- const project_1 = require("../utils/project");
21
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
22
- const axios_extension_1 = require("@sap-ux/axios-extension");
1
+ import { AppWizard, MessageType } from '@sap-devx/yeoman-ui-types';
2
+ import { DeploymentGenerator, ERROR_TYPE, ErrorHandler, showOverwriteQuestion } from '@sap-ux/deploy-config-generator-shared';
3
+ import { isExtensionInstalled, YUI_EXTENSION_ID, YUI_MIN_VER_FILES_GENERATED_MSG, sendTelemetry, TelemetryHelper, setYeomanEnvConflicterForce } from '@sap-ux/fiori-generator-shared';
4
+ import { getPackageAnswer, getTransportAnswer, reconcileAnswers, DEFAULT_PACKAGE_ABAP } from '@sap-ux/abap-deploy-config-inquirer';
5
+ import { generate as generateAbapDeployConfig } from '@sap-ux/abap-deploy-config-writer';
6
+ import { UI5Config } from '@sap-ux/ui5-config';
7
+ import { FileName, getAppType } from '@sap-ux/project-access';
8
+ import { AuthenticationType } from '@sap-ux/store';
9
+ import { t, handleProjectDoesNotExist, indexHtmlExists, determineScpFromTarget, determineUrlFromDestination, determineS4HCFromTarget } from '../utils/index.js';
10
+ import { getAbapQuestions } from './questions.js';
11
+ import { EventName } from '../telemetryEvents/index.js';
12
+ import { DeployProjectType } from './types.js';
13
+ import { initI18n } from '../utils/i18n.js';
14
+ import { isInternalFeaturesSettingEnabled } from '@sap-ux/feature-toggle';
15
+ import { isAppStudio } from '@sap-ux/btp-utils';
16
+ import { getVariantNamespace } from '../utils/project.js';
17
+ import { getExistingAdpProjectType } from '@sap-ux/adp-tooling';
18
+ import { AdaptationProjectType } from '@sap-ux/axios-extension';
23
19
  /**
24
20
  * ABAP deploy config generator.
25
21
  */
26
- class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
22
+ export default class extends DeploymentGenerator {
27
23
  appWizard;
28
24
  vscode;
29
25
  launchDeployConfigAsSubGenerator;
@@ -47,63 +43,63 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
47
43
  this.launchDeployConfigAsSubGenerator = opts.launchDeployConfigAsSubGenerator ?? false;
48
44
  this.launchStandaloneFromYui = opts.launchStandaloneFromYui;
49
45
  this.adpProjectType = opts.adpProjectType;
50
- this.appWizard = opts.appWizard || yeoman_ui_types_1.AppWizard.create(opts);
46
+ this.appWizard = opts.appWizard || AppWizard.create(opts);
51
47
  this.vscode = opts.vscode;
52
48
  this.options = opts;
53
49
  }
54
50
  async initializing() {
55
51
  await super.initializing();
56
- await (0, i18n_1.initI18n)();
57
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.initTelemetry'));
58
- await fiori_generator_shared_1.TelemetryHelper.initTelemetrySettings({
52
+ await initI18n();
53
+ DeploymentGenerator.logger?.debug(t('debug.initTelemetry'));
54
+ await TelemetryHelper.initTelemetrySettings({
59
55
  consumerModule: {
60
56
  name: '@sap-ux/abap-deploy-config-sub-generator',
61
57
  version: this.rootGeneratorVersion()
62
58
  },
63
- internalFeature: (0, feature_toggle_1.isInternalFeaturesSettingEnabled)(),
59
+ internalFeature: isInternalFeaturesSettingEnabled(),
64
60
  watchTelemetrySettingStore: false
65
61
  });
66
- (0, fiori_generator_shared_1.setYeomanEnvConflicterForce)(this.env, this.options.force);
62
+ setYeomanEnvConflicterForce(this.env, this.options.force);
67
63
  if (!this.launchDeployConfigAsSubGenerator) {
68
64
  await this._initializing();
69
65
  // NOTE: This _initializing() method is called here when the generator is started as standalone generator.
70
66
  // In the writing phase the same method is called when the generator is started as a sub-generator.
71
67
  // This casues the adpProjectType field to be overriden with undefined in case the generator is started as
72
68
  // sub-generator, that's why we leave the initialization out of the _initializing() method.
73
- this.adpProjectType = await (0, adp_tooling_1.getExistingAdpProjectType)(this.destinationRoot());
69
+ this.adpProjectType = await getExistingAdpProjectType(this.destinationRoot());
74
70
  }
75
71
  }
76
72
  _initDestinationRoot() {
77
73
  if (this.options.appRootPath) {
78
74
  this.destinationRoot(this.options.appRootPath);
79
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.appRootPath', { appRootPath: this.options.appRootPath }));
75
+ DeploymentGenerator.logger?.debug(t('debug.appRootPath', { appRootPath: this.options.appRootPath }));
80
76
  }
81
77
  }
82
78
  _processProjectConfig() {
83
- this.options.base = this.options.base || project_access_1.FileName.Ui5Yaml;
84
- this.options.config = this.options.config || project_access_1.FileName.UI5DeployYaml;
79
+ this.options.base = this.options.base || FileName.Ui5Yaml;
80
+ this.options.config = this.options.config || FileName.UI5DeployYaml;
85
81
  // check base exists
86
82
  const baseExists = this.fs.exists(this.destinationPath(this.options.base));
87
83
  if (!baseExists) {
88
84
  this.abort = true;
89
- (0, utils_1.handleProjectDoesNotExist)(this.appWizard, this.destinationPath(this.options.base));
85
+ handleProjectDoesNotExist(this.appWizard, this.destinationPath(this.options.base));
90
86
  }
91
87
  // check config exists
92
88
  this.configExists = this.fs.exists(this.destinationPath(this.options.config));
93
89
  if (this.configExists) {
94
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.configExists', { configPath: this.destinationPath(this.options.config) }));
90
+ DeploymentGenerator.logger?.debug(t('debug.configExists', { configPath: this.destinationPath(this.options.config) }));
95
91
  }
96
92
  }
97
93
  async _processIndexHtmlConfig() {
98
- if (this.projectType === types_1.DeployProjectType.Library) {
94
+ if (this.projectType === DeployProjectType.Library) {
99
95
  this.indexGenerationAllowed = false;
100
96
  }
101
97
  else {
102
- const htmlIndexExists = await (0, utils_1.indexHtmlExists)(this.fs, this.destinationPath());
98
+ const htmlIndexExists = await indexHtmlExists(this.fs, this.destinationPath());
103
99
  if (htmlIndexExists) {
104
100
  this.indexGenerationAllowed = false;
105
101
  if (this.options.index) {
106
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.indexExists'));
102
+ DeploymentGenerator.logger?.debug(t('debug.indexExists'));
107
103
  }
108
104
  delete this.options.index;
109
105
  }
@@ -113,9 +109,9 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
113
109
  }
114
110
  }
115
111
  async _initBackendConfig() {
116
- const ui5Config = await ui5_config_1.UI5Config.newInstance(this.fs.read(this.destinationPath(this.options.base ?? project_access_1.FileName.Ui5Yaml)));
112
+ const ui5Config = await UI5Config.newInstance(this.fs.read(this.destinationPath(this.options.base ?? FileName.Ui5Yaml)));
117
113
  this.projectType =
118
- ui5Config.getType() === 'library' ? types_1.DeployProjectType.Library : types_1.DeployProjectType.Application;
114
+ ui5Config.getType() === 'library' ? DeployProjectType.Library : DeployProjectType.Application;
119
115
  this.backendConfig = ui5Config.getBackendConfigsFromFioriToolsProxyMiddleware()[0];
120
116
  }
121
117
  async _initializing() {
@@ -126,8 +122,8 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
126
122
  await this._processIndexHtmlConfig();
127
123
  }
128
124
  catch (e) {
129
- if (e === deploy_config_generator_shared_1.ERROR_TYPE.ABORT_SIGNAL) {
130
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.initFailed', { error: deploy_config_generator_shared_1.ErrorHandler.getErrorMsgFromType(deploy_config_generator_shared_1.ERROR_TYPE.ABORT_SIGNAL) }));
125
+ if (e === ERROR_TYPE.ABORT_SIGNAL) {
126
+ DeploymentGenerator.logger?.debug(t('debug.initFailed', { error: ErrorHandler.getErrorMsgFromType(ERROR_TYPE.ABORT_SIGNAL) }));
131
127
  }
132
128
  else {
133
129
  throw e;
@@ -140,14 +136,14 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
140
136
  return;
141
137
  }
142
138
  if (!this.launchDeployConfigAsSubGenerator) {
143
- const appType = await (0, project_access_1.getAppType)(this.destinationPath());
139
+ const appType = await getAppType(this.destinationPath());
144
140
  this.isAdp = appType === 'Fiori Adaptation';
145
141
  const packageAdditionalValidation = {
146
142
  shouldValidatePackageForStartingPrefix: this.isAdp,
147
143
  shouldValidatePackageType: this.isAdp,
148
144
  shouldValidateFormatAndSpecialCharacters: this.isAdp
149
145
  };
150
- const hideIfOnPremise = this.adpProjectType === axios_extension_1.AdaptationProjectType.ON_PREMISE;
146
+ const hideIfOnPremise = this.adpProjectType === AdaptationProjectType.ON_PREMISE;
151
147
  const promptOptions = {
152
148
  ui5AbapRepo: { hideIfOnPremise },
153
149
  transportInputChoice: { hideIfOnPremise },
@@ -160,32 +156,32 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
160
156
  adpProjectType: this.adpProjectType
161
157
  };
162
158
  const indexGenerationAllowed = this.indexGenerationAllowed && !this.isAdp;
163
- const { prompts: abapDeployConfigPrompts, answers: abapAnswers = {} } = await (0, questions_1.getAbapQuestions)({
159
+ const { prompts: abapDeployConfigPrompts, answers: abapAnswers = {} } = await getAbapQuestions({
164
160
  appRootPath: this.destinationRoot(),
165
161
  connectedSystem: this.options.connectedSystem,
166
162
  backendConfig: this.backendConfig,
167
163
  configFile: this.options.config,
168
164
  indexGenerationAllowed,
169
- showOverwriteQuestion: (0, deploy_config_generator_shared_1.showOverwriteQuestion)(this.launchDeployConfigAsSubGenerator, this.launchStandaloneFromYui, this.options.overwrite, this.configExists),
165
+ showOverwriteQuestion: showOverwriteQuestion(this.launchDeployConfigAsSubGenerator, this.launchStandaloneFromYui, this.options.overwrite, this.configExists),
170
166
  projectType: this.projectType,
171
- logger: deploy_config_generator_shared_1.DeploymentGenerator.logger,
167
+ logger: DeploymentGenerator.logger,
172
168
  promptOptions
173
169
  });
174
170
  const prompAnswers = await this.prompt(abapDeployConfigPrompts);
175
- this.answers = (0, abap_deploy_config_inquirer_1.reconcileAnswers)(prompAnswers, abapAnswers);
171
+ this.answers = reconcileAnswers(prompAnswers, abapAnswers);
176
172
  }
177
173
  await this._reconcileAnswersWithOptions();
178
174
  }
179
175
  async _processAbapTargetAnswers() {
180
176
  this.answers.destination = this.options.destination || this.answers.destination;
181
177
  this.answers.url =
182
- this.options.url || this.answers.url || (await (0, utils_1.determineUrlFromDestination)(this.answers.destination));
178
+ this.options.url || this.answers.url || (await determineUrlFromDestination(this.answers.destination));
183
179
  this.answers.connectPath = this.options.connectPath || this.answers.connectPath;
184
180
  this.answers.client = this.options.client || this.answers.client;
185
181
  this.answers.scp =
186
182
  this.options.scp ||
187
183
  this.answers.scp ||
188
- (await (0, utils_1.determineScpFromTarget)({
184
+ (await determineScpFromTarget({
189
185
  url: this.answers.url,
190
186
  client: this.answers.client,
191
187
  destination: this.answers.destination
@@ -193,12 +189,12 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
193
189
  this.answers.isAbapCloud =
194
190
  this.options.isAbapCloud ||
195
191
  this.answers.isAbapCloud ||
196
- (await (0, utils_1.determineS4HCFromTarget)({
192
+ (await determineS4HCFromTarget({
197
193
  url: this.answers.url,
198
194
  client: this.answers.client,
199
195
  destination: this.answers.destination
200
196
  }));
201
- if (!(0, btp_utils_1.isAppStudio)() && this.answers.scp) {
197
+ if (!isAppStudio() && this.answers.scp) {
202
198
  // ensure there is no client for SCP on vscode
203
199
  delete this.answers.client;
204
200
  }
@@ -209,16 +205,16 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
209
205
  // Set package
210
206
  if (!this.answers.package) {
211
207
  this.answers.package =
212
- (0, abap_deploy_config_inquirer_1.getPackageAnswer)(this.options, this.options.package) ||
213
- (0, abap_deploy_config_inquirer_1.getPackageAnswer)(this.answers) ||
214
- (this.answers.scp ? '' : constants_1.DEFAULT_PACKAGE_ABAP);
208
+ getPackageAnswer(this.options, this.options.package) ||
209
+ getPackageAnswer(this.answers) ||
210
+ (this.answers.scp ? '' : DEFAULT_PACKAGE_ABAP);
215
211
  }
216
212
  // Set transport
217
213
  if (!this.answers.transport) {
218
214
  this.answers.transport =
219
215
  this.options.transport ??
220
- ((0, abap_deploy_config_inquirer_1.getTransportAnswer)(this.options) ||
221
- (0, abap_deploy_config_inquirer_1.getTransportAnswer)(this.answers));
216
+ (getTransportAnswer(this.options) ||
217
+ getTransportAnswer(this.answers));
222
218
  }
223
219
  }
224
220
  /**
@@ -246,16 +242,16 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
246
242
  if (this.abort || this.answers.overwrite === false) {
247
243
  return;
248
244
  }
249
- const isCloudAdpProject = this.adpProjectType === axios_extension_1.AdaptationProjectType.CLOUD_READY;
250
- const namespace = await (0, project_1.getVariantNamespace)(this.destinationPath(), isCloudAdpProject, this.fs);
251
- await (0, abap_deploy_config_writer_1.generate)(this.destinationPath(), {
245
+ const isCloudAdpProject = this.adpProjectType === AdaptationProjectType.CLOUD_READY;
246
+ const namespace = await getVariantNamespace(this.destinationPath(), isCloudAdpProject, this.fs);
247
+ await generateAbapDeployConfig(this.destinationPath(), {
252
248
  target: {
253
249
  url: this.answers.url,
254
250
  connectPath: this.answers.connectPath,
255
251
  client: this.answers.client,
256
252
  scp: this.answers.scp,
257
253
  destination: this.answers.destination,
258
- authenticationType: this.answers.isAbapCloud ? store_1.AuthenticationType.ReentranceTicket : undefined
254
+ authenticationType: this.answers.isAbapCloud ? AuthenticationType.ReentranceTicket : undefined
259
255
  },
260
256
  app: {
261
257
  name: this.answers.ui5AbapRepo,
@@ -288,7 +284,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
288
284
  ]);
289
285
  }
290
286
  else {
291
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.info((0, utils_1.t)('info.skippedInstallation'));
287
+ DeploymentGenerator.logger?.info(t('info.skippedInstallation'));
292
288
  }
293
289
  }
294
290
  async end() {
@@ -296,23 +292,19 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
296
292
  return;
297
293
  }
298
294
  if (this.launchStandaloneFromYui &&
299
- (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)) {
300
- this.appWizard?.showInformation((0, utils_1.t)('info.filesGenerated'), yeoman_ui_types_1.MessageType.notification);
295
+ isExtensionInstalled(this.vscode, YUI_EXTENSION_ID, YUI_MIN_VER_FILES_GENERATED_MSG)) {
296
+ this.appWizard?.showInformation(t('info.filesGenerated'), MessageType.notification);
301
297
  }
302
298
  // Send telemetry data after adding deployment configuration
303
- (0, fiori_generator_shared_1.sendTelemetry)(telemetryEvents_1.EventName.DEPLOY_CONFIG, fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
299
+ sendTelemetry(EventName.DEPLOY_CONFIG, TelemetryHelper.createTelemetryData({
304
300
  DeployTarget: 'ABAP',
305
301
  ...this.options.telemetryData
306
302
  }) ?? {}, this.destinationRoot())?.catch((error) => {
307
- deploy_config_generator_shared_1.DeploymentGenerator.logger.error((0, utils_1.t)('error.telemetry', { error }));
303
+ DeploymentGenerator.logger.error(t('error.telemetry', { error }));
308
304
  });
309
305
  }
310
306
  }
311
- exports.default = default_1;
312
- var questions_2 = require("./questions");
313
- Object.defineProperty(exports, "getAbapQuestions", { enumerable: true, get: function () { return questions_2.getAbapQuestions; } });
314
- var utils_2 = require("../utils");
315
- Object.defineProperty(exports, "indexHtmlExists", { enumerable: true, get: function () { return utils_2.indexHtmlExists; } });
316
- var types_2 = require("./types");
317
- Object.defineProperty(exports, "DeployProjectType", { enumerable: true, get: function () { return types_2.DeployProjectType; } });
307
+ export { getAbapQuestions } from './questions.js';
308
+ export { indexHtmlExists } from '../utils/index.js';
309
+ export { DeployProjectType } from './types.js';
318
310
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { DeployProjectType } from './types';
1
+ import { DeployProjectType } from './types.js';
2
2
  import type { ILogWrapper } from '@sap-ux/fiori-generator-shared';
3
3
  import type { AbapDeployConfigAnswersInternal, AbapDeployConfigPromptOptions, AbapDeployConfigQuestion } from '@sap-ux/abap-deploy-config-inquirer';
4
4
  import type { FioriToolsProxyConfigBackend } from '@sap-ux/ui5-config';
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAbapQuestions = getAbapQuestions;
4
- const abap_deploy_config_inquirer_1 = require("@sap-ux/abap-deploy-config-inquirer");
5
- const project_access_1 = require("@sap-ux/project-access");
6
- const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
7
- const btp_utils_1 = require("@sap-ux/btp-utils");
8
- const constants_1 = require("../utils/constants");
9
- const types_1 = require("./types");
1
+ import { getPrompts } from '@sap-ux/abap-deploy-config-inquirer';
2
+ import { FileName, readUi5Yaml } from '@sap-ux/project-access';
3
+ import { getHostEnvironment, hostEnvironment } from '@sap-ux/fiori-generator-shared';
4
+ import { isAppStudio } from '@sap-ux/btp-utils';
5
+ import { ABAP_DEPLOY_TASK } from '../utils/constants.js';
6
+ import { DeployProjectType } from './types.js';
10
7
  /**
11
8
  * Get the ABAP target based on the provided parameters.
12
9
  *
@@ -18,7 +15,7 @@ const types_1 = require("./types");
18
15
  */
19
16
  function getAbapTarget(destination, backendSystem, existingAbapDeployTask, backendConfig) {
20
17
  let url, scp, client, destinationName, authenticationType, connectPath;
21
- if ((0, btp_utils_1.isAppStudio)() && destination) {
18
+ if (isAppStudio() && destination) {
22
19
  // the destination used during app generation
23
20
  destinationName = destination.Name;
24
21
  }
@@ -78,12 +75,12 @@ function getAbapTarget(destination, backendSystem, existingAbapDeployTask, backe
78
75
  * @param params.promptOptions - A set of optional feature flags to prompts behavior.
79
76
  * @returns - the prompts and answers
80
77
  */
81
- async function getAbapQuestions({ appRootPath, connectedSystem, backendConfig, configFile = project_access_1.FileName.UI5DeployYaml, indexGenerationAllowed = false, showOverwriteQuestion = false, projectType = types_1.DeployProjectType.Application, promptOptions = {}, logger }) {
78
+ export async function getAbapQuestions({ appRootPath, connectedSystem, backendConfig, configFile = FileName.UI5DeployYaml, indexGenerationAllowed = false, showOverwriteQuestion = false, projectType = DeployProjectType.Application, promptOptions = {}, logger }) {
82
79
  const { backendSystem, serviceProvider, destination } = connectedSystem || {};
83
80
  let existingAbapDeployTask;
84
81
  try {
85
- const ui5DeployConfig = await (0, project_access_1.readUi5Yaml)(appRootPath, configFile);
86
- existingAbapDeployTask = ui5DeployConfig.findCustomTask(constants_1.ABAP_DEPLOY_TASK)?.configuration;
82
+ const ui5DeployConfig = await readUi5Yaml(appRootPath, configFile);
83
+ existingAbapDeployTask = ui5DeployConfig.findCustomTask(ABAP_DEPLOY_TASK)?.configuration;
87
84
  }
88
85
  catch {
89
86
  // not an issue if the file does not exist
@@ -93,7 +90,7 @@ async function getAbapQuestions({ appRootPath, connectedSystem, backendConfig, c
93
90
  logger?.debug(`Retrieve ABAP prompts using: \n App path: ${appRootPath},
94
91
  ABAPTarget: ${JSON.stringify(abapTarget)}, SystemName: ${backendSystem?.name},
95
92
  ServiceProvider: ${!!serviceProvider}, showOverwriteQuestion ${showOverwriteQuestion}, indexGenerationAllowed ${indexGenerationAllowed}`);
96
- return (0, abap_deploy_config_inquirer_1.getPrompts)({
93
+ return getPrompts({
97
94
  backendTarget: {
98
95
  abapTarget,
99
96
  systemName: backendSystem?.name,
@@ -118,6 +115,6 @@ async function getAbapQuestions({ appRootPath, connectedSystem, backendConfig, c
118
115
  },
119
116
  overwriteAbapConfig: { hide: !showOverwriteQuestion },
120
117
  transportInputChoice: { hideIfOnPremise: promptOptions?.transportInputChoice?.hideIfOnPremise ?? false }
121
- }, logger, (0, fiori_generator_shared_1.getHostEnvironment)() !== fiori_generator_shared_1.hostEnvironment.cli);
118
+ }, logger, getHostEnvironment() !== hostEnvironment.cli);
122
119
  }
123
120
  //# sourceMappingURL=questions.js.map
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeployProjectType = void 0;
4
- var DeployProjectType;
1
+ export var DeployProjectType;
5
2
  (function (DeployProjectType) {
6
3
  DeployProjectType["Application"] = "application";
7
4
  DeployProjectType["Library"] = "library";
8
- })(DeployProjectType || (exports.DeployProjectType = DeployProjectType = {}));
5
+ })(DeployProjectType || (DeployProjectType = {}));
9
6
  //# sourceMappingURL=types.js.map
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventName = void 0;
4
1
  /**
5
2
  * Event names for telemetry for the abap deploy config generator
6
3
  */
7
- var EventName;
4
+ export var EventName;
8
5
  (function (EventName) {
9
6
  EventName["DEPLOY_CONFIG"] = "DEPLOY_CONFIG";
10
- })(EventName || (exports.EventName = EventName = {}));
7
+ })(EventName || (EventName = {}));
11
8
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ABAP_DEPLOY_TASK = void 0;
4
- exports.ABAP_DEPLOY_TASK = 'deploy-to-abap';
1
+ export const ABAP_DEPLOY_TASK = 'deploy-to-abap';
5
2
  //# sourceMappingURL=constants.js.map
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleProjectDoesNotExist = handleProjectDoesNotExist;
4
- const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
1
+ import { ErrorHandler, ERROR_TYPE, handleErrorMessage } from '@sap-ux/deploy-config-generator-shared';
5
2
  /**
6
3
  * Handle the case where the project does not exist.
7
4
  *
8
5
  * @param appWizard - the appWizard instance
9
6
  * @param path - the path that does not exist
10
7
  */
11
- function handleProjectDoesNotExist(appWizard, path) {
12
- const errorMsg = deploy_config_generator_shared_1.ErrorHandler.fileDoesNotExist(path);
13
- (0, deploy_config_generator_shared_1.handleErrorMessage)(appWizard, { errorMsg });
14
- throw deploy_config_generator_shared_1.ERROR_TYPE.ABORT_SIGNAL;
8
+ export function handleProjectDoesNotExist(appWizard, path) {
9
+ const errorMsg = ErrorHandler.fileDoesNotExist(path);
10
+ handleErrorMessage(appWizard, { errorMsg });
11
+ throw ERROR_TYPE.ABORT_SIGNAL;
15
12
  }
16
13
  //# sourceMappingURL=error-handler.js.map
@@ -1,11 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.determineUrlFromDestination = determineUrlFromDestination;
4
- exports.determineScpFromTarget = determineScpFromTarget;
5
- exports.determineS4HCFromTarget = determineS4HCFromTarget;
6
- const btp_utils_1 = require("@sap-ux/btp-utils");
7
- const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
8
- const store_1 = require("@sap-ux/store");
1
+ import { isAbapEnvironmentOnBtp, isAppStudio, listDestinations, isS4HC } from '@sap-ux/btp-utils';
2
+ import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
3
+ import { AuthenticationType, getService } from '@sap-ux/store';
9
4
  let cachedDestinations = {};
10
5
  let cachedBackendSystems = [];
11
6
  /**
@@ -27,10 +22,10 @@ function isSameSystem(backend, target) {
27
22
  async function getDestinations() {
28
23
  if (Object.keys(cachedDestinations)?.length === 0) {
29
24
  try {
30
- cachedDestinations = await (0, btp_utils_1.listDestinations)({ stripS4HCApiHosts: true });
25
+ cachedDestinations = await listDestinations({ stripS4HCApiHosts: true });
31
26
  }
32
27
  catch (e) {
33
- deploy_config_generator_shared_1.DeploymentGenerator.logger.error(`Failed to fetch destinations. Error: ${e.message}`);
28
+ DeploymentGenerator.logger.error(`Failed to fetch destinations. Error: ${e.message}`);
34
29
  }
35
30
  }
36
31
  return cachedDestinations;
@@ -43,14 +38,14 @@ async function getDestinations() {
43
38
  async function getBackendSystems() {
44
39
  if (cachedBackendSystems?.length === 0) {
45
40
  try {
46
- const systemStore = await (0, store_1.getService)({
47
- logger: deploy_config_generator_shared_1.DeploymentGenerator.logger,
41
+ const systemStore = await getService({
42
+ logger: DeploymentGenerator.logger,
48
43
  entityName: 'system'
49
44
  });
50
45
  cachedBackendSystems = await systemStore?.getAll();
51
46
  }
52
47
  catch (e) {
53
- deploy_config_generator_shared_1.DeploymentGenerator.logger.error(`Failed to fetch systems list. Error: ${e.message}`);
48
+ DeploymentGenerator.logger.error(`Failed to fetch systems list. Error: ${e.message}`);
54
49
  }
55
50
  }
56
51
  return cachedBackendSystems;
@@ -61,9 +56,9 @@ async function getBackendSystems() {
61
56
  * @param destination - the destination name
62
57
  * @returns the URL of the destination or undefined if not found
63
58
  */
64
- async function determineUrlFromDestination(destination) {
59
+ export async function determineUrlFromDestination(destination) {
65
60
  let url;
66
- if ((0, btp_utils_1.isAppStudio)() && destination) {
61
+ if (isAppStudio() && destination) {
67
62
  const destinations = await getDestinations();
68
63
  url = destinations?.[destination]?.Host;
69
64
  }
@@ -75,12 +70,12 @@ async function determineUrlFromDestination(destination) {
75
70
  * @param target - abap target containing either a destination or a URL
76
71
  * @returns - true if the target is a cloud system, false otherwise
77
72
  */
78
- async function determineScpFromTarget(target) {
73
+ export async function determineScpFromTarget(target) {
79
74
  let isScp = false;
80
- if ((0, btp_utils_1.isAppStudio)() && target.destination) {
75
+ if (isAppStudio() && target.destination) {
81
76
  const destinations = await getDestinations();
82
77
  if (destinations?.[target.destination]) {
83
- isScp = (0, btp_utils_1.isAbapEnvironmentOnBtp)(destinations?.[target.destination]);
78
+ isScp = isAbapEnvironmentOnBtp(destinations?.[target.destination]);
84
79
  }
85
80
  }
86
81
  else if (target.url) {
@@ -96,18 +91,18 @@ async function determineScpFromTarget(target) {
96
91
  * @param target - abap target containing either a destination or a URL
97
92
  * @returns - true if the target is an s4hana cloud system, false otherwise
98
93
  */
99
- async function determineS4HCFromTarget(target) {
94
+ export async function determineS4HCFromTarget(target) {
100
95
  let isAbapCloud = false;
101
- if ((0, btp_utils_1.isAppStudio)() && target.destination) {
96
+ if (isAppStudio() && target.destination) {
102
97
  const destinations = await getDestinations();
103
98
  if (destinations?.[target.destination]) {
104
- isAbapCloud = (0, btp_utils_1.isS4HC)(destinations?.[target.destination]);
99
+ isAbapCloud = isS4HC(destinations?.[target.destination]);
105
100
  }
106
101
  }
107
102
  else if (target.url) {
108
103
  const backendSystems = await getBackendSystems();
109
104
  const backendSystem = backendSystems?.find((backend) => isSameSystem(backend, target));
110
- isAbapCloud = backendSystem?.authenticationType === store_1.AuthenticationType.ReentranceTicket;
105
+ isAbapCloud = backendSystem?.authenticationType === AuthenticationType.ReentranceTicket;
111
106
  }
112
107
  return isAbapCloud;
113
108
  }
@@ -1,25 +1,17 @@
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 abap_deploy_config_sub_generator_i18n_json_1 = __importDefault(require("../translations/abap-deploy-config-sub-generator.i18n.json"));
1
+ import i18next from 'i18next';
2
+ import translations from '../translations/abap-deploy-config-sub-generator.i18n.json' with { type: 'json' };
11
3
  const abapDeployGenI18nNamespace = 'abap-deploy-config-sub-generator';
12
- exports.i18n = i18next_1.default.createInstance();
4
+ export const i18n = i18next.createInstance();
13
5
  /**
14
6
  * Initialize i18next with the translations for this module.
15
7
  */
16
- async function initI18n() {
17
- await exports.i18n.init({
8
+ export async function initI18n() {
9
+ await i18n.init({
18
10
  lng: 'en',
19
11
  fallbackLng: 'en',
20
12
  showSupportNotice: false
21
13
  });
22
- exports.i18n.addResourceBundle('en', abapDeployGenI18nNamespace, abap_deploy_config_sub_generator_i18n_json_1.default);
14
+ i18n.addResourceBundle('en', abapDeployGenI18nNamespace, translations);
23
15
  }
24
16
  /**
25
17
  * Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
@@ -28,13 +20,11 @@ async function initI18n() {
28
20
  * @param options additional options
29
21
  * @returns {string} localized string stored for the given key
30
22
  */
31
- function t(key, options) {
23
+ export function t(key, options) {
32
24
  if (!options?.ns) {
33
25
  options = Object.assign(options ?? {}, { ns: abapDeployGenI18nNamespace });
34
26
  }
35
- return exports.i18n.t(key, options);
27
+ return i18n.t(key, options);
36
28
  }
37
- initI18n().catch(() => {
38
- // Needed for lint
39
- });
29
+ void initI18n().catch(() => undefined);
40
30
  //# sourceMappingURL=i18n.js.map
@@ -1,5 +1,5 @@
1
- export { indexHtmlExists } from './project';
2
- export { handleProjectDoesNotExist } from './error-handler';
3
- export { t } from './i18n';
4
- export { determineScpFromTarget, determineUrlFromDestination, determineS4HCFromTarget } from './helpers';
1
+ export { indexHtmlExists } from './project.js';
2
+ export { handleProjectDoesNotExist } from './error-handler.js';
3
+ export { t } from './i18n.js';
4
+ export { determineScpFromTarget, determineUrlFromDestination, determineS4HCFromTarget } from './helpers.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,14 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.determineS4HCFromTarget = exports.determineUrlFromDestination = exports.determineScpFromTarget = exports.t = exports.handleProjectDoesNotExist = exports.indexHtmlExists = void 0;
4
- var project_1 = require("./project");
5
- Object.defineProperty(exports, "indexHtmlExists", { enumerable: true, get: function () { return project_1.indexHtmlExists; } });
6
- var error_handler_1 = require("./error-handler");
7
- Object.defineProperty(exports, "handleProjectDoesNotExist", { enumerable: true, get: function () { return error_handler_1.handleProjectDoesNotExist; } });
8
- var i18n_1 = require("./i18n");
9
- Object.defineProperty(exports, "t", { enumerable: true, get: function () { return i18n_1.t; } });
10
- var helpers_1 = require("./helpers");
11
- Object.defineProperty(exports, "determineScpFromTarget", { enumerable: true, get: function () { return helpers_1.determineScpFromTarget; } });
12
- Object.defineProperty(exports, "determineUrlFromDestination", { enumerable: true, get: function () { return helpers_1.determineUrlFromDestination; } });
13
- Object.defineProperty(exports, "determineS4HCFromTarget", { enumerable: true, get: function () { return helpers_1.determineS4HCFromTarget; } });
1
+ export { indexHtmlExists } from './project.js';
2
+ export { handleProjectDoesNotExist } from './error-handler.js';
3
+ export { t } from './i18n.js';
4
+ export { determineScpFromTarget, determineUrlFromDestination, determineS4HCFromTarget } from './helpers.js';
14
5
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.indexHtmlExists = indexHtmlExists;
4
- exports.getVariantNamespace = getVariantNamespace;
5
- const project_access_1 = require("@sap-ux/project-access");
6
- const node_path_1 = require("node:path");
7
- const i18n_1 = require("./i18n");
8
- const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
1
+ import { FileName, getWebappPath } from '@sap-ux/project-access';
2
+ import { join } from 'node:path';
3
+ import { t } from './i18n.js';
4
+ import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
9
5
  /**
10
6
  * Checks if index.html exists in Fiori project's custom webapp folder path.
11
7
  *
@@ -13,9 +9,9 @@ const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generato
13
9
  * @param path - the project path
14
10
  * @returns true if index.html exists
15
11
  */
16
- async function indexHtmlExists(fs, path) {
17
- const customWebappPath = await (0, project_access_1.getWebappPath)(path);
18
- const indexHtmlPath = (0, node_path_1.join)(customWebappPath, 'index.html');
12
+ export async function indexHtmlExists(fs, path) {
13
+ const customWebappPath = await getWebappPath(path);
14
+ const indexHtmlPath = join(customWebappPath, 'index.html');
19
15
  return fs.exists(indexHtmlPath);
20
16
  }
21
17
  /**
@@ -27,19 +23,19 @@ async function indexHtmlExists(fs, path) {
27
23
  * @param fs - The file system editor.
28
24
  * @returns The variant namespace.
29
25
  */
30
- async function getVariantNamespace(path, isS4HC, fs) {
26
+ export async function getVariantNamespace(path, isS4HC, fs) {
31
27
  if (isS4HC) {
32
28
  return undefined;
33
29
  }
34
30
  try {
35
- const filePath = (0, node_path_1.join)(await (0, project_access_1.getWebappPath)(path, fs), project_access_1.FileName.ManifestAppDescrVar);
31
+ const filePath = join(await getWebappPath(path, fs), FileName.ManifestAppDescrVar);
36
32
  if (fs.exists(filePath)) {
37
33
  const descriptor = fs.readJSON(filePath);
38
34
  return descriptor.namespace;
39
35
  }
40
36
  }
41
37
  catch (e) {
42
- deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, i18n_1.t)('debug.lrepNamespaceNotFound', { error: e.message }));
38
+ DeploymentGenerator.logger?.debug(t('debug.lrepNamespaceNotFound', { error: e.message }));
43
39
  }
44
40
  return undefined;
45
41
  }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@sap-ux/abap-deploy-config-sub-generator",
3
3
  "description": "Sub generator for ABAP deployment configuration",
4
+ "type": "module",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/SAP/open-ux-tools.git",
7
8
  "directory": "packages/abap-deploy-config-sub-generator"
8
9
  },
9
- "version": "0.4.11",
10
+ "version": "1.0.0",
10
11
  "license": "Apache-2.0",
11
12
  "main": "generators/app/index.js",
12
13
  "files": [
@@ -21,39 +22,41 @@
21
22
  "dependencies": {
22
23
  "i18next": "25.10.10",
23
24
  "@sap-devx/yeoman-ui-types": "1.25.0",
24
- "@sap-ux/abap-deploy-config-inquirer": "1.9.7",
25
- "@sap-ux/abap-deploy-config-writer": "0.4.4",
26
- "@sap-ux/btp-utils": "1.2.1",
27
- "@sap-ux/deploy-config-generator-shared": "0.2.6",
28
- "@sap-ux/feature-toggle": "0.4.0",
29
- "@sap-ux/fiori-generator-shared": "0.15.6",
30
- "@sap-ux/logger": "0.9.0",
31
- "@sap-ux/project-access": "1.38.1",
32
- "@sap-ux/ui5-config": "0.31.1",
33
- "@sap-ux/adp-tooling": "0.19.11",
34
- "@sap-ux/axios-extension": "1.26.1"
25
+ "@sap-ux/abap-deploy-config-inquirer": "2.0.0",
26
+ "@sap-ux/abap-deploy-config-writer": "1.0.0",
27
+ "@sap-ux/btp-utils": "2.0.0",
28
+ "@sap-ux/deploy-config-generator-shared": "1.0.0",
29
+ "@sap-ux/feature-toggle": "1.0.0",
30
+ "@sap-ux/fiori-generator-shared": "1.0.0",
31
+ "@sap-ux/logger": "1.0.0",
32
+ "@sap-ux/project-access": "2.0.0",
33
+ "@sap-ux/ui5-config": "1.0.0",
34
+ "@sap-ux/adp-tooling": "1.0.0",
35
+ "@sap-ux/axios-extension": "2.0.0"
35
36
  },
36
37
  "devDependencies": {
38
+ "@jest/globals": "30.3.0",
37
39
  "@types/mem-fs": "1.1.2",
38
40
  "@types/mem-fs-editor": "7.0.1",
39
41
  "@types/yeoman-test": "4.0.6",
40
42
  "memfs": "3.4.13",
41
43
  "mem-fs-editor": "9.4.0",
44
+ "rimraf": "6.1.3",
42
45
  "unionfs": "4.6.0",
43
46
  "yeoman-test": "6.3.0",
44
- "@sap-ux/store": "1.6.1",
45
- "@sap-ux/system-access": "0.8.2",
46
- "@sap-ux/telemetry": "0.7.5"
47
+ "@sap-ux/store": "2.0.0",
48
+ "@sap-ux/system-access": "1.0.0",
49
+ "@sap-ux/telemetry": "1.0.0"
47
50
  },
48
51
  "scripts": {
49
52
  "build": "tsc --build",
50
53
  "watch": "tsc --watch",
51
- "clean": "rimraf --glob generators test/test-output coverage *.tsbuildinfo",
54
+ "clean": "rimraf --glob generators 'test/test-output*' coverage *.tsbuildinfo",
52
55
  "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
53
56
  "lint": "eslint",
54
57
  "lint:fix": "eslint --fix",
55
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
56
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
58
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
59
+ "test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
57
60
  "link": "pnpm link --global",
58
61
  "unlink": "pnpm unlink --global"
59
62
  }