@sap-ux/ui5-application-inquirer 0.11.9 → 0.12.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.
- package/dist/prompts/index.d.ts +13 -1
- package/dist/prompts/index.js +62 -15
- package/dist/prompts/prompt-helpers.js +2 -2
- package/dist/prompts/prompts1.d.ts +80 -0
- package/dist/prompts/{prompts.js → prompts1.js} +152 -265
- package/dist/prompts/prompts2.d.ts +33 -0
- package/dist/prompts/prompts2.js +100 -0
- package/dist/translations/ui5-application-inquirer.i18n.json +65 -32
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/package.json +1 -1
- package/dist/prompts/prompts.d.ts +0 -21
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import type { UI5ApplicationPromptOptions, UI5ApplicationQuestion } from '../types';
|
|
2
|
+
import type { UI5Version } from '@sap-ux/ui5-info';
|
|
3
|
+
import type { CdsUi5PluginInfo } from '@sap-ux/project-access';
|
|
4
|
+
/**
|
|
5
|
+
* Get the prompts that will provide input for UI5 application writing.
|
|
6
|
+
*
|
|
7
|
+
* @param ui5Versions - ui5 versions to prompt for selection
|
|
8
|
+
* @param promptOptions - optional inputs used to pre-populate some prompt choices, default values and other prompting options. See {@link UI5ApplicationPromptOptions}.
|
|
9
|
+
* @param [capCdsInfo] - optional, additional information about CAP projects
|
|
10
|
+
* @param [isYUI] - optional, default is `false`. Changes the behaviour of some validation since YUI does not re-validate prompts that may be inter-dependant.
|
|
11
|
+
* @returns the prompts
|
|
12
|
+
*/
|
|
13
|
+
export declare function getQuestions(ui5Versions: UI5Version[], promptOptions?: UI5ApplicationPromptOptions, capCdsInfo?: CdsUi5PluginInfo, isYUI?: boolean): UI5ApplicationQuestion[];
|
|
2
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/prompts/index.js
CHANGED
|
@@ -1,18 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
3
|
+
exports.getQuestions = getQuestions;
|
|
4
|
+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
5
|
+
// Nullish coalescing operator lint warnings disabled as its not appropriate in most cases where empty strings are not considered valid
|
|
6
|
+
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
7
|
+
const prompts1_1 = require("./prompts1");
|
|
8
|
+
const prompts2_1 = require("./prompts2");
|
|
9
|
+
const types_1 = require("../types");
|
|
10
|
+
const prompt_helpers_1 = require("./prompt-helpers");
|
|
11
|
+
/**
|
|
12
|
+
* Get the prompts that will provide input for UI5 application writing.
|
|
13
|
+
*
|
|
14
|
+
* @param ui5Versions - ui5 versions to prompt for selection
|
|
15
|
+
* @param promptOptions - optional inputs used to pre-populate some prompt choices, default values and other prompting options. See {@link UI5ApplicationPromptOptions}.
|
|
16
|
+
* @param [capCdsInfo] - optional, additional information about CAP projects
|
|
17
|
+
* @param [isYUI] - optional, default is `false`. Changes the behaviour of some validation since YUI does not re-validate prompts that may be inter-dependant.
|
|
18
|
+
* @returns the prompts
|
|
19
|
+
*/
|
|
20
|
+
function getQuestions(ui5Versions, promptOptions, capCdsInfo, isYUI = false) {
|
|
21
|
+
// Set shared defaults
|
|
22
|
+
const appName = typeof promptOptions?.[types_1.promptNames.name]?.default === 'string'
|
|
23
|
+
? promptOptions[types_1.promptNames.name].default
|
|
24
|
+
: promptOptions?.[types_1.promptNames.name]?.defaultValue;
|
|
25
|
+
const targetDir = typeof promptOptions?.[types_1.promptNames.targetFolder]?.default === 'string'
|
|
26
|
+
? promptOptions[types_1.promptNames.targetFolder].default // Default functions will be applied later, these replace the existing defaults
|
|
27
|
+
: promptOptions?.[types_1.promptNames.targetFolder]?.defaultValue ?? process.cwd();
|
|
28
|
+
const isCapProject = !!capCdsInfo;
|
|
29
|
+
const keyedPrompts = {
|
|
30
|
+
[types_1.promptNames.name]: (0, prompts1_1.getNamePrompt)(targetDir, isCapProject, appName, isYUI),
|
|
31
|
+
[types_1.promptNames.title]: (0, prompts1_1.getTitlePrompt)(),
|
|
32
|
+
[types_1.promptNames.namespace]: (0, prompts1_1.getNamespacePrompt)(appName),
|
|
33
|
+
[types_1.promptNames.description]: (0, prompts1_1.getDescriptionPrompt)(),
|
|
34
|
+
[types_1.promptNames.targetFolder]: (0, prompts1_1.getTargetFolderPrompt)(targetDir, promptOptions?.[types_1.promptNames.targetFolder]?.validateFioriAppFolder),
|
|
35
|
+
[types_1.promptNames.ui5Version]: (0, prompts1_1.getUI5VersionPrompt)(ui5Versions, promptOptions?.ui5Version),
|
|
36
|
+
[types_1.promptNames.enableTypeScript]: (0, prompts1_1.getEnableTypeScriptPrompt)(capCdsInfo),
|
|
37
|
+
[types_1.promptNames.addDeployConfig]: (0, prompts1_1.getAddDeployConfigPrompt)(targetDir, promptOptions?.addDeployConfig, isCapProject),
|
|
38
|
+
[types_1.promptNames.addFlpConfig]: (0, prompts1_1.getAddFlpConfigPrompt)(promptOptions?.addFlpConfig),
|
|
39
|
+
[types_1.promptNames.enableVirtualEndpoints]: (0, prompts1_1.getEnableVirtualEndpoints)(),
|
|
40
|
+
[types_1.promptNames.showAdvanced]: (0, prompts2_1.getShowAdvancedPrompt)(),
|
|
41
|
+
[types_1.promptNames.ui5Theme]: (0, prompts2_1.getUI5ThemePrompt)(),
|
|
42
|
+
[types_1.promptNames.enableEslint]: (0, prompts2_1.getEnableEsLintPrompt)(),
|
|
43
|
+
[types_1.promptNames.enableCodeAssist]: (0, prompts2_1.getEnableCodeAssistPrompt)(),
|
|
44
|
+
[types_1.promptNames.skipAnnotations]: (0, prompts2_1.getSkipAnnotationsPrompt)()
|
|
45
|
+
};
|
|
46
|
+
// Hide not applicable prompts based on passed options or if this is a CAP project
|
|
47
|
+
let questions = (0, prompt_helpers_1.hidePrompts)(keyedPrompts, promptOptions, isCapProject);
|
|
48
|
+
// Add an additional condition to 'advanced' prompts so they can be shown/hidden at runtime
|
|
49
|
+
applyAdvancedOption(questions, promptOptions);
|
|
50
|
+
// Apply extended `validate`, `additionalMessages` or override `default` prompt properties
|
|
51
|
+
if (promptOptions) {
|
|
52
|
+
questions = (0, inquirer_common_1.extendWithOptions)(questions, promptOptions);
|
|
53
|
+
}
|
|
54
|
+
return questions;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Applies the advanced grouping option which will hide the specified prompts behind and advanced options prompt.
|
|
58
|
+
*
|
|
59
|
+
* @param questions the questions to which the advanced option condition may be applied
|
|
60
|
+
* @param promptOptions the prompt options which specify which prompts should be grouped as advanced options
|
|
61
|
+
*/
|
|
62
|
+
function applyAdvancedOption(questions, promptOptions) {
|
|
63
|
+
(0, inquirer_common_1.withCondition)(questions.filter(({ name }) => promptOptions?.[name]?.advancedOption), (answers) => answers.showAdvanced ?? false);
|
|
64
|
+
}
|
|
18
65
|
//# sourceMappingURL=index.js.map
|
|
@@ -28,9 +28,9 @@ function appPathExists(appName, targetPath) {
|
|
|
28
28
|
*/
|
|
29
29
|
function defaultAppName(targetPath) {
|
|
30
30
|
let defProjNum = i18n_1.defaultProjectNumber;
|
|
31
|
-
let defaultName = (0, i18n_1.t)('prompts.
|
|
31
|
+
let defaultName = (0, i18n_1.t)('prompts.name.default');
|
|
32
32
|
while (exports.appPathExists(`${defaultName}`, targetPath)) {
|
|
33
|
-
defaultName = (0, i18n_1.t)('prompts.
|
|
33
|
+
defaultName = (0, i18n_1.t)('prompts.name.default', { defaultProjectNumber: ++defProjNum });
|
|
34
34
|
// Dont loop forever, user will need to provide input otherwise
|
|
35
35
|
if (defProjNum > 999) {
|
|
36
36
|
break;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { promptNames } from '../types';
|
|
2
|
+
import type { UI5Version } from '@sap-ux/ui5-info';
|
|
3
|
+
import type { UI5ApplicationPromptOptions, UI5ApplicationQuestion } from '../types';
|
|
4
|
+
import type { CdsUi5PluginInfo } from '@sap-ux/project-access';
|
|
5
|
+
/**
|
|
6
|
+
* Gets the `name` prompt.
|
|
7
|
+
*
|
|
8
|
+
* @param targetDir the directory path to search for exiting apps with the same name
|
|
9
|
+
* @param isCapProject if the app is to be generated in a CAP project ensure that the name is unique within the CAP apps folder path
|
|
10
|
+
* @param appName the default app name, if not provided a default app name will be suggested
|
|
11
|
+
* @param isYUI If true, do not use `targetFolder` value when validating the name for existence, since YUI will not re-validate when `targetFolder` is updated.
|
|
12
|
+
* @returns the UI5 application `name` prompt
|
|
13
|
+
*/
|
|
14
|
+
export declare function getNamePrompt(targetDir: string, isCapProject: boolean, appName?: string, isYUI?: boolean): UI5ApplicationQuestion;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the `title` prompt.
|
|
17
|
+
*
|
|
18
|
+
* @returns the `title` prompt
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTitlePrompt(): UI5ApplicationQuestion;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the `namespace` prompt.
|
|
23
|
+
*
|
|
24
|
+
* @param appName the application is used as part of namespace validation to determine max combined length
|
|
25
|
+
* @returns the `namespace` prompt
|
|
26
|
+
*/
|
|
27
|
+
export declare function getNamespacePrompt(appName?: string): UI5ApplicationQuestion;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the `description` prompt.
|
|
30
|
+
*
|
|
31
|
+
* @returns the `description` prompt
|
|
32
|
+
*/
|
|
33
|
+
export declare function getDescriptionPrompt(): UI5ApplicationQuestion;
|
|
34
|
+
/**
|
|
35
|
+
* Gets the `targetFolder` prompt.
|
|
36
|
+
*
|
|
37
|
+
* @param targetDir provides a default value for the target folder path
|
|
38
|
+
* @param validateFioriAppFolder validates the target folder path as a Fiori app project
|
|
39
|
+
* @returns the `targetFolder` prompt
|
|
40
|
+
*/
|
|
41
|
+
export declare function getTargetFolderPrompt(targetDir: string, validateFioriAppFolder?: boolean): UI5ApplicationQuestion;
|
|
42
|
+
/**
|
|
43
|
+
* Get the `ui5Version` prompt. If the ui5VersionPromptOption `defaultChoice` has been specified and an exact verion match is found
|
|
44
|
+
* then the label from that option will be used instead of any other labels e.g. `(Maintained version)`
|
|
45
|
+
*
|
|
46
|
+
* @param ui5Versions the UI5 versions that will be available for selection
|
|
47
|
+
* @param ui5VersionPromptOptions UI5 version prompt options
|
|
48
|
+
* @returns the `ui5Version` prompt
|
|
49
|
+
*/
|
|
50
|
+
export declare function getUI5VersionPrompt(ui5Versions?: UI5Version[], ui5VersionPromptOptions?: UI5ApplicationPromptOptions[promptNames.ui5Version]): UI5ApplicationQuestion;
|
|
51
|
+
/**
|
|
52
|
+
* Get the `enableTypeScript` prompt.
|
|
53
|
+
*
|
|
54
|
+
* @param capCdsInfo CDS UI5 plugin information
|
|
55
|
+
* @returns The `enableTypeScript` prompt
|
|
56
|
+
*/
|
|
57
|
+
export declare function getEnableTypeScriptPrompt(capCdsInfo?: CdsUi5PluginInfo): UI5ApplicationQuestion;
|
|
58
|
+
/**
|
|
59
|
+
* Gets the `addDeployConfig` prompt.
|
|
60
|
+
*
|
|
61
|
+
* @param targetDir determines the path to search for `mta.yaml`
|
|
62
|
+
* @param addDeployConfigOptions add deploy configuration prompt options
|
|
63
|
+
* @param isCapProject is this a CAP project
|
|
64
|
+
* @returns the `addDeployConfig` prompt
|
|
65
|
+
*/
|
|
66
|
+
export declare function getAddDeployConfigPrompt(targetDir: string, addDeployConfigOptions?: UI5ApplicationPromptOptions[promptNames.addDeployConfig], isCapProject?: boolean): UI5ApplicationQuestion;
|
|
67
|
+
/**
|
|
68
|
+
* Get the `addFlpConfig` prompt.
|
|
69
|
+
*
|
|
70
|
+
* @param addFlpConfigOptions the
|
|
71
|
+
* @returns The `addFlpConfig` prompt
|
|
72
|
+
*/
|
|
73
|
+
export declare function getAddFlpConfigPrompt(addFlpConfigOptions?: UI5ApplicationPromptOptions[promptNames.addFlpConfig]): UI5ApplicationQuestion;
|
|
74
|
+
/**
|
|
75
|
+
* Get the `enableVirtualEndpoints` prompt.
|
|
76
|
+
*
|
|
77
|
+
* @returns the `enableVirtualEndpoints` prompt
|
|
78
|
+
*/
|
|
79
|
+
export declare function getEnableVirtualEndpoints(): UI5ApplicationQuestion;
|
|
80
|
+
//# sourceMappingURL=prompts1.d.ts.map
|
|
@@ -1,197 +1,197 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getNamePrompt = getNamePrompt;
|
|
4
|
+
exports.getTitlePrompt = getTitlePrompt;
|
|
5
|
+
exports.getNamespacePrompt = getNamespacePrompt;
|
|
6
|
+
exports.getDescriptionPrompt = getDescriptionPrompt;
|
|
7
|
+
exports.getTargetFolderPrompt = getTargetFolderPrompt;
|
|
8
|
+
exports.getUI5VersionPrompt = getUI5VersionPrompt;
|
|
4
9
|
exports.getEnableTypeScriptPrompt = getEnableTypeScriptPrompt;
|
|
10
|
+
exports.getAddDeployConfigPrompt = getAddDeployConfigPrompt;
|
|
11
|
+
exports.getAddFlpConfigPrompt = getAddFlpConfigPrompt;
|
|
12
|
+
exports.getEnableVirtualEndpoints = getEnableVirtualEndpoints;
|
|
5
13
|
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
6
14
|
const project_access_1 = require("@sap-ux/project-access");
|
|
7
15
|
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
8
|
-
const ui5_info_1 = require("@sap-ux/ui5-info");
|
|
9
16
|
const i18n_1 = require("../i18n");
|
|
10
17
|
const types_1 = require("../types");
|
|
11
18
|
const prompt_helpers_1 = require("./prompt-helpers");
|
|
12
19
|
const validators_1 = require("./validators");
|
|
13
20
|
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
14
21
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @param ui5Versions - ui5 versions to prompt for selection
|
|
18
|
-
* @param promptOptions - optional inputs used to pre-populate some prompt choices, default values and other prompting options. See {@link UI5ApplicationPromptOptions}.
|
|
19
|
-
* @param [capCdsInfo] - optional, additional information about CAP projects
|
|
20
|
-
* @param [isYUI] - optional, default is `false`. Changes the behaviour of some validation since YUI does not re-validate prompts that may be inter-dependant.
|
|
21
|
-
* @returns the prompts
|
|
22
|
-
*/
|
|
23
|
-
function getQuestions(ui5Versions, promptOptions, capCdsInfo, isYUI = false) {
|
|
24
|
-
// Set shared defaults
|
|
25
|
-
const appName = typeof promptOptions?.[types_1.promptNames.name]?.default === 'string'
|
|
26
|
-
? promptOptions[types_1.promptNames.name].default
|
|
27
|
-
: promptOptions?.[types_1.promptNames.name]?.defaultValue;
|
|
28
|
-
const targetDir = typeof promptOptions?.[types_1.promptNames.targetFolder]?.default === 'string'
|
|
29
|
-
? promptOptions[types_1.promptNames.targetFolder].default // Default functions will be applied later, these replace the existing defaults
|
|
30
|
-
: promptOptions?.[types_1.promptNames.targetFolder]?.defaultValue ?? process.cwd();
|
|
31
|
-
const isCapProject = !!capCdsInfo;
|
|
32
|
-
const keyedPrompts = {
|
|
33
|
-
[types_1.promptNames.name]: getNamePrompt(targetDir, isCapProject, appName, isYUI),
|
|
34
|
-
[types_1.promptNames.title]: getTitlePrompt(),
|
|
35
|
-
[types_1.promptNames.namespace]: getNamespacePrompt(appName),
|
|
36
|
-
[types_1.promptNames.description]: getDescriptionPrompt(),
|
|
37
|
-
[types_1.promptNames.targetFolder]: getTargetFolderPrompt(targetDir, promptOptions?.[types_1.promptNames.targetFolder]?.validateFioriAppFolder),
|
|
38
|
-
[types_1.promptNames.ui5Version]: getUI5VersionPrompt(ui5Versions, promptOptions?.ui5Version),
|
|
39
|
-
[types_1.promptNames.enableTypeScript]: getEnableTypeScriptPrompt(capCdsInfo),
|
|
40
|
-
[types_1.promptNames.addDeployConfig]: getAddDeployConfigPrompt(targetDir, promptOptions?.addDeployConfig, isCapProject),
|
|
41
|
-
[types_1.promptNames.addFlpConfig]: getAddFlpConfigPrompt(promptOptions?.addFlpConfig),
|
|
42
|
-
[types_1.promptNames.showAdvanced]: getShowAdvancedPrompt(),
|
|
43
|
-
[types_1.promptNames.ui5Theme]: getUI5ThemePrompt(),
|
|
44
|
-
[types_1.promptNames.enableEslint]: getEnableEsLintPrompt(),
|
|
45
|
-
[types_1.promptNames.enableCodeAssist]: getEnableCodeAssistPrompt(),
|
|
46
|
-
[types_1.promptNames.skipAnnotations]: getSkipAnnotationsPrompt()
|
|
47
|
-
};
|
|
48
|
-
// Hide not applicable prompts based on passed options or if this is a CAP project
|
|
49
|
-
let questions = (0, prompt_helpers_1.hidePrompts)(keyedPrompts, promptOptions, isCapProject);
|
|
50
|
-
// Add an additional condition to 'advanced' prompts so they can be shown/hidden at runtime
|
|
51
|
-
applyAdvancedOption(questions, promptOptions);
|
|
52
|
-
// Apply extended `validate`, `additionalMessages` or override `default` prompt properties
|
|
53
|
-
if (promptOptions) {
|
|
54
|
-
questions = (0, inquirer_common_1.extendWithOptions)(questions, promptOptions);
|
|
55
|
-
}
|
|
56
|
-
return questions;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Get the `enableTypeScript` prompt.
|
|
22
|
+
* Gets the `name` prompt.
|
|
60
23
|
*
|
|
61
|
-
* @param
|
|
62
|
-
* @
|
|
24
|
+
* @param targetDir the directory path to search for exiting apps with the same name
|
|
25
|
+
* @param isCapProject if the app is to be generated in a CAP project ensure that the name is unique within the CAP apps folder path
|
|
26
|
+
* @param appName the default app name, if not provided a default app name will be suggested
|
|
27
|
+
* @param isYUI If true, do not use `targetFolder` value when validating the name for existence, since YUI will not re-validate when `targetFolder` is updated.
|
|
28
|
+
* @returns the UI5 application `name` prompt
|
|
63
29
|
*/
|
|
64
|
-
function
|
|
30
|
+
function getNamePrompt(targetDir, isCapProject, appName, isYUI) {
|
|
65
31
|
return {
|
|
66
|
-
|
|
67
|
-
if (capCdsInfo) {
|
|
68
|
-
return capCdsInfo.isCdsUi5PluginEnabled || (capCdsInfo.hasMinCdsVersion && !capCdsInfo.hasCdsUi5Plugin);
|
|
69
|
-
}
|
|
70
|
-
return true;
|
|
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
|
-
},
|
|
77
|
-
type: 'confirm',
|
|
78
|
-
name: types_1.promptNames.enableTypeScript,
|
|
79
|
-
message: (0, i18n_1.t)('prompts.appEnableTypeScriptMessage'),
|
|
80
|
-
default: false,
|
|
32
|
+
type: 'input',
|
|
81
33
|
guiOptions: {
|
|
34
|
+
applyDefaultWhenDirty: true,
|
|
35
|
+
hint: (0, i18n_1.t)('prompts.name.tooltip'),
|
|
36
|
+
mandatory: true,
|
|
82
37
|
breadcrumb: true
|
|
38
|
+
},
|
|
39
|
+
name: types_1.promptNames.name,
|
|
40
|
+
message: (0, i18n_1.t)('prompts.name.message'),
|
|
41
|
+
default: (answers) => answers.name || appName || (0, prompt_helpers_1.defaultAppName)(targetDir),
|
|
42
|
+
validate: (name, answers) => {
|
|
43
|
+
// In a CLI context, we need to validate the name within the default target folder - that it does not already exist.
|
|
44
|
+
// Also as CAP project folder is set and can't be updated, we need to validate the app name doest not already exist within the CAP project.
|
|
45
|
+
const shouldValidateNamePath = !isYUI || isCapProject;
|
|
46
|
+
if (shouldValidateNamePath) {
|
|
47
|
+
return (0, validators_1.validateAppName)(name, answers.targetFolder || targetDir);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return (0, project_input_validator_1.validateModuleName)(name);
|
|
51
|
+
}
|
|
83
52
|
}
|
|
84
53
|
};
|
|
85
54
|
}
|
|
86
55
|
/**
|
|
87
|
-
*
|
|
88
|
-
* where annotations may have been already created along with the service.
|
|
56
|
+
* Gets the `title` prompt.
|
|
89
57
|
*
|
|
90
|
-
* @returns
|
|
58
|
+
* @returns the `title` prompt
|
|
91
59
|
*/
|
|
92
|
-
function
|
|
60
|
+
function getTitlePrompt() {
|
|
93
61
|
return {
|
|
94
|
-
type: '
|
|
95
|
-
name: types_1.promptNames.skipAnnotations,
|
|
96
|
-
message: (0, i18n_1.t)('prompts.appSkipAnnotationsMessage'),
|
|
97
|
-
default: false,
|
|
62
|
+
type: 'input',
|
|
98
63
|
guiOptions: {
|
|
99
|
-
|
|
100
|
-
|
|
64
|
+
hint: (0, i18n_1.t)('prompts.title.tooltip'),
|
|
65
|
+
breadcrumb: true
|
|
66
|
+
},
|
|
67
|
+
name: types_1.promptNames.title,
|
|
68
|
+
message: (0, i18n_1.t)('prompts.title.message'),
|
|
69
|
+
default: (answers) => answers.title || (0, i18n_1.t)('prompts.title.default')
|
|
101
70
|
};
|
|
102
71
|
}
|
|
103
72
|
/**
|
|
104
|
-
*
|
|
73
|
+
* Gets the `namespace` prompt.
|
|
105
74
|
*
|
|
106
|
-
* @
|
|
75
|
+
* @param appName the application is used as part of namespace validation to determine max combined length
|
|
76
|
+
* @returns the `namespace` prompt
|
|
107
77
|
*/
|
|
108
|
-
function
|
|
78
|
+
function getNamespacePrompt(appName) {
|
|
109
79
|
return {
|
|
110
|
-
|
|
111
|
-
type: 'confirm',
|
|
112
|
-
name: types_1.promptNames.enableCodeAssist,
|
|
113
|
-
message: (0, i18n_1.t)('prompts.appEnableCodeAssistMessage'),
|
|
114
|
-
default: false,
|
|
80
|
+
type: 'input',
|
|
115
81
|
guiOptions: {
|
|
116
|
-
|
|
82
|
+
hint: (0, i18n_1.t)('prompts.namespace.tooltip'),
|
|
83
|
+
breadcrumb: true
|
|
84
|
+
},
|
|
85
|
+
name: types_1.promptNames.namespace,
|
|
86
|
+
message: (0, i18n_1.t)('prompts.namespace.message'),
|
|
87
|
+
default: (answers) => answers.namespace ?? '',
|
|
88
|
+
validate: (namespace, answers) => {
|
|
89
|
+
if (namespace) {
|
|
90
|
+
return (0, project_input_validator_1.validateNamespace)(namespace, answers.name || appName);
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
117
93
|
}
|
|
118
94
|
};
|
|
119
95
|
}
|
|
120
96
|
/**
|
|
121
|
-
*
|
|
97
|
+
* Gets the `description` prompt.
|
|
122
98
|
*
|
|
123
|
-
* @returns
|
|
99
|
+
* @returns the `description` prompt
|
|
124
100
|
*/
|
|
125
|
-
function
|
|
101
|
+
function getDescriptionPrompt() {
|
|
126
102
|
return {
|
|
127
|
-
type: '
|
|
128
|
-
name: types_1.promptNames.
|
|
129
|
-
message: (0, i18n_1.t)('prompts.appEnableEslintMessage'),
|
|
130
|
-
default: false,
|
|
103
|
+
type: 'input',
|
|
104
|
+
name: types_1.promptNames.description,
|
|
131
105
|
guiOptions: {
|
|
132
|
-
|
|
133
|
-
|
|
106
|
+
hint: (0, i18n_1.t)('prompts.description.tooltip'),
|
|
107
|
+
breadcrumb: true
|
|
108
|
+
},
|
|
109
|
+
message: (0, i18n_1.t)('prompts.description.message'),
|
|
110
|
+
default: (answers) => answers.description || (0, i18n_1.t)('prompts.description.default')
|
|
134
111
|
};
|
|
135
112
|
}
|
|
136
113
|
/**
|
|
137
|
-
*
|
|
114
|
+
* Gets the `targetFolder` prompt.
|
|
138
115
|
*
|
|
139
|
-
* @
|
|
116
|
+
* @param targetDir provides a default value for the target folder path
|
|
117
|
+
* @param validateFioriAppFolder validates the target folder path as a Fiori app project
|
|
118
|
+
* @returns the `targetFolder` prompt
|
|
140
119
|
*/
|
|
141
|
-
function
|
|
120
|
+
function getTargetFolderPrompt(targetDir, validateFioriAppFolder) {
|
|
142
121
|
return {
|
|
143
|
-
type: '
|
|
144
|
-
name: types_1.promptNames.
|
|
145
|
-
message: (0, i18n_1.t)('prompts.
|
|
122
|
+
type: 'input',
|
|
123
|
+
name: types_1.promptNames.targetFolder,
|
|
124
|
+
message: (0, i18n_1.t)('prompts.targetFolder.message'),
|
|
125
|
+
guiType: 'folder-browser',
|
|
146
126
|
guiOptions: {
|
|
147
127
|
applyDefaultWhenDirty: true,
|
|
148
|
-
|
|
128
|
+
mandatory: true,
|
|
129
|
+
breadcrumb: (0, i18n_1.t)('prompts.targetFolder.breadcrumb')
|
|
149
130
|
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (
|
|
153
|
-
|
|
131
|
+
default: (answers) => answers.targetFolder || targetDir,
|
|
132
|
+
validate: async (target, { name = '' }) => {
|
|
133
|
+
if (name.length > 2) {
|
|
134
|
+
return await (0, project_input_validator_1.validateFioriAppTargetFolder)(target, name, validateFioriAppFolder);
|
|
154
135
|
}
|
|
155
|
-
return
|
|
136
|
+
return false;
|
|
156
137
|
}
|
|
157
138
|
};
|
|
158
139
|
}
|
|
159
140
|
/**
|
|
160
|
-
* Get the `
|
|
141
|
+
* Get the `ui5Version` prompt. If the ui5VersionPromptOption `defaultChoice` has been specified and an exact verion match is found
|
|
142
|
+
* then the label from that option will be used instead of any other labels e.g. `(Maintained version)`
|
|
161
143
|
*
|
|
162
|
-
* @
|
|
144
|
+
* @param ui5Versions the UI5 versions that will be available for selection
|
|
145
|
+
* @param ui5VersionPromptOptions UI5 version prompt options
|
|
146
|
+
* @returns the `ui5Version` prompt
|
|
163
147
|
*/
|
|
164
|
-
function
|
|
148
|
+
function getUI5VersionPrompt(ui5Versions = [], ui5VersionPromptOptions) {
|
|
149
|
+
// Set the default to be closest to the passed value or the default as defined by ui5 version service
|
|
150
|
+
const defaultChoice = (0, inquirer_common_1.getDefaultUI5VersionChoice)(ui5Versions, ui5VersionPromptOptions?.defaultChoice);
|
|
151
|
+
const ui5VersionChoices = (0, inquirer_common_1.ui5VersionsGrouped)(ui5Versions, ui5VersionPromptOptions?.includeSeparators, defaultChoice, !!ui5VersionPromptOptions?.defaultChoice && ui5VersionPromptOptions.defaultChoice.value === defaultChoice?.value);
|
|
165
152
|
return {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
153
|
+
when: () => !!ui5VersionChoices,
|
|
154
|
+
type: ui5VersionPromptOptions?.useAutocomplete ? 'autocomplete' : 'list',
|
|
155
|
+
name: types_1.promptNames.ui5Version,
|
|
169
156
|
guiOptions: {
|
|
170
|
-
hint: (0, i18n_1.t)('prompts.
|
|
157
|
+
hint: (0, i18n_1.t)('prompts.ui5Version.tooltip'),
|
|
158
|
+
breadcrumb: (0, i18n_1.t)('prompts.ui5Version.breadcrumb')
|
|
171
159
|
},
|
|
172
|
-
|
|
160
|
+
choices: () => ui5VersionChoices,
|
|
161
|
+
source: (prevAnswers, input) => (0, inquirer_common_1.searchChoices)(input, ui5VersionChoices),
|
|
162
|
+
message: (0, i18n_1.t)('prompts.ui5Version.message'),
|
|
163
|
+
default: () => {
|
|
164
|
+
return defaultChoice?.value;
|
|
165
|
+
}
|
|
173
166
|
};
|
|
174
167
|
}
|
|
175
168
|
/**
|
|
176
|
-
* Get the `
|
|
169
|
+
* Get the `enableTypeScript` prompt.
|
|
177
170
|
*
|
|
178
|
-
* @param
|
|
179
|
-
* @returns The `
|
|
171
|
+
* @param capCdsInfo CDS UI5 plugin information
|
|
172
|
+
* @returns The `enableTypeScript` prompt
|
|
180
173
|
*/
|
|
181
|
-
function
|
|
174
|
+
function getEnableTypeScriptPrompt(capCdsInfo) {
|
|
182
175
|
return {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
breadcrumb: (0, i18n_1.t)('prompts.appAddFlpConfigBreadcrumb')
|
|
187
|
-
},
|
|
188
|
-
message: () => (0, i18n_1.t)('prompts.appAddFlpConfigMessage'),
|
|
189
|
-
default: false,
|
|
190
|
-
validate: (addFlpConfig) => {
|
|
191
|
-
if (typeof addFlpConfigOptions?.validatorCallback === 'function') {
|
|
192
|
-
addFlpConfigOptions.validatorCallback(addFlpConfig, types_1.promptNames.addFlpConfig);
|
|
176
|
+
when: () => {
|
|
177
|
+
if (capCdsInfo) {
|
|
178
|
+
return capCdsInfo.isCdsUi5PluginEnabled || (capCdsInfo.hasMinCdsVersion && !capCdsInfo.hasCdsUi5Plugin);
|
|
193
179
|
}
|
|
194
180
|
return true;
|
|
181
|
+
},
|
|
182
|
+
additionalMessages: (val) => {
|
|
183
|
+
let message;
|
|
184
|
+
if (val && capCdsInfo?.hasMinCdsVersion && !capCdsInfo?.hasCdsUi5Plugin) {
|
|
185
|
+
message = { message: (0, i18n_1.t)('prompts.enableTypeScript.warningMsg'), severity: yeoman_ui_types_1.Severity.warning };
|
|
186
|
+
}
|
|
187
|
+
return message;
|
|
188
|
+
},
|
|
189
|
+
type: 'confirm',
|
|
190
|
+
name: types_1.promptNames.enableTypeScript,
|
|
191
|
+
message: (0, i18n_1.t)('prompts.enableTypeScript.message'),
|
|
192
|
+
default: false,
|
|
193
|
+
guiOptions: {
|
|
194
|
+
breadcrumb: true
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
}
|
|
@@ -209,7 +209,7 @@ function getAddDeployConfigPrompt(targetDir, addDeployConfigOptions, isCapProjec
|
|
|
209
209
|
type: 'confirm',
|
|
210
210
|
name: types_1.promptNames.addDeployConfig,
|
|
211
211
|
guiOptions: {
|
|
212
|
-
breadcrumb: (0, i18n_1.t)('prompts.
|
|
212
|
+
breadcrumb: (0, i18n_1.t)('prompts.addDeployConfig.breadcrumb')
|
|
213
213
|
},
|
|
214
214
|
// If the target directory is a CAP project then only offer `addDeployConfig (addToMta)` if an mta file is found
|
|
215
215
|
when: async (answers) => {
|
|
@@ -218,11 +218,11 @@ function getAddDeployConfigPrompt(targetDir, addDeployConfigOptions, isCapProjec
|
|
|
218
218
|
},
|
|
219
219
|
message: () => {
|
|
220
220
|
return mtaPath
|
|
221
|
-
? (0, i18n_1.t)('prompts.
|
|
221
|
+
? (0, i18n_1.t)('prompts.addDeployConfig.mtaMessage', {
|
|
222
222
|
path: mtaPath,
|
|
223
223
|
interpolation: { escapeValue: false }
|
|
224
224
|
})
|
|
225
|
-
: (0, i18n_1.t)('prompts.
|
|
225
|
+
: (0, i18n_1.t)('prompts.addDeployConfig.message');
|
|
226
226
|
},
|
|
227
227
|
default: async () => !!mtaPath,
|
|
228
228
|
validate: (addDeployConfig) => {
|
|
@@ -234,156 +234,43 @@ function getAddDeployConfigPrompt(targetDir, addDeployConfigOptions, isCapProjec
|
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
|
-
* Get the `
|
|
238
|
-
* then the label from that option will be used instead of any other labels e.g. `(Maintained version)`
|
|
239
|
-
*
|
|
240
|
-
* @param ui5Versions the UI5 versions that will be available for selection
|
|
241
|
-
* @param ui5VersionPromptOptions UI5 version prompt options
|
|
242
|
-
* @returns the `ui5Version` prompt
|
|
243
|
-
*/
|
|
244
|
-
function getUI5VersionPrompt(ui5Versions = [], ui5VersionPromptOptions) {
|
|
245
|
-
// Set the default to be closest to the passed value or the default as defined by ui5 version service
|
|
246
|
-
const defaultChoice = (0, inquirer_common_1.getDefaultUI5VersionChoice)(ui5Versions, ui5VersionPromptOptions?.defaultChoice);
|
|
247
|
-
const ui5VersionChoices = (0, inquirer_common_1.ui5VersionsGrouped)(ui5Versions, ui5VersionPromptOptions?.includeSeparators, defaultChoice, !!ui5VersionPromptOptions?.defaultChoice && ui5VersionPromptOptions.defaultChoice.value === defaultChoice?.value);
|
|
248
|
-
return {
|
|
249
|
-
when: () => !!ui5VersionChoices,
|
|
250
|
-
type: ui5VersionPromptOptions?.useAutocomplete ? 'autocomplete' : 'list',
|
|
251
|
-
name: types_1.promptNames.ui5Version,
|
|
252
|
-
guiOptions: {
|
|
253
|
-
hint: (0, i18n_1.t)('prompts.appUi5VersionTooltip'),
|
|
254
|
-
breadcrumb: (0, i18n_1.t)('prompts.appUi5VersionBreadcrumb')
|
|
255
|
-
},
|
|
256
|
-
choices: () => ui5VersionChoices,
|
|
257
|
-
source: (prevAnswers, input) => (0, inquirer_common_1.searchChoices)(input, ui5VersionChoices),
|
|
258
|
-
message: (0, i18n_1.t)('prompts.appUi5VersionMessage'),
|
|
259
|
-
default: () => {
|
|
260
|
-
return defaultChoice?.value;
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Gets the `targetFolder` prompt.
|
|
266
|
-
*
|
|
267
|
-
* @param targetDir provides a default value for the target folder path
|
|
268
|
-
* @param validateFioriAppFolder validates the target folder path as a Fiori app project
|
|
269
|
-
* @returns the `targetFolder` prompt
|
|
270
|
-
*/
|
|
271
|
-
function getTargetFolderPrompt(targetDir, validateFioriAppFolder) {
|
|
272
|
-
return {
|
|
273
|
-
type: 'input',
|
|
274
|
-
name: types_1.promptNames.targetFolder,
|
|
275
|
-
message: (0, i18n_1.t)('prompts.appFolderPathMessage'),
|
|
276
|
-
guiType: 'folder-browser',
|
|
277
|
-
guiOptions: {
|
|
278
|
-
applyDefaultWhenDirty: true,
|
|
279
|
-
mandatory: true,
|
|
280
|
-
breadcrumb: (0, i18n_1.t)('prompts.appFolderPathBreadcrumb')
|
|
281
|
-
},
|
|
282
|
-
default: (answers) => answers.targetFolder || targetDir,
|
|
283
|
-
validate: async (target, { name = '' }) => {
|
|
284
|
-
if (name.length > 2) {
|
|
285
|
-
return await (0, project_input_validator_1.validateFioriAppTargetFolder)(target, name, validateFioriAppFolder);
|
|
286
|
-
}
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Gets the `description` prompt.
|
|
293
|
-
*
|
|
294
|
-
* @returns the `description` prompt
|
|
295
|
-
*/
|
|
296
|
-
function getDescriptionPrompt() {
|
|
297
|
-
return {
|
|
298
|
-
type: 'input',
|
|
299
|
-
name: types_1.promptNames.description,
|
|
300
|
-
guiOptions: {
|
|
301
|
-
hint: (0, i18n_1.t)('prompts.appDescTooltip'),
|
|
302
|
-
breadcrumb: true
|
|
303
|
-
},
|
|
304
|
-
message: (0, i18n_1.t)('prompts.appDescMessage'),
|
|
305
|
-
default: (answers) => answers.description || (0, i18n_1.t)('prompts.appDescDefault')
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Gets the `namespace` prompt.
|
|
237
|
+
* Get the `addFlpConfig` prompt.
|
|
310
238
|
*
|
|
311
|
-
* @param
|
|
312
|
-
* @returns
|
|
239
|
+
* @param addFlpConfigOptions the
|
|
240
|
+
* @returns The `addFlpConfig` prompt
|
|
313
241
|
*/
|
|
314
|
-
function
|
|
242
|
+
function getAddFlpConfigPrompt(addFlpConfigOptions) {
|
|
315
243
|
return {
|
|
316
|
-
type: '
|
|
244
|
+
type: 'confirm',
|
|
245
|
+
name: types_1.promptNames.addFlpConfig,
|
|
317
246
|
guiOptions: {
|
|
318
|
-
|
|
319
|
-
breadcrumb: true
|
|
247
|
+
breadcrumb: (0, i18n_1.t)('prompts.addFlpConfig.breadcrumb')
|
|
320
248
|
},
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
return (0, project_input_validator_1.validateNamespace)(namespace, answers.name || appName);
|
|
249
|
+
message: () => (0, i18n_1.t)('prompts.addFlpConfig.message'),
|
|
250
|
+
default: false,
|
|
251
|
+
validate: (addFlpConfig) => {
|
|
252
|
+
if (typeof addFlpConfigOptions?.validatorCallback === 'function') {
|
|
253
|
+
addFlpConfigOptions.validatorCallback(addFlpConfig, types_1.promptNames.addFlpConfig);
|
|
327
254
|
}
|
|
328
255
|
return true;
|
|
329
256
|
}
|
|
330
257
|
};
|
|
331
258
|
}
|
|
332
259
|
/**
|
|
333
|
-
*
|
|
260
|
+
* Get the `enableVirtualEndpoints` prompt.
|
|
334
261
|
*
|
|
335
|
-
* @returns the `
|
|
262
|
+
* @returns the `enableVirtualEndpoints` prompt
|
|
336
263
|
*/
|
|
337
|
-
function
|
|
264
|
+
function getEnableVirtualEndpoints() {
|
|
338
265
|
return {
|
|
339
|
-
type: '
|
|
340
|
-
|
|
341
|
-
hint: (0, i18n_1.t)('prompts.appTitleTooltip'),
|
|
342
|
-
breadcrumb: true
|
|
343
|
-
},
|
|
344
|
-
name: types_1.promptNames.title,
|
|
345
|
-
message: (0, i18n_1.t)('prompts.appTitleMessage'),
|
|
346
|
-
default: (answers) => answers.title || (0, i18n_1.t)('prompts.appTitleDefault')
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Gets the `name` prompt.
|
|
351
|
-
*
|
|
352
|
-
* @param targetDir the directory path to search for exiting apps with the same name
|
|
353
|
-
* @param isCapProject if the app is to be generated in a CAP project ensure that the name is unique within the CAP apps folder path
|
|
354
|
-
* @param appName the default app name, if not provided a default app name will be suggested
|
|
355
|
-
* @param isYUI If true, do not use `targetFolder` value when validating the name for existence, since YUI will not re-validate when `targetFolder` is updated.
|
|
356
|
-
* @returns the UI5 application `name` prompt
|
|
357
|
-
*/
|
|
358
|
-
function getNamePrompt(targetDir, isCapProject, appName, isYUI) {
|
|
359
|
-
return {
|
|
360
|
-
type: 'input',
|
|
266
|
+
type: 'confirm',
|
|
267
|
+
name: types_1.promptNames.enableVirtualEndpoints,
|
|
361
268
|
guiOptions: {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
mandatory: true,
|
|
365
|
-
breadcrumb: true
|
|
269
|
+
hint: (0, i18n_1.t)('prompts.enableVirtualEndpoints.tooltip'),
|
|
270
|
+
breadcrumb: (0, i18n_1.t)('prompts.enableVirtualEndpoints.breadcrumb')
|
|
366
271
|
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
default: (answers) => answers.name || appName || (0, prompt_helpers_1.defaultAppName)(targetDir),
|
|
370
|
-
validate: (name, answers) => {
|
|
371
|
-
if (!isYUI || isCapProject) {
|
|
372
|
-
return (0, validators_1.validateAppName)(name, answers.targetFolder || targetDir);
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
return (0, project_input_validator_1.validateModuleName)(name);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
272
|
+
message: () => (0, i18n_1.t)('prompts.enableVirtualEndpoints.message'),
|
|
273
|
+
default: true
|
|
378
274
|
};
|
|
379
275
|
}
|
|
380
|
-
|
|
381
|
-
* Applies the advanced grouping option which will hide the specified prompts behind and advanced options prompt.
|
|
382
|
-
*
|
|
383
|
-
* @param questions the questions to which the advanced option condition may be applied
|
|
384
|
-
* @param promptOptions the prompt options which specify which prompts should be grouped as advanced options
|
|
385
|
-
*/
|
|
386
|
-
function applyAdvancedOption(questions, promptOptions) {
|
|
387
|
-
(0, inquirer_common_1.withCondition)(questions.filter(({ name }) => promptOptions?.[name]?.advancedOption), (answers) => answers.showAdvanced ?? false);
|
|
388
|
-
}
|
|
389
|
-
//# sourceMappingURL=prompts.js.map
|
|
276
|
+
//# sourceMappingURL=prompts1.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { UI5ApplicationQuestion } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Get the `showAdvanced` prompt.
|
|
4
|
+
*
|
|
5
|
+
* @returns The `showAdvanced` prompt
|
|
6
|
+
*/
|
|
7
|
+
export declare function getShowAdvancedPrompt(): UI5ApplicationQuestion;
|
|
8
|
+
/**
|
|
9
|
+
* Get the `ui5Theme` prompt.
|
|
10
|
+
*
|
|
11
|
+
* @returns The `ui5Theme` prompt
|
|
12
|
+
*/
|
|
13
|
+
export declare function getUI5ThemePrompt(): UI5ApplicationQuestion;
|
|
14
|
+
/**
|
|
15
|
+
* Get the `enableEslint` prompt.
|
|
16
|
+
*
|
|
17
|
+
* @returns The `enableEslint` prompt
|
|
18
|
+
*/
|
|
19
|
+
export declare function getEnableEsLintPrompt(): UI5ApplicationQuestion;
|
|
20
|
+
/**
|
|
21
|
+
* Get the `enableCodeAssist` prompt.
|
|
22
|
+
*
|
|
23
|
+
* @returns The `enableCodeAssist` prompt
|
|
24
|
+
*/
|
|
25
|
+
export declare function getEnableCodeAssistPrompt(): UI5ApplicationQuestion;
|
|
26
|
+
/**
|
|
27
|
+
* Get the `skipAnnotations` prompt. Skipping annotation generation can be useful for CAP projects
|
|
28
|
+
* where annotations may have been already created along with the service.
|
|
29
|
+
*
|
|
30
|
+
* @returns The `skipAnnotations` prompt
|
|
31
|
+
*/
|
|
32
|
+
export declare function getSkipAnnotationsPrompt(): UI5ApplicationQuestion;
|
|
33
|
+
//# sourceMappingURL=prompts2.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getShowAdvancedPrompt = getShowAdvancedPrompt;
|
|
4
|
+
exports.getUI5ThemePrompt = getUI5ThemePrompt;
|
|
5
|
+
exports.getEnableEsLintPrompt = getEnableEsLintPrompt;
|
|
6
|
+
exports.getEnableCodeAssistPrompt = getEnableCodeAssistPrompt;
|
|
7
|
+
exports.getSkipAnnotationsPrompt = getSkipAnnotationsPrompt;
|
|
8
|
+
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
9
|
+
const ui5_info_1 = require("@sap-ux/ui5-info");
|
|
10
|
+
const i18n_1 = require("../i18n");
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
const prompt_helpers_1 = require("./prompt-helpers");
|
|
13
|
+
/**
|
|
14
|
+
* Get the `showAdvanced` prompt.
|
|
15
|
+
*
|
|
16
|
+
* @returns The `showAdvanced` prompt
|
|
17
|
+
*/
|
|
18
|
+
function getShowAdvancedPrompt() {
|
|
19
|
+
return {
|
|
20
|
+
type: 'confirm',
|
|
21
|
+
name: 'showAdvanced',
|
|
22
|
+
message: (0, i18n_1.t)('prompts.showAdvanced.message'),
|
|
23
|
+
guiOptions: {
|
|
24
|
+
hint: (0, i18n_1.t)('prompts.showAdvanced.tooltip')
|
|
25
|
+
},
|
|
26
|
+
default: false
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the `ui5Theme` prompt.
|
|
31
|
+
*
|
|
32
|
+
* @returns The `ui5Theme` prompt
|
|
33
|
+
*/
|
|
34
|
+
function getUI5ThemePrompt() {
|
|
35
|
+
return {
|
|
36
|
+
type: 'list',
|
|
37
|
+
name: types_1.promptNames.ui5Theme,
|
|
38
|
+
message: (0, i18n_1.t)('prompts.ui5Theme.message'),
|
|
39
|
+
guiOptions: {
|
|
40
|
+
applyDefaultWhenDirty: true,
|
|
41
|
+
breadcrumb: true
|
|
42
|
+
},
|
|
43
|
+
choices: ({ ui5Version = ui5_info_1.defaultVersion }) => (0, inquirer_common_1.getUI5ThemesChoices)(ui5Version),
|
|
44
|
+
default: ({ ui5Theme, ui5Version }) => {
|
|
45
|
+
ui5Theme ??= (0, ui5_info_1.getDefaultUI5Theme)(ui5Version);
|
|
46
|
+
return ui5Theme;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the `enableEslint` prompt.
|
|
52
|
+
*
|
|
53
|
+
* @returns The `enableEslint` prompt
|
|
54
|
+
*/
|
|
55
|
+
function getEnableEsLintPrompt() {
|
|
56
|
+
return {
|
|
57
|
+
type: 'confirm',
|
|
58
|
+
name: types_1.promptNames.enableEslint,
|
|
59
|
+
message: (0, i18n_1.t)('prompts.enableEslint.message'),
|
|
60
|
+
default: false,
|
|
61
|
+
guiOptions: {
|
|
62
|
+
breadcrumb: (0, i18n_1.t)('prompts.enableEslint.breadcrumb')
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the `enableCodeAssist` prompt.
|
|
68
|
+
*
|
|
69
|
+
* @returns The `enableCodeAssist` prompt
|
|
70
|
+
*/
|
|
71
|
+
function getEnableCodeAssistPrompt() {
|
|
72
|
+
return {
|
|
73
|
+
when: (answers) => (0, prompt_helpers_1.isVersionIncluded)(answers?.ui5Version || ui5_info_1.defaultVersion, ui5_info_1.minUi5VersionSupportingCodeAssist),
|
|
74
|
+
type: 'confirm',
|
|
75
|
+
name: types_1.promptNames.enableCodeAssist,
|
|
76
|
+
message: (0, i18n_1.t)('prompts.enableCodeAssist.message'),
|
|
77
|
+
default: false,
|
|
78
|
+
guiOptions: {
|
|
79
|
+
breadcrumb: (0, i18n_1.t)('prompts.enableCodeAssist.breadcrumb')
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get the `skipAnnotations` prompt. Skipping annotation generation can be useful for CAP projects
|
|
85
|
+
* where annotations may have been already created along with the service.
|
|
86
|
+
*
|
|
87
|
+
* @returns The `skipAnnotations` prompt
|
|
88
|
+
*/
|
|
89
|
+
function getSkipAnnotationsPrompt() {
|
|
90
|
+
return {
|
|
91
|
+
type: 'confirm',
|
|
92
|
+
name: types_1.promptNames.skipAnnotations,
|
|
93
|
+
message: (0, i18n_1.t)('prompts.skipAnnotations.message'),
|
|
94
|
+
default: false,
|
|
95
|
+
guiOptions: {
|
|
96
|
+
breadcrumb: (0, i18n_1.t)('prompts.skipAnnotations.breadcrumb')
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=prompts2.js.map
|
|
@@ -1,37 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"prompts": {
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
3
|
+
"name": {
|
|
4
|
+
"message": "Module name",
|
|
5
|
+
"tooltip": "The name of the module for this application that will be loaded at runtime. This also determines the directory name of the generated application.",
|
|
6
|
+
"default": "project{{defaultProjectNumber}}"
|
|
7
|
+
},
|
|
8
|
+
"title": {
|
|
9
|
+
"message": "Application title",
|
|
10
|
+
"tooltip": "The title of your application that is displayed in the header of the application.",
|
|
11
|
+
"default": "App Title"
|
|
12
|
+
},
|
|
13
|
+
"namespace": {
|
|
14
|
+
"message": "Application namespace",
|
|
15
|
+
"tooltip": "A unique package name for the application module being created. It should follow the standard Java package notation."
|
|
16
|
+
},
|
|
17
|
+
"description": {
|
|
18
|
+
"message": "Description",
|
|
19
|
+
"tooltip": "Project description in package.json of your project",
|
|
20
|
+
"default": "An SAP Fiori application."
|
|
21
|
+
},
|
|
22
|
+
"targetFolder": {
|
|
23
|
+
"message": "Project folder path",
|
|
24
|
+
"breadcrumb": "Project Path"
|
|
25
|
+
},
|
|
26
|
+
"ui5Version": {
|
|
27
|
+
"message": "Minimum SAPUI5 version",
|
|
28
|
+
"tooltip": "Represents the minimum version of SAPUI5 that this application requires.",
|
|
29
|
+
"breadcrumb": "UI5 Version"
|
|
30
|
+
},
|
|
31
|
+
"enableTypeScript": {
|
|
32
|
+
"message": "Enable TypeScript",
|
|
33
|
+
"warningMsg": "The CAP project will be updated to use NPM workspaces (this is a requirement for generating with TypeScript)"
|
|
34
|
+
},
|
|
35
|
+
"addDeployConfig": {
|
|
36
|
+
"message": "Add deployment configuration",
|
|
37
|
+
"mtaMessage": "Add deployment configuration to MTA project ({{-path}})",
|
|
38
|
+
"breadcrumb": "Deploy Config"
|
|
39
|
+
},
|
|
40
|
+
"addFlpConfig": {
|
|
41
|
+
"message": "Add FLP configuration",
|
|
42
|
+
"breadcrumb": "FLP Config"
|
|
43
|
+
},
|
|
44
|
+
"enableVirtualEndpoints": {
|
|
45
|
+
"message": "Use virtual endpoints for local preview",
|
|
46
|
+
"tooltip": "Using virtual endpoints allows the generated application to use the latest features of SAP Fiori tools.",
|
|
47
|
+
"breadcrumb": "Virtual Endpoints"
|
|
48
|
+
},
|
|
49
|
+
"showAdvanced": {
|
|
50
|
+
"message": "Configure advanced options",
|
|
51
|
+
"tooltip": "Choosing 'No' will apply defaults"
|
|
52
|
+
},
|
|
53
|
+
"ui5Theme": {
|
|
54
|
+
"message": "UI5 theme"
|
|
55
|
+
},
|
|
56
|
+
"enableEslint": {
|
|
57
|
+
"message": "Add Eslint configuration to the project",
|
|
58
|
+
"breadcrumb": "Eslint"
|
|
59
|
+
},
|
|
60
|
+
"enableCodeAssist": {
|
|
61
|
+
"message": "Add code assist libraries to your project",
|
|
62
|
+
"breadcrumb": "Code Assist"
|
|
63
|
+
},
|
|
64
|
+
"skipAnnotations": {
|
|
65
|
+
"message": "Skip generation of associated annotations.cds file",
|
|
66
|
+
"breadcrumb": "Skip Annotations"
|
|
67
|
+
}
|
|
35
68
|
},
|
|
36
69
|
"validators": {
|
|
37
70
|
"appFolderExistsAtPath": "A module with this name already exists in the folder: {{-path}}",
|
package/dist/types.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface UI5ApplicationAnswers {
|
|
|
15
15
|
enableCodeAssist?: boolean;
|
|
16
16
|
skipAnnotations?: boolean;
|
|
17
17
|
enableTypeScript?: boolean;
|
|
18
|
+
enableVirtualEndpoints?: boolean;
|
|
18
19
|
showAdvanced?: boolean;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
@@ -53,6 +54,7 @@ export declare enum promptNames {
|
|
|
53
54
|
enableCodeAssist = "enableCodeAssist",
|
|
54
55
|
skipAnnotations = "skipAnnotations",
|
|
55
56
|
enableTypeScript = "enableTypeScript",
|
|
57
|
+
enableVirtualEndpoints = "enableVirtualEndpoints",
|
|
56
58
|
showAdvanced = "showAdvanced"
|
|
57
59
|
}
|
|
58
60
|
type UI5VersionPromptOptions = {
|
package/dist/types.js
CHANGED
|
@@ -38,6 +38,7 @@ var promptNames;
|
|
|
38
38
|
promptNames["enableCodeAssist"] = "enableCodeAssist";
|
|
39
39
|
promptNames["skipAnnotations"] = "skipAnnotations";
|
|
40
40
|
promptNames["enableTypeScript"] = "enableTypeScript";
|
|
41
|
+
promptNames["enableVirtualEndpoints"] = "enableVirtualEndpoints";
|
|
41
42
|
promptNames["showAdvanced"] = "showAdvanced";
|
|
42
43
|
})(promptNames || (exports.promptNames = promptNames = {}));
|
|
43
44
|
//# sourceMappingURL=types.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.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type CdsUi5PluginInfo } from '@sap-ux/project-access';
|
|
2
|
-
import { type UI5Version } from '@sap-ux/ui5-info';
|
|
3
|
-
import type { UI5ApplicationPromptOptions, UI5ApplicationQuestion } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
* Get the prompts that will provide input for UI5 application writing.
|
|
6
|
-
*
|
|
7
|
-
* @param ui5Versions - ui5 versions to prompt for selection
|
|
8
|
-
* @param promptOptions - optional inputs used to pre-populate some prompt choices, default values and other prompting options. See {@link UI5ApplicationPromptOptions}.
|
|
9
|
-
* @param [capCdsInfo] - optional, additional information about CAP projects
|
|
10
|
-
* @param [isYUI] - optional, default is `false`. Changes the behaviour of some validation since YUI does not re-validate prompts that may be inter-dependant.
|
|
11
|
-
* @returns the prompts
|
|
12
|
-
*/
|
|
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;
|
|
21
|
-
//# sourceMappingURL=prompts.d.ts.map
|