@sap-ux/generator-adp 0.7.11 → 0.7.13

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.
@@ -9,7 +9,6 @@ const yeoman_generator_1 = __importDefault(require("yeoman-generator"));
9
9
  const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
10
10
  const adp_tooling_1 = require("@sap-ux/adp-tooling");
11
11
  const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
12
- const btp_utils_1 = require("@sap-ux/btp-utils");
13
12
  const logger_1 = require("@sap-ux/logger");
14
13
  const feature_toggle_1 = require("@sap-ux/feature-toggle");
15
14
  const telemetryEvents_1 = require("../telemetryEvents");
@@ -155,10 +154,6 @@ class default_1 extends yeoman_generator_1.default {
155
154
  this.logger.debug(`isCfFeatureEnabled: ${this.isCfFeatureEnabled}`);
156
155
  const jsonInputString = (0, parse_json_input_1.getFirstArgAsString)(args);
157
156
  this.jsonInput = (0, parse_json_input_1.parseJsonInput)(jsonInputString, this.logger);
158
- // Force the generator to overwrite existing files without additional prompting
159
- if (this.env.conflicter) {
160
- this.env.conflicter.force = this.options.force ?? true;
161
- }
162
157
  if (!this.jsonInput) {
163
158
  this.env.lookup({
164
159
  packagePatterns: ['@sap/generator-fiori', '@bas-dev/generator-extensibility-sub']
@@ -174,6 +169,10 @@ class default_1 extends yeoman_generator_1.default {
174
169
  }
175
170
  }
176
171
  async initializing() {
172
+ // Force the generator to overwrite existing files without additional prompting
173
+ if (this.env.conflicter) {
174
+ this.env.conflicter.force = this.options.force ?? true;
175
+ }
177
176
  await (0, i18n_1.initI18n)();
178
177
  this.isCli = (0, fiori_generator_shared_1.isCli)();
179
178
  this.layer = (0, layer_1.getFlexLayer)();
@@ -185,7 +184,7 @@ class default_1 extends yeoman_generator_1.default {
185
184
  this.logger.info(`isCfInstalled: ${this.cfInstalled}`);
186
185
  const isInternalUsage = (0, feature_toggle_1.isInternalFeaturesSettingEnabled)();
187
186
  if (!this.jsonInput) {
188
- const shouldShowTargetEnv = (0, btp_utils_1.isAppStudio)() && this.cfInstalled && this.isCfFeatureEnabled;
187
+ const shouldShowTargetEnv = this.cfInstalled && this.isCfFeatureEnabled;
189
188
  this.prompts.splice(0, 0, (0, steps_1.getWizardPages)(shouldShowTargetEnv));
190
189
  this.prompter = this._getOrCreatePrompter();
191
190
  this.cfPrompter = new cf_services_1.CFServicesPrompter(isInternalUsage, this.isCfLoggedIn, this.logger);
@@ -308,7 +307,7 @@ class default_1 extends yeoman_generator_1.default {
308
307
  }
309
308
  }
310
309
  async install() {
311
- if (!this.shouldInstallDeps || this.shouldCreateExtProject || this.isCfEnv) {
310
+ if (!this.shouldInstallDeps || this.shouldCreateExtProject) {
312
311
  return;
313
312
  }
314
313
  try {
@@ -319,7 +318,7 @@ class default_1 extends yeoman_generator_1.default {
319
318
  }
320
319
  }
321
320
  async end() {
322
- if (this.shouldCreateExtProject || this.isCfEnv) {
321
+ if (this.shouldCreateExtProject) {
323
322
  return;
324
323
  }
325
324
  const telemetryData = fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
@@ -332,7 +331,7 @@ class default_1 extends yeoman_generator_1.default {
332
331
  this.logger.error((0, i18n_1.t)('error.telemetry', { error }));
333
332
  });
334
333
  }
335
- if (this.isCli) {
334
+ if (this.isCli || this.isCfEnv) {
336
335
  return;
337
336
  }
338
337
  try {
@@ -371,7 +370,7 @@ class default_1 extends yeoman_generator_1.default {
371
370
  */
372
371
  async _determineTargetEnv() {
373
372
  const hasRequiredExtensions = this.isCfFeatureEnabled && this.cfInstalled;
374
- if ((0, btp_utils_1.isAppStudio)() && hasRequiredExtensions) {
373
+ if (hasRequiredExtensions) {
375
374
  await this._promptForTargetEnvironment();
376
375
  }
377
376
  else {
@@ -383,7 +382,7 @@ class default_1 extends yeoman_generator_1.default {
383
382
  */
384
383
  async _promptForTargetEnvironment() {
385
384
  const targetEnvAnswers = await this.prompt([
386
- (0, target_env_1.getTargetEnvPrompt)(this.appWizard, this.cfInstalled, this.isCfLoggedIn, this.cfConfig, this.vscode)
385
+ (0, target_env_1.getTargetEnvPrompt)(this.appWizard, this.cfInstalled, this.isCfLoggedIn, this.cfConfig)
387
386
  ]);
388
387
  this.targetEnv = targetEnvAnswers.targetEnv;
389
388
  this.isCfEnv = this.targetEnv === types_1.TargetEnv.CF;
@@ -439,13 +438,16 @@ class default_1 extends yeoman_generator_1.default {
439
438
  * Generates the ADP project artifacts for the CF environment.
440
439
  */
441
440
  async _generateAdpProjectArtifactsCF() {
442
- const projectPath = this.isMtaYamlFound ? process.cwd() : this.destinationPath();
441
+ const projectPath = this.destinationPath();
443
442
  const publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.logger);
444
443
  const manifest = this.cfPrompter.manifest;
445
444
  if (!manifest) {
446
445
  throw new Error('Manifest not found for base app.');
447
446
  }
448
- const html5RepoRuntimeGuid = this.cfPrompter.serviceInstanceGuid;
447
+ const html5RepoRuntimeGuid = this.cfPrompter.html5RepoRuntimeGuid;
448
+ const serviceInstanceGuid = this.cfPrompter.serviceInstanceGuid;
449
+ const backendUrl = this.cfPrompter.backendUrl;
450
+ const oauthPaths = this.cfPrompter.oauthPaths;
449
451
  const config = (0, adp_tooling_1.getCfConfig)({
450
452
  attributeAnswers: this.attributeAnswers,
451
453
  cfServicesAnswers: this.cfServicesAnswers,
@@ -453,6 +455,9 @@ class default_1 extends yeoman_generator_1.default {
453
455
  layer: this.layer,
454
456
  manifest,
455
457
  html5RepoRuntimeGuid,
458
+ serviceInstanceGuid,
459
+ backendUrl,
460
+ oauthPaths,
456
461
  projectPath,
457
462
  publicVersions
458
463
  });
@@ -467,6 +472,9 @@ class default_1 extends yeoman_generator_1.default {
467
472
  * @returns {string} The project path from the answers.
468
473
  */
469
474
  _getProjectPath() {
475
+ if (this.isCfEnv) {
476
+ return (0, node_path_1.join)(this.destinationPath(), this.attributeAnswers.projectName);
477
+ }
470
478
  return (0, node_path_1.join)(this.attributeAnswers.targetFolder, this.attributeAnswers.projectName);
471
479
  }
472
480
  /**
@@ -39,6 +39,10 @@ export declare class CFServicesPrompter {
39
39
  * The manifest.
40
40
  */
41
41
  private appManifest;
42
+ /**
43
+ * The zip entries from the downloaded app content.
44
+ */
45
+ private appContentEntries;
42
46
  /**
43
47
  * Returns the loaded application manifest.
44
48
  *
@@ -46,11 +50,29 @@ export declare class CFServicesPrompter {
46
50
  */
47
51
  get manifest(): Manifest | undefined;
48
52
  /**
49
- * Returns the service instance GUID.
53
+ * Returns the HTML5 repo service instance GUID.
54
+ *
55
+ * @returns {string} HTML5 repo service instance GUID.
56
+ */
57
+ get html5RepoRuntimeGuid(): string;
58
+ /**
59
+ * Returns the business service instance GUID.
60
+ *
61
+ * @returns {string | undefined} Business service instance GUID.
62
+ */
63
+ get serviceInstanceGuid(): string | undefined;
64
+ /**
65
+ * Returns the backend URL from service keys endpoints.
66
+ *
67
+ * @returns {string | undefined} Backend URL from the first endpoint that has a url property, or undefined.
68
+ */
69
+ get backendUrl(): string | undefined;
70
+ /**
71
+ * Returns the OAuth paths extracted from xs-app.json routes that have a source property.
50
72
  *
51
- * @returns Service instance GUID.
73
+ * @returns {string[]} Array of path patterns that should receive OAuth Bearer tokens.
52
74
  */
53
- get serviceInstanceGuid(): string;
75
+ get oauthPaths(): string[];
54
76
  /**
55
77
  * Constructor for CFServicesPrompter.
56
78
  *
@@ -49,6 +49,10 @@ class CFServicesPrompter {
49
49
  * The manifest.
50
50
  */
51
51
  appManifest;
52
+ /**
53
+ * The zip entries from the downloaded app content.
54
+ */
55
+ appContentEntries;
52
56
  /**
53
57
  * Returns the loaded application manifest.
54
58
  *
@@ -58,13 +62,41 @@ class CFServicesPrompter {
58
62
  return this.appManifest;
59
63
  }
60
64
  /**
61
- * Returns the service instance GUID.
65
+ * Returns the HTML5 repo service instance GUID.
62
66
  *
63
- * @returns Service instance GUID.
67
+ * @returns {string} HTML5 repo service instance GUID.
64
68
  */
65
- get serviceInstanceGuid() {
69
+ get html5RepoRuntimeGuid() {
66
70
  return this.html5RepoServiceInstanceGuid;
67
71
  }
72
+ /**
73
+ * Returns the business service instance GUID.
74
+ *
75
+ * @returns {string | undefined} Business service instance GUID.
76
+ */
77
+ get serviceInstanceGuid() {
78
+ return this.businessServiceInfo?.serviceInstance?.guid;
79
+ }
80
+ /**
81
+ * Returns the backend URL from service keys endpoints.
82
+ *
83
+ * @returns {string | undefined} Backend URL from the first endpoint that has a url property, or undefined.
84
+ */
85
+ get backendUrl() {
86
+ const serviceKeys = this.businessServiceInfo?.serviceKeys ?? [];
87
+ return (0, adp_tooling_1.getBackendUrlFromServiceKeys)(serviceKeys);
88
+ }
89
+ /**
90
+ * Returns the OAuth paths extracted from xs-app.json routes that have a source property.
91
+ *
92
+ * @returns {string[]} Array of path patterns that should receive OAuth Bearer tokens.
93
+ */
94
+ get oauthPaths() {
95
+ if (!this.appContentEntries) {
96
+ return [];
97
+ }
98
+ return (0, adp_tooling_1.getOAuthPathsFromXsApp)(this.appContentEntries);
99
+ }
68
100
  /**
69
101
  * Constructor for CFServicesPrompter.
70
102
  *
@@ -188,6 +220,7 @@ class CFServicesPrompter {
188
220
  const { entries, serviceInstanceGuid, manifest } = await (0, adp_tooling_1.downloadAppContent)(cfConfig.space.GUID, app, this.logger);
189
221
  this.appManifest = manifest;
190
222
  this.html5RepoServiceInstanceGuid = serviceInstanceGuid;
223
+ this.appContentEntries = entries;
191
224
  await (0, adp_tooling_1.validateSmartTemplateApplication)(manifest);
192
225
  await (0, adp_tooling_1.validateODataEndpoints)(entries, this.businessServiceInfo.serviceKeys, this.logger);
193
226
  }
@@ -46,10 +46,9 @@ export declare function validateJsonInput(systemLookup: SystemLookup, isCustomer
46
46
  *
47
47
  * @param {string} value - The value to validate.
48
48
  * @param {boolean} isCFLoggedIn - Whether Cloud Foundry is logged in.
49
- * @param {any} vscode - The vscode instance.
50
49
  * @returns {Promise<string | boolean>} Returns true if the environment is valid, otherwise returns an error message.
51
50
  */
52
- export declare function validateEnvironment(value: string, isCFLoggedIn: boolean, vscode: any): Promise<string | boolean>;
51
+ export declare function validateEnvironment(value: string, isCFLoggedIn: boolean): Promise<string | boolean>;
53
52
  /**
54
53
  * Validates the project path.
55
54
  *
@@ -9,7 +9,6 @@ exports.validateEnvironment = validateEnvironment;
9
9
  exports.validateProjectPath = validateProjectPath;
10
10
  exports.validateBusinessSolutionName = validateBusinessSolutionName;
11
11
  const node_fs_1 = __importDefault(require("node:fs"));
12
- const btp_utils_1 = require("@sap-ux/btp-utils");
13
12
  const adp_tooling_1 = require("@sap-ux/adp-tooling");
14
13
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
15
14
  const i18n_1 = require("../../../utils/i18n");
@@ -69,19 +68,12 @@ async function validateJsonInput(systemLookup, isCustomerBase, { projectName, ta
69
68
  *
70
69
  * @param {string} value - The value to validate.
71
70
  * @param {boolean} isCFLoggedIn - Whether Cloud Foundry is logged in.
72
- * @param {any} vscode - The vscode instance.
73
71
  * @returns {Promise<string | boolean>} Returns true if the environment is valid, otherwise returns an error message.
74
72
  */
75
- async function validateEnvironment(value, isCFLoggedIn, vscode) {
73
+ async function validateEnvironment(value, isCFLoggedIn) {
76
74
  if (value === 'CF' && !isCFLoggedIn) {
77
75
  return (0, i18n_1.t)('error.cfNotLoggedIn');
78
76
  }
79
- if (value === 'CF' && !(0, btp_utils_1.isAppStudio)()) {
80
- const isExtLoginEnabled = await (0, adp_tooling_1.isExternalLoginEnabled)(vscode);
81
- if (!isExtLoginEnabled) {
82
- return (0, i18n_1.t)('error.cfLoginCannotBeDetected');
83
- }
84
- }
85
77
  return true;
86
78
  }
87
79
  /**
@@ -15,10 +15,9 @@ type EnvironmentChoice = {
15
15
  * @param {boolean} isCfInstalled - Whether Cloud Foundry is installed.
16
16
  * @param {boolean} isCFLoggedIn - Whether Cloud Foundry is logged in.
17
17
  * @param {CfConfig} cfConfig - The CF config service instance.
18
- * @param {any} vscode - The vscode instance.
19
18
  * @returns {object[]} The target environment prompt.
20
19
  */
21
- export declare function getTargetEnvPrompt(appWizard: AppWizard, isCfInstalled: boolean, isCFLoggedIn: boolean, cfConfig: CfConfig, vscode: any): TargetEnvQuestion;
20
+ export declare function getTargetEnvPrompt(appWizard: AppWizard, isCfInstalled: boolean, isCFLoggedIn: boolean, cfConfig: CfConfig): TargetEnvQuestion;
22
21
  /**
23
22
  * Returns the environments.
24
23
  *
@@ -16,10 +16,9 @@ const validators_1 = require("./helper/validators");
16
16
  * @param {boolean} isCfInstalled - Whether Cloud Foundry is installed.
17
17
  * @param {boolean} isCFLoggedIn - Whether Cloud Foundry is logged in.
18
18
  * @param {CfConfig} cfConfig - The CF config service instance.
19
- * @param {any} vscode - The vscode instance.
20
19
  * @returns {object[]} The target environment prompt.
21
20
  */
22
- function getTargetEnvPrompt(appWizard, isCfInstalled, isCFLoggedIn, cfConfig, vscode) {
21
+ function getTargetEnvPrompt(appWizard, isCfInstalled, isCFLoggedIn, cfConfig) {
23
22
  return {
24
23
  type: 'list',
25
24
  name: 'targetEnv',
@@ -31,7 +30,7 @@ function getTargetEnvPrompt(appWizard, isCfInstalled, isCFLoggedIn, cfConfig, vs
31
30
  hint: (0, i18n_1.t)('prompts.targetEnvTooltip'),
32
31
  breadcrumb: (0, i18n_1.t)('prompts.targetEnvBreadcrumb')
33
32
  },
34
- validate: (value) => (0, validators_1.validateEnvironment)(value, isCFLoggedIn, vscode),
33
+ validate: (value) => (0, validators_1.validateEnvironment)(value, isCFLoggedIn),
35
34
  additionalMessages: (value) => (0, additional_messages_1.getTargetEnvAdditionalMessages)(value, isCFLoggedIn, cfConfig)
36
35
  };
37
36
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "SAPUI5 Adaptation Project",
4
4
  "homepage": "https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/ada9567b767941aba8d49fdb4fdedea7.html",
5
5
  "description": "Adaptation project allows you to create an app variant for an existing SAP Fiori elements-based or SAPUI5 freestyle application, without changing the original application.",
6
- "version": "0.7.11",
6
+ "version": "0.7.13",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,18 +30,18 @@
30
30
  "i18next": "25.3.0",
31
31
  "yeoman-generator": "5.10.0",
32
32
  "uuid": "10.0.0",
33
- "@sap-ux/adp-tooling": "0.18.11",
33
+ "@sap-ux/adp-tooling": "0.18.13",
34
34
  "@sap-ux/axios-extension": "1.24.3",
35
- "@sap-ux/btp-utils": "1.1.5",
36
35
  "@sap-ux/feature-toggle": "0.3.4",
37
- "@sap-ux/inquirer-common": "0.9.8",
36
+ "@sap-ux/btp-utils": "1.1.5",
37
+ "@sap-ux/inquirer-common": "0.9.9",
38
38
  "@sap-ux/logger": "0.7.1",
39
- "@sap-ux/project-access": "1.32.11",
39
+ "@sap-ux/project-access": "1.32.12",
40
40
  "@sap-ux/store": "1.3.3",
41
41
  "@sap-ux/system-access": "0.6.29",
42
- "@sap-ux/project-input-validator": "0.6.33",
43
- "@sap-ux/fiori-generator-shared": "0.13.36",
44
- "@sap-ux/odata-service-writer": "0.27.32"
42
+ "@sap-ux/fiori-generator-shared": "0.13.37",
43
+ "@sap-ux/project-input-validator": "0.6.34",
44
+ "@sap-ux/odata-service-writer": "0.27.33"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jest/types": "30.0.1",
@@ -56,7 +56,7 @@
56
56
  "fs-extra": "10.0.0",
57
57
  "rimraf": "6.0.1",
58
58
  "yeoman-test": "6.3.0",
59
- "@sap-ux/deploy-config-sub-generator": "0.5.9"
59
+ "@sap-ux/deploy-config-sub-generator": "0.5.10"
60
60
  },
61
61
  "engines": {
62
62
  "node": ">=20.x"