@sap-ux/ui5-library-inquirer 0.7.7 → 1.0.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/i18n.js CHANGED
@@ -1,28 +1,20 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.i18n = void 0;
7
- exports.initI18n = initI18n;
8
- exports.t = t;
9
- const i18next_1 = __importDefault(require("i18next"));
10
- const ui5_library_inquirer_i18n_json_1 = __importDefault(require("./translations/ui5-library-inquirer.i18n.json"));
11
- const inquirer_common_1 = require("@sap-ux/inquirer-common");
1
+ import i18next from 'i18next';
2
+ import translations from './translations/ui5-library-inquirer.i18n.json' with { type: 'json' };
3
+ import { addi18nResourceBundle as addInquirerCommoni18nResourceBundle } from '@sap-ux/inquirer-common';
12
4
  const ui5LibI18nNamespace = 'ui5-library-inquirer';
13
- exports.i18n = i18next_1.default.createInstance();
5
+ export const i18n = i18next.createInstance();
14
6
  /**
15
7
  * Initialize i18next with the translations for this module.
16
8
  */
17
- async function initI18n() {
18
- await exports.i18n.init({
9
+ export async function initI18n() {
10
+ await i18n.init({
19
11
  lng: 'en',
20
12
  fallbackLng: 'en',
21
13
  showSupportNotice: false
22
14
  });
23
- exports.i18n.addResourceBundle('en', ui5LibI18nNamespace, ui5_library_inquirer_i18n_json_1.default);
15
+ i18n.addResourceBundle('en', ui5LibI18nNamespace, translations);
24
16
  // add the inquirer common i18n resource bundle to ensure all translations are available
25
- (0, inquirer_common_1.addi18nResourceBundle)();
17
+ addInquirerCommoni18nResourceBundle();
26
18
  }
27
19
  /**
28
20
  * Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
@@ -31,13 +23,11 @@ async function initI18n() {
31
23
  * @param options additional options
32
24
  * @returns {string} localized string stored for the given key
33
25
  */
34
- function t(key, options) {
26
+ export function t(key, options) {
35
27
  if (!options?.ns) {
36
28
  options = Object.assign(options ?? {}, { ns: ui5LibI18nNamespace });
37
29
  }
38
- return exports.i18n.t(key, options);
30
+ return i18n.t(key, options);
39
31
  }
40
- initI18n().catch(() => {
41
- // Needed for lint
42
- });
32
+ void initI18n().catch(() => undefined);
43
33
  //# sourceMappingURL=i18n.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type InquirerAdapter } from '@sap-ux/inquirer-common';
2
2
  import { type Question } from 'inquirer';
3
- import type { UI5LibraryAnswers, UI5LibraryPromptOptions } from './types';
3
+ import type { UI5LibraryAnswers, UI5LibraryPromptOptions } from './types.js';
4
4
  /**
5
5
  * Get the inquirer prompts for ui5 library inquirer.
6
6
  *
@@ -17,6 +17,6 @@ declare function getPrompts(promptOptions?: UI5LibraryPromptOptions): Promise<Qu
17
17
  */
18
18
  declare function prompt(promptOptions?: UI5LibraryPromptOptions, adapter?: InquirerAdapter): Promise<UI5LibraryAnswers>;
19
19
  export { getPrompts, prompt };
20
- export type { UI5LibraryAnswers, UI5LibraryPromptOptions } from './types';
20
+ export type { UI5LibraryAnswers, UI5LibraryPromptOptions } from './types.js';
21
21
  export type { InquirerAdapter } from '@sap-ux/inquirer-common';
22
22
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,14 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getPrompts = getPrompts;
7
- exports.prompt = prompt;
8
- const ui5_info_1 = require("@sap-ux/ui5-info");
9
- const inquirer_1 = __importDefault(require("inquirer"));
10
- const prompts_1 = require("./prompts");
11
- const inquirer_autocomplete_prompt_1 = __importDefault(require("inquirer-autocomplete-prompt"));
1
+ import { getUI5Versions } from '@sap-ux/ui5-info';
2
+ import inquirer from 'inquirer';
3
+ import { getQuestions } from './prompts/index.js';
4
+ import autocomplete from 'inquirer-autocomplete-prompt';
12
5
  /**
13
6
  * Get the inquirer prompts for ui5 library inquirer.
14
7
  *
@@ -22,7 +15,7 @@ async function getPrompts(promptOptions) {
22
15
  onlyNpmVersion: true
23
16
  };
24
17
  // Get only npm-available UI5 versions to avoid post-selection resolution
25
- const allUI5Versions = await (0, ui5_info_1.getUI5Versions)(filterOptions);
18
+ const allUI5Versions = await getUI5Versions(filterOptions);
26
19
  // Filter for maintained versions only
27
20
  const ui5Versions = allUI5Versions.filter((version) => version.maintained === true);
28
21
  const ui5LibPromptInputs = {
@@ -30,7 +23,7 @@ async function getPrompts(promptOptions) {
30
23
  includeSeparators: promptOptions?.includeSeparators,
31
24
  useAutocomplete: promptOptions?.useAutocomplete
32
25
  };
33
- return (0, prompts_1.getQuestions)(ui5Versions, ui5LibPromptInputs);
26
+ return getQuestions(ui5Versions, ui5LibPromptInputs);
34
27
  }
35
28
  /**
36
29
  * Prompt for ui5 library generation inputs.
@@ -41,13 +34,14 @@ async function getPrompts(promptOptions) {
41
34
  */
42
35
  async function prompt(promptOptions, adapter) {
43
36
  const ui5LibPrompts = await getPrompts(promptOptions);
44
- const pm = adapter ? adapter.promptModule : inquirer_1.default;
37
+ const pm = adapter ? adapter.promptModule : inquirer;
45
38
  if (pm && promptOptions?.useAutocomplete) {
46
- pm.registerPrompt('autocomplete', inquirer_autocomplete_prompt_1.default);
39
+ pm.registerPrompt('autocomplete', autocomplete);
47
40
  }
48
41
  const answers = adapter
49
42
  ? await adapter.prompt(ui5LibPrompts)
50
- : await inquirer_1.default.prompt(ui5LibPrompts);
43
+ : await inquirer.prompt(ui5LibPrompts);
51
44
  return answers;
52
45
  }
46
+ export { getPrompts, prompt };
53
47
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- export * from './prompts';
1
+ export * from './prompts.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1,2 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./prompts"), exports);
1
+ export * from './prompts.js';
18
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import type { UI5Version } from '@sap-ux/ui5-info';
2
2
  import type { Question } from 'inquirer';
3
- import type { UI5LibraryAnswers, UI5LibraryPromptOptions } from '../types';
3
+ import type { UI5LibraryAnswers, UI5LibraryPromptOptions } from '../types.js';
4
4
  /**
5
5
  * Get the prompts for UI5 library generation.
6
6
  *
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getQuestions = getQuestions;
4
- const inquirer_common_1 = require("@sap-ux/inquirer-common");
5
- const project_input_validator_1 = require("@sap-ux/project-input-validator");
6
- const i18n_1 = require("../i18n");
1
+ import { searchChoices, ui5VersionsGrouped } from '@sap-ux/inquirer-common';
2
+ import { validateLibModuleName, validateNamespace, validateProjectFolder } from '@sap-ux/project-input-validator';
3
+ import { t } from '../i18n.js';
7
4
  /**
8
5
  * Get the prompts for UI5 library generation.
9
6
  *
@@ -11,35 +8,35 @@ const i18n_1 = require("../i18n");
11
8
  * @param options - optional inputs used to pre-populate some prompt choices, default values and other prompting options. See {@link UI5LibraryPromptOptions}.
12
9
  * @returns the prompts
13
10
  */
14
- function getQuestions(ui5Versions, options) {
15
- const ui5VersionChoices = (0, inquirer_common_1.ui5VersionsGrouped)(ui5Versions, options?.includeSeparators);
11
+ export function getQuestions(ui5Versions, options) {
12
+ const ui5VersionChoices = ui5VersionsGrouped(ui5Versions, options?.includeSeparators);
16
13
  return [
17
14
  {
18
15
  type: 'input',
19
16
  name: 'libraryName',
20
- message: (0, i18n_1.t)('prompts.libraryNameLabel'),
17
+ message: t('prompts.libraryNameLabel'),
21
18
  guiOptions: {
22
19
  mandatory: true,
23
20
  breadcrumb: true
24
21
  },
25
- validate: (libraryName) => (0, project_input_validator_1.validateLibModuleName)(libraryName),
26
- default: (0, i18n_1.t)('prompts.libraryNameDefault')
22
+ validate: (libraryName) => validateLibModuleName(libraryName),
23
+ default: t('prompts.libraryNameDefault')
27
24
  },
28
25
  {
29
26
  type: 'input',
30
27
  name: 'namespace',
31
- message: (0, i18n_1.t)('prompts.libraryNamespaceLabel'),
28
+ message: t('prompts.libraryNamespaceLabel'),
32
29
  guiOptions: {
33
30
  mandatory: true,
34
31
  breadcrumb: true
35
32
  },
36
- validate: (namespace, answers) => (0, project_input_validator_1.validateNamespace)(namespace, answers?.libraryName, false),
37
- default: (0, i18n_1.t)('prompts.libraryNamespaceDefault')
33
+ validate: (namespace, answers) => validateNamespace(namespace, answers?.libraryName, false),
34
+ default: t('prompts.libraryNamespaceDefault')
38
35
  },
39
36
  {
40
37
  type: 'input',
41
38
  name: 'targetFolder',
42
- message: (0, i18n_1.t)('prompts.libraryFolderLabel'),
39
+ message: t('prompts.libraryFolderLabel'),
43
40
  guiType: 'folder-browser',
44
41
  guiOptions: {
45
42
  applyDefaultWhenDirty: true,
@@ -47,24 +44,24 @@ function getQuestions(ui5Versions, options) {
47
44
  breadcrumb: true
48
45
  },
49
46
  default: options?.targetFolder ?? process.cwd(),
50
- validate: (target, answers) => (0, project_input_validator_1.validateProjectFolder)(target, `${answers?.namespace}.${answers?.libraryName}`)
47
+ validate: (target, answers) => validateProjectFolder(target, `${answers?.namespace}.${answers?.libraryName}`)
51
48
  },
52
49
  {
53
50
  when: () => !!ui5VersionChoices,
54
51
  type: options?.useAutocomplete ? 'autocomplete' : 'list',
55
52
  name: 'ui5Version',
56
- message: (0, i18n_1.t)('prompts.libraryUi5VersionLabel'),
53
+ message: t('prompts.libraryUi5VersionLabel'),
57
54
  guiOptions: {
58
- hint: (0, i18n_1.t)('prompts.libraryUi5VersionTooltip'),
55
+ hint: t('prompts.libraryUi5VersionTooltip'),
59
56
  breadcrumb: true
60
57
  },
61
58
  choices: () => ui5VersionChoices,
62
- source: (prevAnswers, input) => (0, inquirer_common_1.searchChoices)(input, ui5VersionChoices)
59
+ source: (prevAnswers, input) => searchChoices(input, ui5VersionChoices)
63
60
  },
64
61
  {
65
62
  type: 'confirm',
66
63
  name: 'enableTypescript',
67
- message: (0, i18n_1.t)('prompts.libraryEnableTypeScriptLabel'),
64
+ message: t('prompts.libraryEnableTypeScriptLabel'),
68
65
  guiOptions: {
69
66
  breadcrumb: true
70
67
  },
package/dist/types.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/ui5-library-inquirer",
3
3
  "description": "Prompts module that can provide prompts for UI5 library writer",
4
- "version": "0.7.7",
4
+ "version": "1.0.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -10,6 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aui5-library-inquirer"
12
12
  },
13
+ "type": "module",
13
14
  "license": "Apache-2.0",
14
15
  "main": "dist/index.js",
15
16
  "files": [
@@ -22,12 +23,13 @@
22
23
  "dependencies": {
23
24
  "i18next": "25.10.10",
24
25
  "inquirer-autocomplete-prompt": "2.0.1",
25
- "@sap-ux/inquirer-common": "0.13.6",
26
- "@sap-ux/logger": "0.9.0",
27
- "@sap-ux/project-input-validator": "0.7.2",
28
- "@sap-ux/ui5-info": "0.14.0"
26
+ "@sap-ux/inquirer-common": "1.0.0",
27
+ "@sap-ux/logger": "1.0.0",
28
+ "@sap-ux/project-input-validator": "1.0.0",
29
+ "@sap-ux/ui5-info": "1.0.0"
29
30
  },
30
31
  "devDependencies": {
32
+ "@jest/globals": "30.3.0",
31
33
  "inquirer": "8.2.7",
32
34
  "@types/inquirer-autocomplete-prompt": "2.0.2",
33
35
  "@types/inquirer": "8.2.6"
@@ -41,8 +43,8 @@
41
43
  "watch": "tsc --watch",
42
44
  "lint": "eslint",
43
45
  "lint:fix": "eslint --fix",
44
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
45
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
46
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
47
+ "test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
46
48
  "link": "pnpm link --global",
47
49
  "unlink": "pnpm unlink --global"
48
50
  }