@sap-ux/ui5-application-inquirer 0.7.15 → 0.8.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.
@@ -11,4 +11,11 @@ import type { UI5ApplicationPromptOptions, UI5ApplicationQuestion } from '../typ
11
11
  * @returns the prompts
12
12
  */
13
13
  export declare function getQuestions(ui5Versions: UI5Version[], promptOptions?: UI5ApplicationPromptOptions, capCdsInfo?: CdsUi5PluginInfo, isYUI?: boolean): UI5ApplicationQuestion[];
14
+ /**
15
+ * Get the `enableTypeScript` prompt.
16
+ *
17
+ * @param capCdsInfo CDS UI5 plugin information
18
+ * @returns The `enableTypeScript` prompt
19
+ */
20
+ export declare function getEnableTypeScriptPrompt(capCdsInfo?: CdsUi5PluginInfo): UI5ApplicationQuestion;
14
21
  //# sourceMappingURL=prompts.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getQuestions = getQuestions;
4
+ exports.getEnableTypeScriptPrompt = getEnableTypeScriptPrompt;
4
5
  const inquirer_common_1 = require("@sap-ux/inquirer-common");
5
6
  const project_access_1 = require("@sap-ux/project-access");
6
7
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
@@ -9,6 +10,7 @@ const i18n_1 = require("../i18n");
9
10
  const types_1 = require("../types");
10
11
  const prompt_helpers_1 = require("./prompt-helpers");
11
12
  const validators_1 = require("./validators");
13
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
12
14
  /**
13
15
  * Get the prompts that will provide input for UI5 application writing.
14
16
  *
@@ -34,15 +36,14 @@ function getQuestions(ui5Versions, promptOptions, capCdsInfo, isYUI = false) {
34
36
  [types_1.promptNames.description]: getDescriptionPrompt(),
35
37
  [types_1.promptNames.targetFolder]: getTargetFolderPrompt(targetDir, promptOptions?.[types_1.promptNames.targetFolder]?.validateFioriAppFolder),
36
38
  [types_1.promptNames.ui5Version]: getUI5VersionPrompt(ui5Versions, promptOptions?.ui5Version),
39
+ [types_1.promptNames.enableTypeScript]: getEnableTypeScriptPrompt(capCdsInfo),
37
40
  [types_1.promptNames.addDeployConfig]: getAddDeployConfigPrompt(targetDir, promptOptions?.addDeployConfig, isCapProject),
38
41
  [types_1.promptNames.addFlpConfig]: getAddFlpConfigPrompt(promptOptions?.addFlpConfig),
39
42
  [types_1.promptNames.showAdvanced]: getShowAdvancedPrompt(),
40
43
  [types_1.promptNames.ui5Theme]: getUI5ThemePrompt(),
41
44
  [types_1.promptNames.enableEslint]: getEnableEsLintPrompt(),
42
45
  [types_1.promptNames.enableCodeAssist]: getEnableCodeAssistPrompt(),
43
- [types_1.promptNames.skipAnnotations]: getSkipAnnotationsPrompt(),
44
- [types_1.promptNames.enableNPMWorkspaces]: getEnableNPMWorkspacesPrompt(capCdsInfo),
45
- [types_1.promptNames.enableTypeScript]: getEnableTypeScriptPrompt(capCdsInfo)
46
+ [types_1.promptNames.skipAnnotations]: getSkipAnnotationsPrompt()
46
47
  };
47
48
  // Hide not applicable prompts based on passed options or if this is a CAP project
48
49
  let questions = (0, prompt_helpers_1.hidePrompts)(keyedPrompts, promptOptions, isCapProject);
@@ -62,12 +63,17 @@ function getQuestions(ui5Versions, promptOptions, capCdsInfo, isYUI = false) {
62
63
  */
63
64
  function getEnableTypeScriptPrompt(capCdsInfo) {
64
65
  return {
65
- when: (answers) => {
66
+ when: () => {
66
67
  if (capCdsInfo) {
67
- return capCdsInfo.isCdsUi5PluginEnabled || !!answers?.enableNPMWorkspaces;
68
+ return capCdsInfo.isCdsUi5PluginEnabled || (capCdsInfo.hasMinCdsVersion && !capCdsInfo.hasCdsUi5Plugin);
68
69
  }
69
70
  return true;
70
71
  },
72
+ additionalMessages: (val) => {
73
+ if (val && capCdsInfo?.hasMinCdsVersion && !capCdsInfo?.hasCdsUi5Plugin) {
74
+ return { message: (0, i18n_1.t)('prompts.appEnableTypeScriptWarningMessage'), severity: yeoman_ui_types_1.Severity.warning };
75
+ }
76
+ },
71
77
  type: 'confirm',
72
78
  name: types_1.promptNames.enableTypeScript,
73
79
  message: (0, i18n_1.t)('prompts.appEnableTypeScriptMessage'),
@@ -77,29 +83,6 @@ function getEnableTypeScriptPrompt(capCdsInfo) {
77
83
  }
78
84
  };
79
85
  }
80
- /**
81
- * Get the `enableNPMWorkspaces` prompt.
82
- *
83
- * @param capCdsInfo CDS UI5 plugin information
84
- * @returns The `enableNPMWorkspaces` prompt
85
- */
86
- function getEnableNPMWorkspacesPrompt(capCdsInfo) {
87
- return {
88
- when: () => {
89
- if (capCdsInfo) {
90
- return capCdsInfo.hasMinCdsVersion && !capCdsInfo.hasCdsUi5Plugin;
91
- }
92
- return false;
93
- },
94
- type: 'confirm',
95
- name: types_1.promptNames.enableNPMWorkspaces,
96
- message: (0, i18n_1.t)('prompts.appEnableNpmWorkspacesMessage'),
97
- default: false,
98
- guiOptions: {
99
- breadcrumb: (0, i18n_1.t)('prompts.appEnableNpmWorkspacesBreadcrumb')
100
- }
101
- };
102
- }
103
86
  /**
104
87
  * Get the `skipAnnotations` prompt. Skipping annotation generation can be useful for CAP projects
105
88
  * where annotations may have been already created along with the service.
@@ -28,9 +28,8 @@
28
28
  "appEnableCodeAssistBreadcrumb": "Code Assist",
29
29
  "appSkipAnnotationsMessage": "Skip generation of associated annotations.cds file",
30
30
  "appSkipAnnotationsBreadcrumb": "Skip Annotations",
31
- "appEnableNpmWorkspacesMessage": "Generation of this application can update the CAP project to use NPM workspaces and an associated CDS plugin library (cds-plugin-ui5). Do you want to enable this feature? (Note: this is requirement for generating with TypeScript)",
32
- "appEnableNpmWorkspacesBreadcrumb": "Enable NPM Workspaces",
33
31
  "appEnableTypeScriptMessage": "Enable TypeScript",
32
+ "appEnableTypeScriptWarningMessage": "The CAP project will be updated to use NPM workspaces (this is a requirement for generating with TypeScript)",
34
33
  "appShowAdvancedOptionsMessage": "Configure advanced options",
35
34
  "appShowAdvancedOptionsHint": "Choosing 'No' will apply defaults"
36
35
  },
package/dist/types.d.ts CHANGED
@@ -15,7 +15,6 @@ export interface UI5ApplicationAnswers {
15
15
  enableCodeAssist?: boolean;
16
16
  skipAnnotations?: boolean;
17
17
  enableTypeScript?: boolean;
18
- enableNPMWorkspaces?: boolean;
19
18
  showAdvanced?: boolean;
20
19
  }
21
20
  /**
@@ -51,7 +50,6 @@ export declare enum promptNames {
51
50
  addFlpConfig = "addFlpConfig",
52
51
  ui5Theme = "ui5Theme",
53
52
  enableEslint = "enableEslint",
54
- enableNPMWorkspaces = "enableNPMWorkspaces",
55
53
  enableCodeAssist = "enableCodeAssist",
56
54
  skipAnnotations = "skipAnnotations",
57
55
  enableTypeScript = "enableTypeScript",
@@ -122,7 +120,7 @@ type NamePromptOptions = {
122
120
  /**
123
121
  * These are boolean value prompt option keys
124
122
  */
125
- type booleanPromptKeys = 'addDeployConfig' | 'addFlpConfig' | 'enableEslint' | 'skipAnnotations' | 'enableTypeScript' | 'enableCodeAssist' | 'showAdvanced' | 'enableNPMWorkspaces';
123
+ type booleanPromptKeys = 'addDeployConfig' | 'addFlpConfig' | 'enableEslint' | 'skipAnnotations' | 'enableTypeScript' | 'enableCodeAssist' | 'showAdvanced';
126
124
  type stringValuePromptType = Omit<typeof promptNames, booleanPromptKeys>;
127
125
  type stringValuePrompts = stringValuePromptType[keyof stringValuePromptType];
128
126
  type booleanValuePromptType = Pick<typeof promptNames, booleanPromptKeys>;
package/dist/types.js CHANGED
@@ -35,7 +35,6 @@ var promptNames;
35
35
  promptNames["addFlpConfig"] = "addFlpConfig";
36
36
  promptNames["ui5Theme"] = "ui5Theme";
37
37
  promptNames["enableEslint"] = "enableEslint";
38
- promptNames["enableNPMWorkspaces"] = "enableNPMWorkspaces";
39
38
  promptNames["enableCodeAssist"] = "enableCodeAssist";
40
39
  promptNames["skipAnnotations"] = "skipAnnotations";
41
40
  promptNames["enableTypeScript"] = "enableTypeScript";
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.7.15",
4
+ "version": "0.8.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -23,7 +23,7 @@
23
23
  "inquirer-autocomplete-prompt": "2.0.1",
24
24
  "lodash": "4.17.21",
25
25
  "semver": "7.5.4",
26
- "@sap-ux/inquirer-common": "0.5.2",
26
+ "@sap-ux/inquirer-common": "0.5.3",
27
27
  "@sap-ux/project-access": "1.28.7",
28
28
  "@sap-ux/project-input-validator": "0.3.3",
29
29
  "@sap-ux/ui5-info": "0.8.3"
@@ -35,7 +35,7 @@
35
35
  "@types/lodash": "4.14.202",
36
36
  "@types/semver": "7.5.4",
37
37
  "inquirer": "8.2.6",
38
- "@sap-ux/cap-config-writer": "0.7.59"
38
+ "@sap-ux/cap-config-writer": "0.7.60"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=18.x"