@sap-ux/generator-adp 0.10.12 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/generators/add-annotations-to-odata/index.d.ts +3 -3
  2. package/generators/add-annotations-to-odata/index.js +15 -19
  3. package/generators/add-component-usages/index.d.ts +3 -3
  4. package/generators/add-component-usages/index.js +16 -20
  5. package/generators/add-new-model/index.d.ts +3 -3
  6. package/generators/add-new-model/index.js +24 -28
  7. package/generators/app/extension-project/index.d.ts +1 -1
  8. package/generators/app/extension-project/index.js +6 -9
  9. package/generators/app/index.d.ts +1 -1
  10. package/generators/app/index.js +129 -135
  11. package/generators/app/layer.js +5 -7
  12. package/generators/app/questions/attributes.d.ts +2 -2
  13. package/generators/app/questions/attributes.js +60 -65
  14. package/generators/app/questions/cf-services.js +48 -52
  15. package/generators/app/questions/configuration.d.ts +3 -3
  16. package/generators/app/questions/configuration.js +125 -129
  17. package/generators/app/questions/helper/additional-messages.js +29 -36
  18. package/generators/app/questions/helper/choices.js +16 -25
  19. package/generators/app/questions/helper/conditions.js +14 -23
  20. package/generators/app/questions/helper/default-values.js +8 -13
  21. package/generators/app/questions/helper/message.js +7 -11
  22. package/generators/app/questions/helper/tooltip.js +4 -7
  23. package/generators/app/questions/helper/validators.js +29 -39
  24. package/generators/app/questions/key-user.d.ts +1 -1
  25. package/generators/app/questions/key-user.js +40 -45
  26. package/generators/app/questions/target-env.d.ts +2 -2
  27. package/generators/app/questions/target-env.js +22 -27
  28. package/generators/app/types.js +13 -16
  29. package/generators/base/questions/credentials.d.ts +1 -1
  30. package/generators/base/questions/credentials.js +15 -18
  31. package/generators/base/sub-gen-auth-base.d.ts +3 -3
  32. package/generators/base/sub-gen-auth-base.js +24 -30
  33. package/generators/base/sub-gen-base.d.ts +5 -6
  34. package/generators/base/sub-gen-base.js +11 -17
  35. package/generators/change-data-source/index.d.ts +3 -3
  36. package/generators/change-data-source/index.js +8 -12
  37. package/generators/telemetry/collector.d.ts +1 -1
  38. package/generators/telemetry/collector.js +6 -10
  39. package/generators/telemetry/events.js +2 -5
  40. package/generators/telemetry/index.d.ts +2 -2
  41. package/generators/telemetry/index.js +2 -18
  42. package/generators/types.js +2 -5
  43. package/generators/utils/appWizardCache.d.ts +1 -1
  44. package/generators/utils/appWizardCache.js +7 -13
  45. package/generators/utils/deps.js +10 -45
  46. package/generators/utils/i18n.js +13 -23
  47. package/generators/utils/logger.js +4 -7
  48. package/generators/utils/opts.js +3 -6
  49. package/generators/utils/parse-json-input.d.ts +1 -1
  50. package/generators/utils/parse-json-input.js +5 -9
  51. package/generators/utils/steps.d.ts +1 -1
  52. package/generators/utils/steps.js +37 -48
  53. package/generators/utils/subgenHelpers.js +9 -14
  54. package/generators/utils/templates.js +7 -8
  55. package/generators/utils/type-guards.d.ts +1 -1
  56. package/generators/utils/type-guards.js +2 -6
  57. package/generators/utils/workspace.js +7 -13
  58. package/package.json +19 -17
@@ -1,46 +1,41 @@
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
- const node_fs_1 = __importDefault(require("node:fs"));
7
- const node_path_1 = require("node:path");
8
- const yeoman_generator_1 = __importDefault(require("yeoman-generator"));
9
- const uuid_1 = require("uuid");
10
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
11
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
12
- const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
13
- const logger_1 = require("@sap-ux/logger");
14
- const axios_extension_1 = require("@sap-ux/axios-extension");
15
- const feature_toggle_1 = require("@sap-ux/feature-toggle");
16
- const appWizardCache_1 = require("../utils/appWizardCache");
17
- const deps_1 = require("../utils/deps");
18
- const i18n_1 = require("../utils/i18n");
19
- const logger_2 = __importDefault(require("../utils/logger"));
20
- const opts_1 = require("../utils/opts");
21
- const parse_json_input_1 = require("../utils/parse-json-input");
22
- const telemetry_1 = require("../telemetry");
23
- const steps_1 = require("../utils/steps");
24
- const subgenHelpers_1 = require("../utils/subgenHelpers");
25
- const templates_1 = require("../utils/templates");
26
- const workspace_1 = require("../utils/workspace");
27
- const layer_1 = require("./layer");
28
- const attributes_1 = require("./questions/attributes");
29
- const cf_services_1 = require("./questions/cf-services");
30
- const configuration_1 = require("./questions/configuration");
31
- const default_values_1 = require("./questions/helper/default-values");
32
- const validators_1 = require("./questions/helper/validators");
33
- const types_1 = require("./types");
34
- const target_env_1 = require("./questions/target-env");
35
- const key_user_1 = require("./questions/key-user");
36
- const telemetry_2 = require("@sap-ux/telemetry");
1
+ import fs from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import Generator from 'yeoman-generator';
4
+ import { v4 as uuidv4 } from 'uuid';
5
+ import { AppWizard, MessageType, Prompts as YeomanUiSteps } from '@sap-devx/yeoman-ui-types';
6
+ import { FlexLayer, SourceManifest, SupportedProject, SystemLookup, fetchPublicVersions, generate, generateCf, getCfBaseAppInbounds, getCfConfig, getConfig, getConfiguredProvider, getSupportedProject, getFormattedVersion, getLatestVersion, getYamlContent, isCfInstalled, isLoggedInCf, isMtaProject, loadApps, loadCfConfig, storeCredentials, getOrCreateServiceInstanceKeys } from '@sap-ux/adp-tooling';
7
+ import { getDefaultTargetFolder, isCli, isExtensionInstalled, sendTelemetry, setYeomanEnvConflicterForce, TelemetryHelper } from '@sap-ux/fiori-generator-shared';
8
+ import { ToolsLogger } from '@sap-ux/logger';
9
+ import { AdaptationProjectType } from '@sap-ux/axios-extension';
10
+ import { isInternalFeaturesSettingEnabled, isFeatureEnabled } from '@sap-ux/feature-toggle';
11
+ import { cacheClear, cacheGet, cachePut, initCache } from '../utils/appWizardCache.js';
12
+ import { getPackageInfo, installDependencies } from '../utils/deps.js';
13
+ import { initI18n, t } from '../utils/i18n.js';
14
+ import AdpGeneratorLogger from '../utils/logger.js';
15
+ import { setHeaderTitle } from '../utils/opts.js';
16
+ import { getFirstArgAsString, parseJsonInput } from '../utils/parse-json-input.js';
17
+ import { TelemetryCollector, EventName } from '../telemetry/index.js';
18
+ import { getDeployPage, getWizardPages, updateCfWizardSteps, updateFlpWizardSteps, updateWizardSteps, getKeyUserImportPage } from '../utils/steps.js';
19
+ import { addDeployGen, addExtProjectGen, addFlpGen } from '../utils/subgenHelpers.js';
20
+ import { getTemplatesOverwritePath } from '../utils/templates.js';
21
+ import { existsInWorkspace, handleWorkspaceFolderChoice, showWorkspaceFolderWarning } from '../utils/workspace.js';
22
+ import { getFlexLayer } from './layer.js';
23
+ import { getPrompts } from './questions/attributes.js';
24
+ import { CFServicesPrompter } from './questions/cf-services.js';
25
+ import { ConfigPrompter } from './questions/configuration.js';
26
+ import { getDefaultNamespace, getDefaultProjectName } from './questions/helper/default-values.js';
27
+ import { validateJsonInput } from './questions/helper/validators.js';
28
+ import { TargetEnv } from './types.js';
29
+ import { getProjectPathPrompt, getTargetEnvPrompt } from './questions/target-env.js';
30
+ import { KeyUserImportPrompter } from './questions/key-user.js';
31
+ import { initTelemetrySettings } from '@sap-ux/telemetry';
37
32
  const generatorTitle = 'Adaptation Project';
38
33
  /**
39
34
  * Generator for creating an Adaptation Project.
40
35
  *
41
36
  * @extends Generator
42
37
  */
43
- class default_1 extends yeoman_generator_1.default {
38
+ export default class extends Generator {
44
39
  setPromptsCallback;
45
40
  appWizard;
46
41
  vscode;
@@ -163,24 +158,24 @@ class default_1 extends yeoman_generator_1.default {
163
158
  */
164
159
  constructor(args, opts) {
165
160
  super(args, opts);
166
- this.appWizard = opts.appWizard ?? yeoman_ui_types_1.AppWizard.create(opts);
161
+ this.appWizard = opts.appWizard ?? AppWizard.create(opts);
167
162
  this.shouldInstallDeps = opts.shouldInstallDeps ?? true;
168
- this.toolsLogger = new logger_1.ToolsLogger();
163
+ this.toolsLogger = new ToolsLogger();
169
164
  this.vscode = opts.vscode;
170
165
  this._setupLogging();
171
166
  this.options = opts;
172
- this.isMtaYamlFound = (0, adp_tooling_1.isMtaProject)(process.cwd());
173
- this.isCfFeatureEnabled = (0, feature_toggle_1.isFeatureEnabled)('sap.ux.appGenerator.testBetaFeatures.adpCfExperimental');
167
+ this.isMtaYamlFound = isMtaProject(process.cwd());
168
+ this.isCfFeatureEnabled = isFeatureEnabled('sap.ux.appGenerator.testBetaFeatures.adpCfExperimental');
174
169
  this.logger.debug(`isCfFeatureEnabled: ${this.isCfFeatureEnabled}`);
175
- const jsonInputString = (0, parse_json_input_1.getFirstArgAsString)(args);
176
- this.jsonInput = (0, parse_json_input_1.parseJsonInput)(jsonInputString, this.logger);
170
+ const jsonInputString = getFirstArgAsString(args);
171
+ this.jsonInput = parseJsonInput(jsonInputString, this.logger);
177
172
  if (!this.jsonInput) {
178
173
  this.env.lookup({
179
174
  packagePatterns: ['@sap/generator-fiori', '@bas-dev/generator-extensibility-sub']
180
175
  });
181
- (0, opts_1.setHeaderTitle)(opts, this.logger, generatorTitle);
182
- (0, appWizardCache_1.initCache)(this.logger, this.appWizard);
183
- this.prompts = new yeoman_ui_types_1.Prompts([]);
176
+ setHeaderTitle(opts, this.logger, generatorTitle);
177
+ initCache(this.logger, this.appWizard);
178
+ this.prompts = new YeomanUiSteps([]);
184
179
  this.setPromptsCallback = (fn) => {
185
180
  if (this.prompts) {
186
181
  this.prompts.setCallback(fn);
@@ -190,18 +185,18 @@ class default_1 extends yeoman_generator_1.default {
190
185
  }
191
186
  async initializing() {
192
187
  // Force the generator to overwrite existing files without additional prompting
193
- (0, fiori_generator_shared_1.setYeomanEnvConflicterForce)(this.env, this.options.force);
194
- await (0, i18n_1.initI18n)();
195
- this.isCli = (0, fiori_generator_shared_1.isCli)();
196
- this.layer = (0, layer_1.getFlexLayer)();
197
- this.isCustomerBase = this.layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
198
- this.systemLookup = new adp_tooling_1.SystemLookup(this.logger);
199
- this.cfInstalled = await (0, adp_tooling_1.isCfInstalled)(this.logger);
200
- this.cfConfig = (0, adp_tooling_1.loadCfConfig)(this.logger);
201
- this.isCfLoggedIn = await (0, adp_tooling_1.isLoggedInCf)(this.cfConfig, this.logger);
188
+ setYeomanEnvConflicterForce(this.env, this.options.force);
189
+ await initI18n();
190
+ this.isCli = isCli();
191
+ this.layer = getFlexLayer();
192
+ this.isCustomerBase = this.layer === FlexLayer.CUSTOMER_BASE;
193
+ this.systemLookup = new SystemLookup(this.logger);
194
+ this.cfInstalled = await isCfInstalled(this.logger);
195
+ this.cfConfig = loadCfConfig(this.logger);
196
+ this.isCfLoggedIn = await isLoggedInCf(this.cfConfig, this.logger);
202
197
  this.logger.info(`isCfInstalled: ${this.cfInstalled}`);
203
- const isInternalUsage = (0, feature_toggle_1.isInternalFeaturesSettingEnabled)();
204
- await (0, telemetry_2.initTelemetrySettings)({
198
+ const isInternalUsage = isInternalFeaturesSettingEnabled();
199
+ await initTelemetrySettings({
205
200
  consumerModule: {
206
201
  name: '@sap/generator-fiori:generator-adp',
207
202
  version: this.rootGeneratorVersion()
@@ -209,12 +204,12 @@ class default_1 extends yeoman_generator_1.default {
209
204
  internalFeature: isInternalUsage,
210
205
  watchTelemetrySettingStore: false
211
206
  });
212
- this.telemetryCollector = new telemetry_1.TelemetryCollector();
207
+ this.telemetryCollector = new TelemetryCollector();
213
208
  if (!this.jsonInput) {
214
209
  const shouldShowTargetEnv = this.cfInstalled && this.isCfFeatureEnabled;
215
- this.prompts.splice(0, 0, (0, steps_1.getWizardPages)(shouldShowTargetEnv));
210
+ this.prompts.splice(0, 0, getWizardPages(shouldShowTargetEnv));
216
211
  this.prompter = this._getOrCreatePrompter();
217
- this.cfPrompter = new cf_services_1.CFServicesPrompter(isInternalUsage, this.isCfLoggedIn, this.logger);
212
+ this.cfPrompter = new CFServicesPrompter(isInternalUsage, this.isCfLoggedIn, this.logger);
218
213
  }
219
214
  }
220
215
  async prompting() {
@@ -226,10 +221,10 @@ class default_1 extends yeoman_generator_1.default {
226
221
  await this._promptForCfEnvironment();
227
222
  }
228
223
  else {
229
- const isExtensibilityExtInstalled = (0, fiori_generator_shared_1.isExtensionInstalled)(this.vscode, 'SAP.vscode-bas-extensibility');
224
+ const isExtensibilityExtInstalled = isExtensionInstalled(this.vscode, 'SAP.vscode-bas-extensibility');
230
225
  const configQuestions = this.prompter.getPrompts({
231
226
  projectType: {
232
- default: axios_extension_1.AdaptationProjectType.CLOUD_READY
227
+ default: AdaptationProjectType.CLOUD_READY
233
228
  },
234
229
  projectTypeCli: { hide: !this.isCli },
235
230
  projectTypeClassicLabel: { hide: this.isCli },
@@ -250,7 +245,7 @@ class default_1 extends yeoman_generator_1.default {
250
245
  layer: this.layer,
251
246
  prompts: this.prompts
252
247
  };
253
- const defaultFolder = (0, fiori_generator_shared_1.getDefaultTargetFolder)(this.options.vscode) ?? process.cwd();
248
+ const defaultFolder = getDefaultTargetFolder(this.options.vscode) ?? process.cwd();
254
249
  const options = {
255
250
  targetFolder: { default: defaultFolder, hide: this.shouldCreateExtProject },
256
251
  ui5ValidationCli: { hide: !this.isCli },
@@ -262,12 +257,12 @@ class default_1 extends yeoman_generator_1.default {
262
257
  addDeployConfig: { hide: this.shouldCreateExtProject || !this.isCustomerBase },
263
258
  importKeyUserChanges: { hide: this.shouldCreateExtProject }
264
259
  };
265
- const attributesQuestions = (0, attributes_1.getPrompts)(this.destinationPath(), optionalPromptsConfig, options);
260
+ const attributesQuestions = getPrompts(this.destinationPath(), optionalPromptsConfig, options);
266
261
  this.attributeAnswers = await this.prompt(attributesQuestions);
267
262
  // Steps need to be updated here to be available after back navigation in Yeoman UI.
268
263
  this._updateWizardStepsAfterNavigation();
269
264
  if (this.attributeAnswers.importKeyUserChanges) {
270
- this.keyUserPrompter = new key_user_1.KeyUserImportPrompter(this.systemLookup, this.configAnswers.application.id, this.prompter.provider, this.configAnswers.system, this.logger);
265
+ this.keyUserPrompter = new KeyUserImportPrompter(this.systemLookup, this.configAnswers.application.id, this.prompter.provider, this.configAnswers.system, this.logger);
271
266
  const keyUserQuestions = this.keyUserPrompter.getPrompts({
272
267
  keyUserSystem: { default: this.configAnswers.system }
273
268
  });
@@ -276,7 +271,7 @@ class default_1 extends yeoman_generator_1.default {
276
271
  this.logger.info(`Project Attributes: ${JSON.stringify(this.attributeAnswers, null, 2)}`);
277
272
  if (this.attributeAnswers.addDeployConfig) {
278
273
  const system = await this.systemLookup.getSystemByName(this.configAnswers.system);
279
- await (0, subgenHelpers_1.addDeployGen)({
274
+ await addDeployGen({
280
275
  projectName: this.attributeAnswers.projectName,
281
276
  projectPath: this.attributeAnswers.targetFolder,
282
277
  connectedSystem: this.configAnswers.system,
@@ -285,7 +280,7 @@ class default_1 extends yeoman_generator_1.default {
285
280
  }, this.composeWith.bind(this), this.logger, this.appWizard);
286
281
  }
287
282
  if (this.attributeAnswers?.addFlpConfig) {
288
- await (0, subgenHelpers_1.addFlpGen)({
283
+ await addFlpGen({
289
284
  vscode: this.vscode,
290
285
  projectRootPath: this._getProjectPath(),
291
286
  inbounds: this.prompter.baseAppInbounds,
@@ -297,7 +292,7 @@ class default_1 extends yeoman_generator_1.default {
297
292
  }
298
293
  async writing() {
299
294
  try {
300
- this.toolsId = (0, uuid_1.v4)();
295
+ this.toolsId = uuidv4();
301
296
  if (this.jsonInput) {
302
297
  await this._initFromJson();
303
298
  }
@@ -307,10 +302,10 @@ class default_1 extends yeoman_generator_1.default {
307
302
  return;
308
303
  }
309
304
  if (this.configAnswers.storeCredentials) {
310
- await (0, adp_tooling_1.storeCredentials)(this.configAnswers, this.systemLookup, this.logger);
305
+ await storeCredentials(this.configAnswers, this.systemLookup, this.logger);
311
306
  }
312
307
  if (this.shouldCreateExtProject) {
313
- await (0, subgenHelpers_1.addExtProjectGen)({
308
+ await addExtProjectGen({
314
309
  configAnswers: this.configAnswers,
315
310
  attributeAnswers: this.attributeAnswers,
316
311
  systemLookup: this.systemLookup
@@ -322,8 +317,8 @@ class default_1 extends yeoman_generator_1.default {
322
317
  const manifest = this.jsonInput ? this.manifest : this.prompter.manifest;
323
318
  const keyUserChanges = this.jsonInput ? this.jsonInput.keyUserChanges : this.keyUserPrompter?.changes;
324
319
  const projectType = this._getProjectType();
325
- const packageJson = (0, deps_1.getPackageInfo)();
326
- const config = await (0, adp_tooling_1.getConfig)({
320
+ const packageJson = getPackageInfo();
321
+ const config = await getConfig({
327
322
  provider,
328
323
  configAnswers: this.configAnswers,
329
324
  attributeAnswers: this.attributeAnswers,
@@ -338,16 +333,16 @@ class default_1 extends yeoman_generator_1.default {
338
333
  keyUserChanges
339
334
  });
340
335
  if (config.options) {
341
- config.options.templatePathOverwrite = (0, templates_1.getTemplatesOverwritePath)();
336
+ config.options.templatePathOverwrite = getTemplatesOverwritePath();
342
337
  }
343
- await (0, adp_tooling_1.generate)(this._getProjectPath(), config, this.fs);
338
+ await generate(this._getProjectPath(), config, this.fs);
344
339
  }
345
340
  catch (e) {
346
341
  this.logger.error(`Writing phase failed: ${e}`);
347
- throw new Error((0, i18n_1.t)('error.updatingApp'));
342
+ throw new Error(t('error.updatingApp'));
348
343
  }
349
344
  finally {
350
- (0, appWizardCache_1.cacheClear)(this.appWizard, this.logger);
345
+ cacheClear(this.appWizard, this.logger);
351
346
  }
352
347
  }
353
348
  async install() {
@@ -355,7 +350,7 @@ class default_1 extends yeoman_generator_1.default {
355
350
  return;
356
351
  }
357
352
  try {
358
- await (0, deps_1.installDependencies)(this._getProjectPath());
353
+ await installDependencies(this._getProjectPath());
359
354
  }
360
355
  catch (e) {
361
356
  this.logger.error(`Installation of dependencies failed: ${e.message}`);
@@ -363,15 +358,15 @@ class default_1 extends yeoman_generator_1.default {
363
358
  }
364
359
  async end() {
365
360
  const projectPath = this._getProjectPath();
366
- const data = fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
361
+ const data = TelemetryHelper.createTelemetryData({
367
362
  appType: 'generator-adp',
368
363
  ...this.options.telemetryData,
369
364
  ...this.telemetryCollector.telemetryData
370
365
  });
371
366
  if (data) {
372
- (0, fiori_generator_shared_1.sendTelemetry)(telemetry_1.EventName.ADAPTATION_PROJECT_CREATED, data, projectPath)
367
+ sendTelemetry(EventName.ADAPTATION_PROJECT_CREATED, data, projectPath)
373
368
  .then(() => {
374
- this.logger.log(`Event ${telemetry_1.EventName.ADAPTATION_PROJECT_CREATED} successfully sent`);
369
+ this.logger.log(`Event ${EventName.ADAPTATION_PROJECT_CREATED} successfully sent`);
375
370
  })
376
371
  .catch((error) => {
377
372
  this.logger.error(`Failed to send telemetry: ${error}`);
@@ -381,18 +376,18 @@ class default_1 extends yeoman_generator_1.default {
381
376
  return;
382
377
  }
383
378
  try {
384
- if (!(0, workspace_1.existsInWorkspace)(this.vscode, projectPath)) {
385
- const userChoice = await (0, workspace_1.showWorkspaceFolderWarning)(this.vscode, projectPath);
379
+ if (!existsInWorkspace(this.vscode, projectPath)) {
380
+ const userChoice = await showWorkspaceFolderWarning(this.vscode, projectPath);
386
381
  if (!userChoice) {
387
382
  return;
388
383
  }
389
- await (0, workspace_1.handleWorkspaceFolderChoice)(this.vscode, projectPath, userChoice);
384
+ await handleWorkspaceFolderChoice(this.vscode, projectPath, userChoice);
390
385
  return;
391
386
  }
392
387
  await this.vscode?.commands?.executeCommand?.('sap.ux.application.info', { fsPath: projectPath });
393
388
  }
394
389
  catch (e) {
395
- this.appWizard.showError(e.message, yeoman_ui_types_1.MessageType.notification);
390
+ this.appWizard.showError(e.message, MessageType.notification);
396
391
  }
397
392
  }
398
393
  /**
@@ -401,12 +396,12 @@ class default_1 extends yeoman_generator_1.default {
401
396
  async _promptForCfProjectPath() {
402
397
  if (this.isMtaYamlFound) {
403
398
  const path = this.destinationRoot(process.cwd());
404
- (0, adp_tooling_1.getYamlContent)((0, node_path_1.join)(path, 'mta.yaml'));
399
+ getYamlContent(join(path, 'mta.yaml'));
405
400
  this.logger.log(`Project path information: ${path}`);
406
401
  }
407
402
  else {
408
- const pathAnswers = await this.prompt([(0, target_env_1.getProjectPathPrompt)(this.logger, this.vscode)]);
409
- const path = this.destinationRoot(node_fs_1.default.realpathSync(pathAnswers.projectLocation, 'utf-8'));
403
+ const pathAnswers = await this.prompt([getProjectPathPrompt(this.logger, this.vscode)]);
404
+ const path = this.destinationRoot(fs.realpathSync(pathAnswers.projectLocation, 'utf-8'));
410
405
  this.logger.log(`Project path information: ${path}`);
411
406
  }
412
407
  }
@@ -426,15 +421,15 @@ class default_1 extends yeoman_generator_1.default {
426
421
  }
427
422
  else {
428
423
  telemetryData.projectType =
429
- this._getProjectType() === axios_extension_1.AdaptationProjectType.CLOUD_READY ? 'cloudReady' : 'onPremise';
424
+ this._getProjectType() === AdaptationProjectType.CLOUD_READY ? 'cloudReady' : 'onPremise';
430
425
  telemetryData.baseAppTechnicalName = this.configAnswers?.application?.id ?? '';
431
426
  }
432
427
  if (this.jsonInput) {
433
- telemetryData.ui5VersionSelected = (0, adp_tooling_1.getLatestVersion)(this.publicVersions);
428
+ telemetryData.ui5VersionSelected = getLatestVersion(this.publicVersions);
434
429
  }
435
430
  else {
436
- const version = this.attributeAnswers?.ui5Version ?? (0, adp_tooling_1.getLatestVersion)(this.prompter?.ui5?.publicVersions) ?? '';
437
- telemetryData.ui5VersionSelected = (0, adp_tooling_1.getFormattedVersion)(version);
431
+ const version = this.attributeAnswers?.ui5Version ?? getLatestVersion(this.prompter?.ui5?.publicVersions) ?? '';
432
+ telemetryData.ui5VersionSelected = getFormattedVersion(version);
438
433
  }
439
434
  telemetryData.systemUI5Version = this.prompter?.ui5?.systemVersion ?? '';
440
435
  this.telemetryCollector.setBatch(telemetryData);
@@ -449,7 +444,7 @@ class default_1 extends yeoman_generator_1.default {
449
444
  await this._promptForTargetEnvironment();
450
445
  }
451
446
  else {
452
- this.targetEnv = types_1.TargetEnv.ABAP;
447
+ this.targetEnv = TargetEnv.ABAP;
453
448
  }
454
449
  }
455
450
  /**
@@ -457,12 +452,12 @@ class default_1 extends yeoman_generator_1.default {
457
452
  */
458
453
  async _promptForTargetEnvironment() {
459
454
  const targetEnvAnswers = await this.prompt([
460
- (0, target_env_1.getTargetEnvPrompt)(this.appWizard, this.cfInstalled, this.isCfLoggedIn, this.cfConfig)
455
+ getTargetEnvPrompt(this.appWizard, this.cfInstalled, this.isCfLoggedIn, this.cfConfig)
461
456
  ]);
462
457
  this.targetEnv = targetEnvAnswers.targetEnv;
463
- this.isCfEnv = this.targetEnv === types_1.TargetEnv.CF;
458
+ this.isCfEnv = this.targetEnv === TargetEnv.CF;
464
459
  this.logger.info(`Target environment: ${this.targetEnv}`);
465
- (0, steps_1.updateCfWizardSteps)(this.isCfEnv, this.prompts);
460
+ updateCfWizardSteps(this.isCfEnv, this.prompts);
466
461
  this.logger.log(`Project organization information: ${JSON.stringify(this.cfConfig.org, null, 2)}`);
467
462
  this.logger.log(`Project space information: ${JSON.stringify(this.cfConfig.space, null, 2)}`);
468
463
  this.logger.log(`Project apiUrl information: ${JSON.stringify(this.cfConfig.url, null, 2)}`);
@@ -484,7 +479,7 @@ class default_1 extends yeoman_generator_1.default {
484
479
  importKeyUserChanges: { hide: true }
485
480
  };
486
481
  const projectPath = this.destinationPath();
487
- const attributesQuestions = (0, attributes_1.getPrompts)(projectPath, {
482
+ const attributesQuestions = getPrompts(projectPath, {
488
483
  ui5Versions: [],
489
484
  isVersionDetected: false,
490
485
  layer: this.layer,
@@ -501,11 +496,11 @@ class default_1 extends yeoman_generator_1.default {
501
496
  return;
502
497
  }
503
498
  try {
504
- const cfInbounds = await (0, adp_tooling_1.getCfBaseAppInbounds)(selectedApp.appId, selectedApp.appHostId, this.cfConfig, this.logger);
499
+ const cfInbounds = await getCfBaseAppInbounds(selectedApp.appId, selectedApp.appHostId, this.cfConfig, this.logger);
505
500
  // Register FLP wizard pages now that we know if inbounds are available
506
- (0, steps_1.updateFlpWizardSteps)(!!cfInbounds, this.prompts, this.attributeAnswers.projectName, true);
501
+ updateFlpWizardSteps(!!cfInbounds, this.prompts, this.attributeAnswers.projectName, true);
507
502
  if (cfInbounds) {
508
- await (0, subgenHelpers_1.addFlpGen)({
503
+ await addFlpGen({
509
504
  vscode: this.vscode,
510
505
  projectRootPath: this._getProjectPath(),
511
506
  inbounds: cfInbounds,
@@ -525,12 +520,12 @@ class default_1 extends yeoman_generator_1.default {
525
520
  * @returns {ConfigPrompter} Cached config prompter if going back a page.
526
521
  */
527
522
  _getOrCreatePrompter() {
528
- const cached = (0, appWizardCache_1.cacheGet)(this.appWizard, 'prompter', this.logger);
523
+ const cached = cacheGet(this.appWizard, 'prompter', this.logger);
529
524
  if (cached) {
530
525
  return cached;
531
526
  }
532
- const prompter = new configuration_1.ConfigPrompter(this.systemLookup, this.layer, this.logger, this.telemetryCollector);
533
- (0, appWizardCache_1.cachePut)(this.appWizard, { prompter }, this.logger);
527
+ const prompter = new ConfigPrompter(this.systemLookup, this.layer, this.logger, this.telemetryCollector);
528
+ cachePut(this.appWizard, { prompter }, this.logger);
534
529
  return prompter;
535
530
  }
536
531
  /**
@@ -538,8 +533,8 @@ class default_1 extends yeoman_generator_1.default {
538
533
  */
539
534
  async _generateAdpProjectArtifactsCF() {
540
535
  const projectPath = this.destinationPath();
541
- const publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.logger);
542
- this.telemetryCollector.setBatch({ ui5VersionSelected: (0, adp_tooling_1.getLatestVersion)(publicVersions) });
536
+ const publicVersions = await fetchPublicVersions(this.logger);
537
+ this.telemetryCollector.setBatch({ ui5VersionSelected: getLatestVersion(publicVersions) });
543
538
  const manifest = this.cfPrompter.manifest;
544
539
  if (!manifest) {
545
540
  throw new Error('Manifest not found for base app.');
@@ -548,10 +543,10 @@ class default_1 extends yeoman_generator_1.default {
548
543
  const serviceInstanceGuid = this.cfPrompter.serviceInstanceGuid;
549
544
  const backendUrls = this.cfPrompter.backendUrls;
550
545
  const oauthPaths = this.cfPrompter.oauthPaths;
551
- const serviceInfo = await (0, adp_tooling_1.getOrCreateServiceInstanceKeys)({
546
+ const serviceInfo = await getOrCreateServiceInstanceKeys({
552
547
  names: [this.cfServicesAnswers.businessService ?? '']
553
548
  }, this.logger);
554
- const config = (0, adp_tooling_1.getCfConfig)({
549
+ const config = getCfConfig({
555
550
  attributeAnswers: this.attributeAnswers,
556
551
  cfServicesAnswers: this.cfServicesAnswers,
557
552
  cfConfig: this.cfConfig,
@@ -563,15 +558,15 @@ class default_1 extends yeoman_generator_1.default {
563
558
  oauthPaths,
564
559
  projectPath,
565
560
  publicVersions,
566
- packageJson: (0, deps_1.getPackageInfo)(),
561
+ packageJson: getPackageInfo(),
567
562
  toolsId: this.toolsId,
568
563
  serviceInfo,
569
564
  spaceGuid: this.cfConfig.space.GUID
570
565
  });
571
566
  if (config.options) {
572
- config.options.templatePathOverwrite = (0, templates_1.getTemplatesOverwritePath)();
567
+ config.options.templatePathOverwrite = getTemplatesOverwritePath();
573
568
  }
574
- await (0, adp_tooling_1.generateCf)(projectPath, config, this.logger, this.fs);
569
+ await generateCf(projectPath, config, this.logger, this.fs);
575
570
  }
576
571
  /**
577
572
  * Combines the target folder and project name.
@@ -580,12 +575,12 @@ class default_1 extends yeoman_generator_1.default {
580
575
  */
581
576
  _getProjectPath() {
582
577
  if (this.isCfEnv) {
583
- return (0, node_path_1.join)(this.destinationPath(), this.attributeAnswers.projectName);
578
+ return join(this.destinationPath(), this.attributeAnswers.projectName);
584
579
  }
585
580
  if (this.shouldCreateExtProject) {
586
- return (0, node_path_1.join)(process.cwd(), this.attributeAnswers.projectName);
581
+ return join(process.cwd(), this.attributeAnswers.projectName);
587
582
  }
588
- return (0, node_path_1.join)(this.attributeAnswers.targetFolder, this.attributeAnswers.projectName);
583
+ return join(this.attributeAnswers.targetFolder, this.attributeAnswers.projectName);
589
584
  }
590
585
  /**
591
586
  * Use this method to get the correct Adaptation project type, no matter how we start
@@ -600,8 +595,8 @@ class default_1 extends yeoman_generator_1.default {
600
595
  * Configures logging for the generator.
601
596
  */
602
597
  _setupLogging() {
603
- logger_2.default.configureLogging(this.options.logger, this.rootGeneratorName(), this.log, this.options.vscode, this.options.logLevel, this.options.logWrapper);
604
- this.logger = logger_2.default.logger;
598
+ AdpGeneratorLogger.configureLogging(this.options.logger, this.rootGeneratorName(), this.log, this.options.vscode, this.options.logLevel, this.options.logWrapper);
599
+ this.logger = AdpGeneratorLogger.logger;
605
600
  }
606
601
  /**
607
602
  * Initialize the project generator from a json.
@@ -610,40 +605,40 @@ class default_1 extends yeoman_generator_1.default {
610
605
  if (!this.jsonInput) {
611
606
  return;
612
607
  }
613
- const { system, client, username = '', password = '', projectType, application: baseApplicationName, applicationTitle, targetFolder = '/home/user/projects', projectName = (0, default_values_1.getDefaultProjectName)(targetFolder, `${baseApplicationName}.variant`), namespace = (0, default_values_1.getDefaultNamespace)(projectName, this.isCustomerBase) } = this.jsonInput;
614
- await (0, validators_1.validateJsonInput)(this.systemLookup, this.isCustomerBase, {
608
+ const { system, client, username = '', password = '', projectType, application: baseApplicationName, applicationTitle, targetFolder = '/home/user/projects', projectName = getDefaultProjectName(targetFolder, `${baseApplicationName}.variant`), namespace = getDefaultNamespace(projectName, this.isCustomerBase) } = this.jsonInput;
609
+ await validateJsonInput(this.systemLookup, this.isCustomerBase, {
615
610
  projectName,
616
611
  targetFolder,
617
612
  namespace,
618
613
  system
619
614
  });
620
- this.publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.logger);
615
+ this.publicVersions = await fetchPublicVersions(this.logger);
621
616
  const providerOptions = {
622
617
  system,
623
618
  client,
624
619
  username,
625
620
  password
626
621
  };
627
- this.abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(providerOptions, this.logger);
628
- const supportedProject = await (0, adp_tooling_1.getSupportedProject)(this.abapProvider);
629
- let selectedProjectType = axios_extension_1.AdaptationProjectType.ON_PREMISE;
630
- if (supportedProject === adp_tooling_1.SupportedProject.CLOUD_READY_AND_ON_PREM) {
631
- const isInternalUsage = (0, feature_toggle_1.isInternalFeaturesSettingEnabled)();
622
+ this.abapProvider = await getConfiguredProvider(providerOptions, this.logger);
623
+ const supportedProject = await getSupportedProject(this.abapProvider);
624
+ let selectedProjectType = AdaptationProjectType.ON_PREMISE;
625
+ if (supportedProject === SupportedProject.CLOUD_READY_AND_ON_PREM) {
626
+ const isInternalUsage = isInternalFeaturesSettingEnabled();
632
627
  selectedProjectType = isInternalUsage
633
- ? axios_extension_1.AdaptationProjectType.ON_PREMISE
634
- : (projectType ?? axios_extension_1.AdaptationProjectType.CLOUD_READY);
628
+ ? AdaptationProjectType.ON_PREMISE
629
+ : (projectType ?? AdaptationProjectType.CLOUD_READY);
635
630
  }
636
- else if (supportedProject === adp_tooling_1.SupportedProject.CLOUD_READY) {
637
- selectedProjectType = axios_extension_1.AdaptationProjectType.CLOUD_READY;
631
+ else if (supportedProject === SupportedProject.CLOUD_READY) {
632
+ selectedProjectType = AdaptationProjectType.CLOUD_READY;
638
633
  }
639
634
  this.projectType = selectedProjectType;
640
- const applications = await (0, adp_tooling_1.loadApps)(this.abapProvider, this.isCustomerBase, supportedProject);
635
+ const applications = await loadApps(this.abapProvider, this.isCustomerBase, supportedProject);
641
636
  this.telemetryCollector.setBatch({ numberOfApplications: applications.length });
642
637
  const application = applications.find((application) => application.id === baseApplicationName);
643
638
  if (!application) {
644
- throw new Error((0, i18n_1.t)('error.applicationNotFound', { appName: baseApplicationName }));
639
+ throw new Error(t('error.applicationNotFound', { appName: baseApplicationName }));
645
640
  }
646
- const sourceManifest = new adp_tooling_1.SourceManifest(this.abapProvider, application.id);
641
+ const sourceManifest = new SourceManifest(this.abapProvider, application.id);
647
642
  this.manifest = await sourceManifest.getManifest();
648
643
  this.configAnswers = {
649
644
  system,
@@ -667,16 +662,15 @@ class default_1 extends yeoman_generator_1.default {
667
662
  */
668
663
  _updateWizardStepsAfterNavigation() {
669
664
  const pages = this.prompts['items'];
670
- const flpPagesExist = pages.some((p) => p.name === (0, i18n_1.t)('yuiNavSteps.flpConfigName'));
671
- const deployPageExists = pages.some((p) => p.name === (0, i18n_1.t)('yuiNavSteps.deployConfigName'));
665
+ const flpPagesExist = pages.some((p) => p.name === t('yuiNavSteps.flpConfigName'));
666
+ const deployPageExists = pages.some((p) => p.name === t('yuiNavSteps.deployConfigName'));
672
667
  if (!deployPageExists) {
673
- (0, steps_1.updateWizardSteps)(this.prompts, (0, steps_1.getDeployPage)(), (0, i18n_1.t)('yuiNavSteps.projectAttributesName'), this.attributeAnswers.addDeployConfig);
668
+ updateWizardSteps(this.prompts, getDeployPage(), t('yuiNavSteps.projectAttributesName'), this.attributeAnswers.addDeployConfig);
674
669
  }
675
- (0, steps_1.updateWizardSteps)(this.prompts, (0, steps_1.getKeyUserImportPage)(), (0, i18n_1.t)('yuiNavSteps.projectAttributesName'), !!this.attributeAnswers.importKeyUserChanges);
670
+ updateWizardSteps(this.prompts, getKeyUserImportPage(), t('yuiNavSteps.projectAttributesName'), !!this.attributeAnswers.importKeyUserChanges);
676
671
  if (!flpPagesExist) {
677
- (0, steps_1.updateFlpWizardSteps)(!!this.prompter.baseAppInbounds, this.prompts, this.attributeAnswers.projectName, !!this.attributeAnswers.addFlpConfig);
672
+ updateFlpWizardSteps(!!this.prompter.baseAppInbounds, this.prompts, this.attributeAnswers.projectName, !!this.attributeAnswers.addFlpConfig);
678
673
  }
679
674
  }
680
675
  }
681
- exports.default = default_1;
682
676
  //# sourceMappingURL=index.js.map
@@ -1,14 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFlexLayer = getFlexLayer;
4
- const feature_toggle_1 = require("@sap-ux/feature-toggle");
1
+ import { FlexLayer } from '@sap-ux/adp-tooling';
2
+ import { isInternalFeaturesSettingEnabled } from '@sap-ux/feature-toggle';
5
3
  /**
6
4
  * Determines and returns the appropriate FlexLayer based on internal usage.
7
5
  *
8
6
  * @returns {FlexLayer} True if internal usage; otherwise, false.
9
7
  */
10
- function getFlexLayer() {
11
- const internal = (0, feature_toggle_1.isInternalFeaturesSettingEnabled)();
12
- return internal ? "VENDOR" /* FlexLayer.VENDOR */ : "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
8
+ export function getFlexLayer() {
9
+ const internal = isInternalFeaturesSettingEnabled();
10
+ return internal ? FlexLayer.VENDOR : FlexLayer.CUSTOMER_BASE;
13
11
  }
14
12
  //# sourceMappingURL=layer.js.map
@@ -1,5 +1,5 @@
1
- import { type Prompts as YeomanUiSteps } from '@sap-devx/yeoman-ui-types';
2
- import type { AttributesQuestion, AttributePromptOptions, AddDeployConfigPromptOptions, AddFlpConfigPromptOptions, OptionalPromptsConfig } from '../types';
1
+ import type { Prompts as YeomanUiSteps } from '@sap-devx/yeoman-ui-types';
2
+ import type { AttributesQuestion, AttributePromptOptions, AddDeployConfigPromptOptions, AddFlpConfigPromptOptions, OptionalPromptsConfig } from '../types.js';
3
3
  import { AdaptationProjectType } from '@sap-ux/axios-extension';
4
4
  /**
5
5
  * Returns all project attribute prompts, filtering based on promptOptions.