@sap-ux/generator-adp 0.3.75 → 0.3.76

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,6 +1,5 @@
1
1
  import { type AttributesAnswers, type ConfigAnswers, type SystemLookup } from '@sap-ux/adp-tooling';
2
2
  import type { ExtensionProjectData } from '../types';
3
- export declare const EXTENSIBILITY_GENERATOR_NS = "@bas-dev/generator-extensibility-sub/generators/app";
4
3
  /**
5
4
  * Prepares data required for generating an extension project.
6
5
  *
@@ -10,15 +9,4 @@ export declare const EXTENSIBILITY_GENERATOR_NS = "@bas-dev/generator-extensibil
10
9
  * @returns {Promise<ExtensionProjectData>} A promise resolving to the prepared extension project data object.
11
10
  */
12
11
  export declare function getExtensionProjectData(configAnswers: ConfigAnswers, attributeAnswers: AttributesAnswers, systemLookup: SystemLookup): Promise<ExtensionProjectData>;
13
- /**
14
- * Attempts to resolve the path to a specific node module generator from the NODE_PATH environment variable.
15
- * This is particularly used in the prompt for extension projects within SAP Business Application Studio (BAS)
16
- * when an application is not supported by the adaptation project. It functions by resolving the path to the
17
- * generator which is then utilized with `this.composeWith()` of the Yeoman generator. If the path to the generator
18
- * is found, it returns the path, allowing the extension project to continue. If no path is found, it indicates that
19
- * the Extensibility Generator is not installed in the development space, preventing the user from proceeding.
20
- *
21
- * @returns {string | undefined} The resolved path to the generator module if found, or undefined if not found.
22
- */
23
- export declare function resolveNodeModuleGenerator(): string | undefined;
24
12
  //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EXTENSIBILITY_GENERATOR_NS = void 0;
4
3
  exports.getExtensionProjectData = getExtensionProjectData;
5
- exports.resolveNodeModuleGenerator = resolveNodeModuleGenerator;
6
- const path_1 = require("path");
7
4
  const adp_tooling_1 = require("@sap-ux/adp-tooling");
8
5
  const i18n_1 = require("../../utils/i18n");
9
- exports.EXTENSIBILITY_GENERATOR_NS = '@bas-dev/generator-extensibility-sub/generators/app';
10
6
  /**
11
7
  * Prepares data required for generating an extension project.
12
8
  *
@@ -41,33 +37,4 @@ async function getExtensionProjectData(configAnswers, attributeAnswers, systemLo
41
37
  namespace: application.id
42
38
  };
43
39
  }
44
- /**
45
- * Attempts to resolve the path to a specific node module generator from the NODE_PATH environment variable.
46
- * This is particularly used in the prompt for extension projects within SAP Business Application Studio (BAS)
47
- * when an application is not supported by the adaptation project. It functions by resolving the path to the
48
- * generator which is then utilized with `this.composeWith()` of the Yeoman generator. If the path to the generator
49
- * is found, it returns the path, allowing the extension project to continue. If no path is found, it indicates that
50
- * the Extensibility Generator is not installed in the development space, preventing the user from proceeding.
51
- *
52
- * @returns {string | undefined} The resolved path to the generator module if found, or undefined if not found.
53
- */
54
- function resolveNodeModuleGenerator() {
55
- const nodePath = process.env['NODE_PATH'];
56
- const nodePaths = nodePath?.split(':') ?? [];
57
- let generator;
58
- for (const path of nodePaths) {
59
- try {
60
- generator = require.resolve((0, path_1.resolve)(path, exports.EXTENSIBILITY_GENERATOR_NS));
61
- }
62
- catch (e) {
63
- /**
64
- * We don't care if there's an error while resolving the module, continue with the next node_module path
65
- */
66
- }
67
- if (generator !== undefined) {
68
- break;
69
- }
70
- }
71
- return generator;
72
- }
73
40
  //# sourceMappingURL=index.js.map
@@ -117,7 +117,7 @@ class default_1 extends yeoman_generator_1.default {
117
117
  this.jsonInput = (0, parse_json_input_1.parseJsonInput)(jsonInputString, this.logger);
118
118
  if (!this.jsonInput) {
119
119
  this.env.lookup({
120
- packagePatterns: ['@sap/generator-fiori']
120
+ packagePatterns: ['@sap/generator-fiori', '@bas-dev/generator-extensibility-sub']
121
121
  });
122
122
  (0, opts_1.setHeaderTitle)(opts, this.logger, generatorTitle);
123
123
  (0, appWizardCache_1.initCache)(this.logger, this.appWizard);
@@ -152,9 +152,11 @@ class default_1 extends yeoman_generator_1.default {
152
152
  if (this.jsonInput) {
153
153
  return;
154
154
  }
155
+ const isExtensibilityExtInstalled = (0, fiori_generator_shared_1.isExtensionInstalled)(this.vscode, 'SAP.vscode-bas-extensibility');
155
156
  const configQuestions = this.prompter.getPrompts({
156
157
  appValidationCli: { hide: !this.isCli },
157
- systemValidationCli: { hide: !this.isCli }
158
+ systemValidationCli: { hide: !this.isCli },
159
+ shouldCreateExtProject: { isExtensibilityExtInstalled }
158
160
  });
159
161
  this.configAnswers = await this.prompt(configQuestions);
160
162
  this.shouldCreateExtProject = !!this.configAnswers.shouldCreateExtProject;
@@ -193,7 +193,7 @@ export declare class ConfigPrompter {
193
193
  * Generates a confirmation prompt to decide whether to create an extension project based on the application's
194
194
  * sync capabilities and support status.
195
195
  *
196
- * @param {ShouldCreateExtProjectPromptOptions} _ - Optional configuration for the confirm extension project prompt.
196
+ * @param {ShouldCreateExtProjectPromptOptions} options - Optional configuration for the confirm extension project prompt.
197
197
  * @returns The confirm extension project prompt as a {@link ConfigQuestion}.
198
198
  */
199
199
  private getShouldCreateExtProjectPrompt;
@@ -360,10 +360,10 @@ class ConfigPrompter {
360
360
  * Generates a confirmation prompt to decide whether to create an extension project based on the application's
361
361
  * sync capabilities and support status.
362
362
  *
363
- * @param {ShouldCreateExtProjectPromptOptions} _ - Optional configuration for the confirm extension project prompt.
363
+ * @param {ShouldCreateExtProjectPromptOptions} options - Optional configuration for the confirm extension project prompt.
364
364
  * @returns The confirm extension project prompt as a {@link ConfigQuestion}.
365
365
  */
366
- getShouldCreateExtProjectPrompt(_) {
366
+ getShouldCreateExtProjectPrompt(options) {
367
367
  return {
368
368
  type: 'confirm',
369
369
  name: types_1.configPromptNames.shouldCreateExtProject,
@@ -373,7 +373,12 @@ class ConfigPrompter {
373
373
  applyDefaultWhenDirty: true
374
374
  },
375
375
  when: (answers) => (0, conditions_1.showExtensionProjectQuestion)(answers, this.flexUISystem, this.isCloudProject, this.isApplicationSupported, this.containsSyncViews),
376
- validate: (value) => (0, validators_1.validateExtensibilityGenerator)(value, this.isApplicationSupported, this.containsSyncViews)
376
+ validate: (value) => (0, validators_1.validateExtensibilityExtension)({
377
+ value,
378
+ isApplicationSupported: this.isApplicationSupported,
379
+ hasSyncViews: this.containsSyncViews,
380
+ isExtensibilityExtInstalled: !!options?.isExtensibilityExtInstalled
381
+ })
377
382
  };
378
383
  }
379
384
  /**
@@ -5,16 +5,24 @@ interface JsonInputParams {
5
5
  namespace: string;
6
6
  system: string;
7
7
  }
8
+ interface ValidateExtensibilityExtParams {
9
+ value: boolean;
10
+ isApplicationSupported: boolean;
11
+ hasSyncViews: boolean;
12
+ isExtensibilityExtInstalled: boolean;
13
+ }
8
14
  /**
9
- * Validates whether the extensibility sub-generator is available and sets it up if necessary.
10
- * If the generator is not found, an error message is returned advising on the necessary action.
15
+ * Validates whether the extensibility extension is available. If the extension is not found,
16
+ * an error message is returned advising on the necessary action.
11
17
  *
12
- * @param {boolean} value - A confirm flag indicating whether user wants to continue creating an extension project.
13
- * @param {boolean} isApplicationSupported - Whether the selected application is supported.
14
- * @param {boolean} hasSyncViews - Whether synchronized views exist for the app.
18
+ * @param {ValidateExtensibilityExtParams} params - The validation parameters.
19
+ * @param {boolean} params.value - A confirm flag indicating whether user wants to continue creating an extension project.
20
+ * @param {boolean} params.isApplicationSupported - Whether the selected application is supported.
21
+ * @param {boolean} params.hasSyncViews - Whether synchronized views exist for the app.
22
+ * @param {boolean} params.isExtensibilityExtInstalled - Whether the extensibility extension is installed.
15
23
  * @returns {boolean | string} Returns true if app is supported and contains sync views, or an error message if not.
16
24
  */
17
- export declare function validateExtensibilityGenerator(value: boolean, isApplicationSupported: boolean, hasSyncViews: boolean): boolean | string;
25
+ export declare function validateExtensibilityExtension({ value, isApplicationSupported, hasSyncViews, isExtensibilityExtInstalled }: ValidateExtensibilityExtParams): boolean | string;
18
26
  /**
19
27
  * Validates the input parameters for an adaptation project configuration.
20
28
  *
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateExtensibilityGenerator = validateExtensibilityGenerator;
3
+ exports.validateExtensibilityExtension = validateExtensibilityExtension;
4
4
  exports.validateJsonInput = validateJsonInput;
5
5
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
6
6
  const i18n_1 = require("../../../utils/i18n");
7
7
  const type_guards_1 = require("../../../utils/type-guards");
8
- const extension_project_1 = require("../../extension-project");
9
8
  /**
10
- * Validates whether the extensibility sub-generator is available and sets it up if necessary.
11
- * If the generator is not found, an error message is returned advising on the necessary action.
9
+ * Validates whether the extensibility extension is available. If the extension is not found,
10
+ * an error message is returned advising on the necessary action.
12
11
  *
13
- * @param {boolean} value - A confirm flag indicating whether user wants to continue creating an extension project.
14
- * @param {boolean} isApplicationSupported - Whether the selected application is supported.
15
- * @param {boolean} hasSyncViews - Whether synchronized views exist for the app.
12
+ * @param {ValidateExtensibilityExtParams} params - The validation parameters.
13
+ * @param {boolean} params.value - A confirm flag indicating whether user wants to continue creating an extension project.
14
+ * @param {boolean} params.isApplicationSupported - Whether the selected application is supported.
15
+ * @param {boolean} params.hasSyncViews - Whether synchronized views exist for the app.
16
+ * @param {boolean} params.isExtensibilityExtInstalled - Whether the extensibility extension is installed.
16
17
  * @returns {boolean | string} Returns true if app is supported and contains sync views, or an error message if not.
17
18
  */
18
- function validateExtensibilityGenerator(value, isApplicationSupported, hasSyncViews) {
19
+ function validateExtensibilityExtension({ value, isApplicationSupported, hasSyncViews, isExtensibilityExtInstalled }) {
19
20
  if (value) {
20
- const generator = (0, extension_project_1.resolveNodeModuleGenerator)();
21
- if (!generator) {
22
- return (0, i18n_1.t)('error.extensibilityGenNotFound');
21
+ if (!isExtensibilityExtInstalled) {
22
+ return (0, i18n_1.t)('error.extensibilityExtensionNotFound');
23
23
  }
24
24
  return true;
25
25
  }
@@ -71,6 +71,7 @@ export interface AchPromptOptions {
71
71
  }
72
72
  export interface ShouldCreateExtProjectPromptOptions {
73
73
  hide?: boolean;
74
+ isExtensibilityExtInstalled?: boolean;
74
75
  }
75
76
  /**
76
77
  * Options for the configuration inquirer & the prompts.
@@ -70,7 +70,7 @@
70
70
  "manifestCouldNotBeValidated": "The `manifest.json` file of the selected application cannot be validated. Please select a different application.",
71
71
  "appDoesNotSupportFlexibility": "The selected application does not support flexibility because it has (`flexEnabled=false`). SAPUI5 Adaptation Project only supports applications that support flexibility. Please select a different application.",
72
72
  "appDoesNotSupportManifest": "The selected application is not supported by SAPUI5 Adaptation Project because it does not have a `manifest.json` file. Please select a different application.",
73
- "extensibilityGenNotFound": "The Extensibility Project generator plugin was not found in your dev space and it is required for this action. To proceed, please install the <SAPUI5 Layout Editor & Extensibility> extension.",
73
+ "extensibilityExtensionNotFound": "The Extensibility Project generator plugin was not found in your dev space and it is required for this action. To proceed, please install the <SAPUI5 Layout Editor & Extensibility> extension.",
74
74
  "creatingExtensionProjectError": "Creating the extension project failed. To see the error, view the logs.",
75
75
  "appParameterMissing": "Could not create an extension project because the application parameters are missing. Please select a different application.",
76
76
  "destinationInfoMissing": "Could not create an extension project because the destination info is missing. Please select a different system.",
@@ -107,8 +107,7 @@ function addDeployGen({ projectName, projectPath, connectedSystem, system }, com
107
107
  async function addExtProjectGen({ configAnswers, attributeAnswers, systemLookup }, composeWith, logger, appWizard) {
108
108
  try {
109
109
  const data = await (0, extension_project_1.getExtensionProjectData)(configAnswers, attributeAnswers, systemLookup);
110
- const generator = (0, extension_project_1.resolveNodeModuleGenerator)();
111
- composeWith(generator, {
110
+ composeWith('@bas-dev/extensibility-sub', {
112
111
  arguments: [JSON.stringify(data)],
113
112
  appWizard
114
113
  });
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.3.75",
6
+ "version": "0.3.76",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -31,15 +31,15 @@
31
31
  "yeoman-generator": "5.10.0",
32
32
  "uuid": "10.0.0",
33
33
  "@sap-ux/adp-tooling": "0.15.25",
34
+ "@sap-ux/feature-toggle": "0.3.1",
34
35
  "@sap-ux/axios-extension": "1.22.7",
35
36
  "@sap-ux/btp-utils": "1.1.1",
36
- "@sap-ux/feature-toggle": "0.3.1",
37
- "@sap-ux/inquirer-common": "0.7.39",
38
37
  "@sap-ux/logger": "0.7.0",
38
+ "@sap-ux/inquirer-common": "0.7.39",
39
39
  "@sap-ux/project-access": "1.30.13",
40
40
  "@sap-ux/store": "1.1.4",
41
- "@sap-ux/system-access": "0.6.16",
42
41
  "@sap-ux/project-input-validator": "0.6.18",
42
+ "@sap-ux/system-access": "0.6.16",
43
43
  "@sap-ux/fiori-generator-shared": "0.13.12",
44
44
  "@sap-ux/odata-service-writer": "0.27.18"
45
45
  },