@sap-ux/ui5-application-inquirer 0.18.1 → 0.18.3

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type CdsUi5PluginInfo } from '@sap-ux/project-access';
2
2
  import type { InquirerAdapter, PromptDefaultValue } from '@sap-ux/inquirer-common';
3
- import type { UI5ApplicationAnswers, UI5ApplicationCommonPromptOptions, UI5ApplicationPromptOptions, UI5ApplicationQuestion } from './types';
3
+ import type { UI5ApplicationAnswers, UI5ApplicationPromptOptions, UI5ApplicationQuestion } from './types';
4
4
  import { promptNames } from './types';
5
5
  /**
6
6
  * Get the inquirer prompts for ui5 library inquirer.
@@ -21,5 +21,7 @@ declare function getPrompts(promptOptions?: UI5ApplicationPromptOptions, capCdsI
21
21
  * @returns the prompt answers
22
22
  */
23
23
  declare function prompt(adapter: InquirerAdapter, promptOptions?: UI5ApplicationPromptOptions, capCdsInfo?: CdsUi5PluginInfo, isYUI?: boolean): Promise<UI5ApplicationAnswers>;
24
- export { getPrompts, prompt, promptNames, type CdsUi5PluginInfo, type InquirerAdapter, type PromptDefaultValue, type UI5ApplicationAnswers, type UI5ApplicationPromptOptions, type UI5ApplicationCommonPromptOptions };
24
+ export { getPrompts, prompt, promptNames, type CdsUi5PluginInfo, type InquirerAdapter, type PromptDefaultValue, type UI5ApplicationAnswers, type UI5ApplicationPromptOptions };
25
+ export type { UI5ApplicationCommonPromptOptions } from './types';
26
+ export { defaultAppName } from './prompts/prompt-helpers';
25
27
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.promptNames = void 0;
6
+ exports.defaultAppName = exports.promptNames = void 0;
7
7
  exports.getPrompts = getPrompts;
8
8
  exports.prompt = prompt;
9
9
  const ui5_info_1 = require("@sap-ux/ui5-info");
@@ -111,4 +111,6 @@ function getDefaultValue(answers, promptDefault) {
111
111
  }
112
112
  return undefined;
113
113
  }
114
+ var prompt_helpers_1 = require("./prompts/prompt-helpers");
115
+ Object.defineProperty(exports, "defaultAppName", { enumerable: true, get: function () { return prompt_helpers_1.defaultAppName; } });
114
116
  //# sourceMappingURL=index.js.map
@@ -9,12 +9,13 @@ import type { CdsUi5PluginInfo } from '@sap-ux/project-access';
9
9
  */
10
10
  export declare function appPathExists(appName: string, targetPath?: string): boolean | string;
11
11
  /**
12
- * Generate a default applicaiton name that does not exist at the specified path.
12
+ * Generate a default application name that does not exist at the specified path.
13
13
  *
14
14
  * @param targetPath the target path where the application directory would be created
15
+ * @param baseAppName optional base name to use instead of the default i18n name; when provided and the path already exists, an incrementing numeric suffix is appended starting at 1 (e.g. `myapp1`, `myapp2`, …)
15
16
  * @returns a suggested application name that can be created at the specified target path
16
17
  */
17
- export declare function defaultAppName(targetPath: string): string;
18
+ export declare function defaultAppName(targetPath: string, baseAppName?: string): string;
18
19
  /**
19
20
  * Checks if the specified semantic version string is greater than or equal to the minimum version.
20
21
  * If the specified version is not a parsable semantic version, returns true.
@@ -21,16 +21,22 @@ function appPathExists(appName, targetPath) {
21
21
  return (0, node_fs_1.existsSync)((0, node_path_1.join)(targetPath ?? process.cwd(), appName.trim()));
22
22
  }
23
23
  /**
24
- * Generate a default applicaiton name that does not exist at the specified path.
24
+ * Generate a default application name that does not exist at the specified path.
25
25
  *
26
26
  * @param targetPath the target path where the application directory would be created
27
+ * @param baseAppName optional base name to use instead of the default i18n name; when provided and the path already exists, an incrementing numeric suffix is appended starting at 1 (e.g. `myapp1`, `myapp2`, …)
27
28
  * @returns a suggested application name that can be created at the specified target path
28
29
  */
29
- function defaultAppName(targetPath) {
30
+ function defaultAppName(targetPath, baseAppName) {
30
31
  let defProjNum = i18n_1.defaultProjectNumber;
31
- let defaultName = (0, i18n_1.t)('prompts.name.default');
32
+ let defaultName = baseAppName || (0, i18n_1.t)('prompts.name.default');
32
33
  while (exports.appPathExists(`${defaultName}`, targetPath)) {
33
- defaultName = (0, i18n_1.t)('prompts.name.default', { defaultProjectNumber: ++defProjNum });
34
+ if (baseAppName) {
35
+ defaultName = `${baseAppName}${defProjNum++}`;
36
+ }
37
+ else {
38
+ defaultName = (0, i18n_1.t)('prompts.name.default', { defaultProjectNumber: ++defProjNum });
39
+ }
34
40
  // Dont loop forever, user will need to provide input otherwise
35
41
  if (defProjNum > 999) {
36
42
  break;
package/dist/types.d.ts CHANGED
@@ -117,7 +117,7 @@ type stringValuePromptType = Omit<typeof promptNames, booleanPromptKeys>;
117
117
  type stringValuePrompts = stringValuePromptType[keyof stringValuePromptType];
118
118
  type booleanValuePromptType = Pick<typeof promptNames, booleanPromptKeys>;
119
119
  type booleanValuePrompts = booleanValuePromptType[keyof booleanValuePromptType];
120
- type DefaultValueInputPrompts = promptNames.name | promptNames.description | promptNames.namespace | promptNames.ui5Version | promptNames.targetFolder;
120
+ type DefaultValueInputPrompts = promptNames.name | promptNames.description | promptNames.namespace | promptNames.ui5Version | promptNames.targetFolder | promptNames.title;
121
121
  type DefaultValueConfirmPrompts = promptNames.enableTypeScript | promptNames.enableEslint | promptNames.skipAnnotations | promptNames.addDeployConfig;
122
122
  /**
123
123
  * Defines prompt/question default values and/or whether or not they should be shown.
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.1",
4
+ "version": "0.18.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -23,10 +23,10 @@
23
23
  "inquirer-autocomplete-prompt": "2.0.1",
24
24
  "lodash": "4.18.1",
25
25
  "semver": "7.7.4",
26
- "@sap-ux/inquirer-common": "0.13.0",
27
- "@sap-ux/project-access": "1.37.0",
28
- "@sap-ux/project-input-validator": "0.7.0",
29
- "@sap-ux/ui5-info": "0.14.0"
26
+ "@sap-ux/inquirer-common": "0.13.1",
27
+ "@sap-ux/project-access": "1.38.0",
28
+ "@sap-ux/ui5-info": "0.14.0",
29
+ "@sap-ux/project-input-validator": "0.7.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@sap-devx/yeoman-ui-types": "1.25.0",
@@ -35,7 +35,7 @@
35
35
  "@types/lodash": "4.17.24",
36
36
  "@types/semver": "7.7.1",
37
37
  "inquirer": "8.2.7",
38
- "@sap-ux/cap-config-writer": "0.13.1"
38
+ "@sap-ux/cap-config-writer": "0.13.2"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=22.x"