@sap-ux/ui5-application-inquirer 0.18.4 → 0.19.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.
@@ -43,12 +43,12 @@ async function getQuestions(ui5Versions, promptOptions, capCdsInfo, isYUI = fals
43
43
  [types_1.promptNames.title]: (0, prompts1_1.getTitlePrompt)(),
44
44
  [types_1.promptNames.namespace]: (0, prompts1_1.getNamespacePrompt)(appName),
45
45
  [types_1.promptNames.description]: (0, prompts1_1.getDescriptionPrompt)(),
46
- [types_1.promptNames.targetFolder]: (0, prompts1_1.getTargetFolderPrompt)(targetDir, shouldValidateFioriAppFolder),
46
+ [types_1.promptNames.targetFolder]: (0, prompts1_1.getTargetFolderPrompt)(targetDir, shouldValidateFioriAppFolder, isYUI),
47
47
  [types_1.promptNames.ui5Version]: (0, prompts1_1.getUI5VersionPrompt)(ui5Versions, promptOptions?.ui5Version),
48
48
  [types_1.promptNames.enableTypeScript]: (0, prompts1_1.getEnableTypeScriptPrompt)(),
49
49
  [types_1.promptNames.addDeployConfig]: (0, prompts1_1.getAddDeployConfigPrompt)(targetDir, promptOptions?.addDeployConfig, isCapProject),
50
50
  [types_1.promptNames.addFlpConfig]: (0, prompts1_1.getAddFlpConfigPrompt)(promptOptions?.addFlpConfig),
51
- [types_1.promptNames.enableVirtualEndpoints]: (0, prompts1_1.getEnableVirtualEndpoints)(),
51
+ [types_1.promptNames.enableVirtualEndpoints]: (0, prompts1_1.getEnableVirtualEndpoints)(capCdsInfo),
52
52
  [types_1.promptNames.showAdvanced]: (0, prompts2_1.getShowAdvancedPrompt)(),
53
53
  [types_1.promptNames.ui5Theme]: (0, prompts2_1.getUI5ThemePrompt)(),
54
54
  [types_1.promptNames.enableEslint]: (0, prompts2_1.getEnableEsLintPrompt)(),
@@ -1,6 +1,7 @@
1
1
  import { promptNames } from '../types';
2
2
  import type { UI5Version } from '@sap-ux/ui5-info';
3
3
  import type { UI5ApplicationPromptOptions, UI5ApplicationQuestion } from '../types';
4
+ import type { CdsUi5PluginInfo } from '@sap-ux/project-access';
4
5
  /**
5
6
  * Gets the `name` prompt.
6
7
  *
@@ -35,9 +36,10 @@ export declare function getDescriptionPrompt(): UI5ApplicationQuestion;
35
36
  *
36
37
  * @param targetDir provides a default value for the target folder path
37
38
  * @param validateFioriAppFolder validates the target folder path as a Fiori app project
39
+ * @param isYUI if true, input is returned unchanged (YUI folder browser already supplies absolute paths)
38
40
  * @returns the `targetFolder` prompt
39
41
  */
40
- export declare function getTargetFolderPrompt(targetDir: string, validateFioriAppFolder?: boolean): UI5ApplicationQuestion;
42
+ export declare function getTargetFolderPrompt(targetDir: string, validateFioriAppFolder?: boolean, isYUI?: boolean): UI5ApplicationQuestion;
41
43
  /**
42
44
  * Get the `ui5Version` prompt. If the ui5VersionPromptOption `defaultChoice` has been specified and an exact verion match is found
43
45
  * then the label from that option will be used instead of any other labels e.g. `(Maintained version)`
@@ -72,7 +74,8 @@ export declare function getAddFlpConfigPrompt(addFlpConfigOptions?: UI5Applicati
72
74
  /**
73
75
  * Get the `enableVirtualEndpoints` prompt.
74
76
  *
77
+ * @param capCdsInfo optional CDS UI5 plugin information for CAP projects
75
78
  * @returns the `enableVirtualEndpoints` prompt
76
79
  */
77
- export declare function getEnableVirtualEndpoints(): UI5ApplicationQuestion;
80
+ export declare function getEnableVirtualEndpoints(capCdsInfo?: CdsUi5PluginInfo): UI5ApplicationQuestion;
78
81
  //# sourceMappingURL=prompts1.d.ts.map
@@ -10,6 +10,7 @@ exports.getEnableTypeScriptPrompt = getEnableTypeScriptPrompt;
10
10
  exports.getAddDeployConfigPrompt = getAddDeployConfigPrompt;
11
11
  exports.getAddFlpConfigPrompt = getAddFlpConfigPrompt;
12
12
  exports.getEnableVirtualEndpoints = getEnableVirtualEndpoints;
13
+ const node_path_1 = require("node:path");
13
14
  const inquirer_common_1 = require("@sap-ux/inquirer-common");
14
15
  const project_access_1 = require("@sap-ux/project-access");
15
16
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
@@ -114,9 +115,10 @@ function getDescriptionPrompt() {
114
115
  *
115
116
  * @param targetDir provides a default value for the target folder path
116
117
  * @param validateFioriAppFolder validates the target folder path as a Fiori app project
118
+ * @param isYUI if true, input is returned unchanged (YUI folder browser already supplies absolute paths)
117
119
  * @returns the `targetFolder` prompt
118
120
  */
119
- function getTargetFolderPrompt(targetDir, validateFioriAppFolder) {
121
+ function getTargetFolderPrompt(targetDir, validateFioriAppFolder, isYUI) {
120
122
  return {
121
123
  type: 'input',
122
124
  name: types_1.promptNames.targetFolder,
@@ -128,6 +130,12 @@ function getTargetFolderPrompt(targetDir, validateFioriAppFolder) {
128
130
  breadcrumb: (0, i18n_1.t)('prompts.targetFolder.breadcrumb')
129
131
  },
130
132
  default: (answers) => answers.targetFolder || targetDir,
133
+ filter: (input) => {
134
+ if (isYUI) {
135
+ return input;
136
+ }
137
+ return input && !(0, node_path_1.isAbsolute)(input) ? (0, node_path_1.resolve)(input) : input;
138
+ },
131
139
  validate: async (target, { name = '' }) => {
132
140
  if (name.length > 2) {
133
141
  return await (0, project_input_validator_1.validateFioriAppTargetFolder)(target, name, validateFioriAppFolder);
@@ -244,9 +252,10 @@ function getAddFlpConfigPrompt(addFlpConfigOptions) {
244
252
  /**
245
253
  * Get the `enableVirtualEndpoints` prompt.
246
254
  *
255
+ * @param capCdsInfo optional CDS UI5 plugin information for CAP projects
247
256
  * @returns the `enableVirtualEndpoints` prompt
248
257
  */
249
- function getEnableVirtualEndpoints() {
258
+ function getEnableVirtualEndpoints(capCdsInfo) {
250
259
  return {
251
260
  type: 'confirm',
252
261
  name: types_1.promptNames.enableVirtualEndpoints,
@@ -255,7 +264,14 @@ function getEnableVirtualEndpoints() {
255
264
  breadcrumb: (0, i18n_1.t)('prompts.enableVirtualEndpoints.breadcrumb')
256
265
  },
257
266
  message: () => (0, i18n_1.t)('prompts.enableVirtualEndpoints.message'),
258
- default: true
267
+ default: true,
268
+ when: (answers) => {
269
+ if (!capCdsInfo) {
270
+ return true;
271
+ }
272
+ // For CAP Node.js: only show when cds-plugin-ui5 is present OR TypeScript is selected
273
+ return capCdsInfo.hasCdsUi5Plugin || answers.enableTypeScript === true;
274
+ }
259
275
  };
260
276
  }
261
277
  //# sourceMappingURL=prompts1.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/ui5-application-inquirer",
3
3
  "description": "Prompts module that can prompt users for inputs required for UI5 application writing",
4
- "version": "0.18.4",
4
+ "version": "0.19.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -25,8 +25,8 @@
25
25
  "semver": "7.7.4",
26
26
  "@sap-ux/inquirer-common": "0.13.2",
27
27
  "@sap-ux/project-access": "1.38.1",
28
- "@sap-ux/project-input-validator": "0.7.2",
29
- "@sap-ux/ui5-info": "0.14.0"
28
+ "@sap-ux/ui5-info": "0.14.0",
29
+ "@sap-ux/project-input-validator": "0.7.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@sap-devx/yeoman-ui-types": "1.25.0",