@sap-ux/generator-adp 1.0.8 → 1.0.9

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 (41) hide show
  1. package/generators/add-annotations-to-odata/index.js +20 -15
  2. package/generators/add-component-usages/index.js +21 -16
  3. package/generators/add-new-model/index.js +29 -24
  4. package/generators/app/extension-project/index.js +9 -6
  5. package/generators/app/index.js +135 -129
  6. package/generators/app/layer.js +8 -5
  7. package/generators/app/questions/attributes.js +65 -60
  8. package/generators/app/questions/cf-services.js +52 -48
  9. package/generators/app/questions/configuration.js +129 -125
  10. package/generators/app/questions/helper/additional-messages.js +36 -29
  11. package/generators/app/questions/helper/choices.js +25 -16
  12. package/generators/app/questions/helper/conditions.js +23 -14
  13. package/generators/app/questions/helper/default-values.js +13 -8
  14. package/generators/app/questions/helper/message.js +11 -7
  15. package/generators/app/questions/helper/tooltip.js +7 -4
  16. package/generators/app/questions/helper/validators.js +39 -29
  17. package/generators/app/questions/key-user.js +45 -40
  18. package/generators/app/questions/target-env.js +27 -22
  19. package/generators/app/types.js +16 -13
  20. package/generators/base/questions/credentials.js +18 -15
  21. package/generators/base/sub-gen-auth-base.js +30 -24
  22. package/generators/base/sub-gen-base.js +17 -11
  23. package/generators/change-data-source/index.js +13 -8
  24. package/generators/telemetry/collector.js +10 -6
  25. package/generators/telemetry/events.js +5 -2
  26. package/generators/telemetry/index.js +18 -2
  27. package/generators/types.js +5 -2
  28. package/generators/utils/appWizardCache.js +13 -7
  29. package/generators/utils/deps.d.ts +6 -0
  30. package/generators/utils/deps.js +52 -10
  31. package/generators/utils/i18n.js +20 -12
  32. package/generators/utils/logger.js +7 -4
  33. package/generators/utils/opts.js +6 -3
  34. package/generators/utils/parse-json-input.js +9 -5
  35. package/generators/utils/steps.js +48 -37
  36. package/generators/utils/subgenHelpers.js +14 -9
  37. package/generators/utils/templates.d.ts +4 -0
  38. package/generators/utils/templates.js +13 -7
  39. package/generators/utils/type-guards.js +6 -2
  40. package/generators/utils/workspace.js +13 -7
  41. package/package.json +7 -8
@@ -1,6 +1,11 @@
1
- import { t } from './i18n.js';
2
- import { getExtensionProjectData } from '../app/extension-project/index.js';
3
- import { AdaptationProjectType } from '@sap-ux/axios-extension';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addFlpGen = addFlpGen;
4
+ exports.addDeployGen = addDeployGen;
5
+ exports.addExtProjectGen = addExtProjectGen;
6
+ const i18n_js_1 = require("./i18n.js");
7
+ const index_js_1 = require("../app/extension-project/index.js");
8
+ const axios_extension_1 = require("@sap-ux/axios-extension");
4
9
  /**
5
10
  * Static validation configuration for package prompts in ADP deployment.
6
11
  */
@@ -20,7 +25,7 @@ const PACKAGE_ADDITIONAL_VALIDATION = {
20
25
  * @param {ToolsLogger} logger - Logger instance for tracking operations and errors.
21
26
  * @param {AppWizard} appWizard - AppWizard instance for interacting with the UI (optional).
22
27
  */
23
- export async function addFlpGen({ projectRootPath, vscode, inbounds, layer, prompts, isCfProject }, composeWith, logger, appWizard) {
28
+ async function addFlpGen({ projectRootPath, vscode, inbounds, layer, prompts, isCfProject }, composeWith, logger, appWizard) {
24
29
  try {
25
30
  /**
26
31
  * We are using this namespace for now because '@sap/fiori:adp-flp-config' is not yet bundled in '@sap/generator-fiori'.
@@ -55,9 +60,9 @@ export async function addFlpGen({ projectRootPath, vscode, inbounds, layer, prom
55
60
  * @param {ToolsLogger} logger - Logger for info and error output
56
61
  * @param {AppWizard} appWizard - Optional AppWizard instance for displaying UI messages
57
62
  */
58
- export async function addDeployGen({ projectName, projectPath, connectedSystem, system, projectType }, composeWith, logger, appWizard) {
63
+ async function addDeployGen({ projectName, projectPath, connectedSystem, system, projectType }, composeWith, logger, appWizard) {
59
64
  try {
60
- const hideIfOnPremise = projectType === AdaptationProjectType.ON_PREMISE;
65
+ const hideIfOnPremise = projectType === axios_extension_1.AdaptationProjectType.ON_PREMISE;
61
66
  const subGenPromptOptions = {
62
67
  ui5AbapRepo: { hideIfOnPremise },
63
68
  transportInputChoice: { hideIfOnPremise },
@@ -104,9 +109,9 @@ export async function addDeployGen({ projectName, projectPath, connectedSystem,
104
109
  * @param {ToolsLogger} logger - Logger instance for tracking operations and errors.
105
110
  * @param {AppWizard} appWizard - AppWizard instance for interacting with the UI (optional).
106
111
  */
107
- export async function addExtProjectGen({ configAnswers, attributeAnswers, systemLookup }, composeWith, logger, appWizard) {
112
+ async function addExtProjectGen({ configAnswers, attributeAnswers, systemLookup }, composeWith, logger, appWizard) {
108
113
  try {
109
- const data = await getExtensionProjectData(configAnswers, attributeAnswers, systemLookup);
114
+ const data = await (0, index_js_1.getExtensionProjectData)(configAnswers, attributeAnswers, systemLookup);
110
115
  await composeWith('@bas-dev/extensibility-sub', {
111
116
  arguments: [JSON.stringify(data)],
112
117
  appWizard
@@ -114,7 +119,7 @@ export async function addExtProjectGen({ configAnswers, attributeAnswers, system
114
119
  logger.info(`'@bas-dev/generator-extensibility-sub' was called.`);
115
120
  }
116
121
  catch (e) {
117
- logger.info(t('error.creatingExtensionProjectError'));
122
+ logger.info((0, i18n_js_1.t)('error.creatingExtensionProjectError'));
118
123
  logger.error(e);
119
124
  throw new Error(`Could not call '@bas-dev/generator-extensibility-sub' sub-generator: ${e.message}`);
120
125
  }
@@ -2,6 +2,10 @@
2
2
  * This function is used to get the path to the templates directory when this generator is bundled inside `@sap/generator-fiori`.
3
3
  * It is used to overwrite the templates directory.
4
4
  *
5
+ * Uses Node's CJS `__dirname` global at runtime (the package compiles to
6
+ * CommonJS — see tsconfig.json). Under ts-jest's ESM test transform
7
+ * `__dirname` is undefined and we fall back to `process.cwd()`.
8
+ *
5
9
  * @returns {string | undefined} The path to the templates directory.
6
10
  */
7
11
  export declare function getTemplatesOverwritePath(): string | undefined;
@@ -1,16 +1,22 @@
1
- import { existsSync } from 'node:fs';
2
- import { dirname, join } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- const __dirname = dirname(fileURLToPath(import.meta.url));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTemplatesOverwritePath = getTemplatesOverwritePath;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
5
6
  /**
6
7
  * This function is used to get the path to the templates directory when this generator is bundled inside `@sap/generator-fiori`.
7
8
  * It is used to overwrite the templates directory.
8
9
  *
10
+ * Uses Node's CJS `__dirname` global at runtime (the package compiles to
11
+ * CommonJS — see tsconfig.json). Under ts-jest's ESM test transform
12
+ * `__dirname` is undefined and we fall back to `process.cwd()`.
13
+ *
9
14
  * @returns {string | undefined} The path to the templates directory.
10
15
  */
11
- export function getTemplatesOverwritePath() {
12
- const templatePath = join(__dirname, 'templates');
13
- if (existsSync(templatePath)) {
16
+ function getTemplatesOverwritePath() {
17
+ const moduleDir = typeof __dirname === 'undefined' ? process.cwd() : __dirname;
18
+ const templatePath = (0, node_path_1.join)(moduleDir, 'templates');
19
+ if ((0, node_fs_1.existsSync)(templatePath)) {
14
20
  return templatePath;
15
21
  }
16
22
  return undefined;
@@ -1,10 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isString = isString;
4
+ exports.isJsonInput = isJsonInput;
1
5
  /**
2
6
  * Type guard for a string values.
3
7
  *
4
8
  * @param {unknown} value - The value being checked.
5
9
  * @returns {boolean} True if the value is of type string.
6
10
  */
7
- export function isString(value) {
11
+ function isString(value) {
8
12
  return typeof value === 'string';
9
13
  }
10
14
  /**
@@ -13,7 +17,7 @@ export function isString(value) {
13
17
  * @param {unknown} value - The value being checked.
14
18
  * @returns {boolean} True if the value conforms to the AdpJsonInput interface.
15
19
  */
16
- export function isJsonInput(value) {
20
+ function isJsonInput(value) {
17
21
  if (!isPlainObject(value)) {
18
22
  return false;
19
23
  }
@@ -1,5 +1,11 @@
1
- import { t } from './i18n.js';
2
- export const workspaceChoices = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.workspaceChoices = void 0;
4
+ exports.existsInWorkspace = existsInWorkspace;
5
+ exports.showWorkspaceFolderWarning = showWorkspaceFolderWarning;
6
+ exports.handleWorkspaceFolderChoice = handleWorkspaceFolderChoice;
7
+ const i18n_js_1 = require("./i18n.js");
8
+ exports.workspaceChoices = {
3
9
  OPEN_FOLDER: 'Open Folder',
4
10
  ADD_TO_WORKSPACE: 'Add Project to Workspace'
5
11
  };
@@ -10,7 +16,7 @@ export const workspaceChoices = {
10
16
  * @param {string} path - The path to check
11
17
  * @returns {boolean} True if the path exists in the workspace, false otherwise
12
18
  */
13
- export function existsInWorkspace(vscode, path) {
19
+ function existsInWorkspace(vscode, path) {
14
20
  const uri = vscode?.Uri?.file(path);
15
21
  return !!vscode.workspace.getWorkspaceFolder(uri);
16
22
  }
@@ -21,8 +27,8 @@ export function existsInWorkspace(vscode, path) {
21
27
  * @param {string} path - The path of the project
22
28
  * @returns {Promise<WorkspaceChoice | undefined>} The user's choice or undefined if dismissed
23
29
  */
24
- export async function showWorkspaceFolderWarning(vscode, path) {
25
- return vscode.window.showWarningMessage(t('prompts.projectNotInWorkspace', { path }), { modal: true }, workspaceChoices.OPEN_FOLDER, workspaceChoices.ADD_TO_WORKSPACE);
30
+ async function showWorkspaceFolderWarning(vscode, path) {
31
+ return vscode.window.showWarningMessage((0, i18n_js_1.t)('prompts.projectNotInWorkspace', { path }), { modal: true }, exports.workspaceChoices.OPEN_FOLDER, exports.workspaceChoices.ADD_TO_WORKSPACE);
26
32
  }
27
33
  /**
28
34
  * Handles the user's choice for workspace folder operations.
@@ -31,10 +37,10 @@ export async function showWorkspaceFolderWarning(vscode, path) {
31
37
  * @param {string} path - The path of the project
32
38
  * @param {WorkspaceChoice} userChoice - The user's choice from the warning dialog
33
39
  */
34
- export async function handleWorkspaceFolderChoice(vscode, path, userChoice) {
40
+ async function handleWorkspaceFolderChoice(vscode, path, userChoice) {
35
41
  const { workspace, commands } = vscode;
36
42
  const uri = vscode?.Uri?.file(path);
37
- if (userChoice === workspaceChoices.OPEN_FOLDER) {
43
+ if (userChoice === exports.workspaceChoices.OPEN_FOLDER) {
38
44
  await commands.executeCommand('vscode.openFolder', uri);
39
45
  }
40
46
  else {
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": "1.0.8",
6
+ "version": "1.0.9",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -12,7 +12,6 @@
12
12
  "bugs": {
13
13
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue"
14
14
  },
15
- "type": "module",
16
15
  "license": "Apache-2.0",
17
16
  "main": "generators/app/index.js",
18
17
  "files": [
@@ -31,19 +30,19 @@
31
30
  "i18next": "25.10.10",
32
31
  "yeoman-generator": "5.10.0",
33
32
  "uuid": "11.1.1",
34
- "@sap-ux/adp-tooling": "1.0.8",
35
33
  "@sap-ux/axios-extension": "2.0.1",
34
+ "@sap-ux/adp-tooling": "1.0.8",
36
35
  "@sap-ux/btp-utils": "2.0.1",
37
36
  "@sap-ux/feature-toggle": "1.0.1",
38
37
  "@sap-ux/inquirer-common": "1.0.6",
39
38
  "@sap-ux/logger": "1.0.1",
40
- "@sap-ux/project-access": "2.1.1",
41
- "@sap-ux/store": "2.0.1",
42
39
  "@sap-ux/system-access": "1.0.1",
43
- "@sap-ux/project-input-validator": "1.0.5",
44
- "@sap-ux/fiori-generator-shared": "1.0.6",
40
+ "@sap-ux/store": "2.0.1",
45
41
  "@sap-ux/odata-service-writer": "1.0.5",
46
- "@sap-ux/telemetry": "1.0.6"
42
+ "@sap-ux/fiori-generator-shared": "1.0.6",
43
+ "@sap-ux/telemetry": "1.0.6",
44
+ "@sap-ux/project-input-validator": "1.0.5",
45
+ "@sap-ux/project-access": "2.1.1"
47
46
  },
48
47
  "devDependencies": {
49
48
  "@jest/globals": "30.3.0",