@sap-ux/flp-config-sub-generator 0.2.55 → 0.3.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.
@@ -1,5 +1,6 @@
1
1
  import Generator from 'yeoman-generator';
2
2
  import { promptNames } from '@sap-ux/flp-config-inquirer';
3
+ import type { FLPConfigPromptOptions } from '@sap-ux/flp-config-inquirer';
3
4
  import type { FlpConfigOptions } from './types';
4
5
  /**
5
6
  * FLP config generator adds an inbound navigation config to an existing manifest.json.
@@ -15,7 +16,7 @@ export default class extends Generator {
15
16
  private abort;
16
17
  private manifest;
17
18
  private manifestPath;
18
- private extensionPromptOpts?;
19
+ private promptOptions?;
19
20
  options: FlpConfigOptions;
20
21
  setPromptsCallback: (fn: object) => void;
21
22
  /**
@@ -55,5 +56,5 @@ export default class extends Generator {
55
56
  end(): Promise<void>;
56
57
  }
57
58
  export { promptNames };
58
- export type { FlpConfigOptions };
59
+ export type { FlpConfigOptions, FLPConfigPromptOptions };
59
60
  //# sourceMappingURL=index.d.ts.map
@@ -19,8 +19,8 @@ const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
19
19
  const inquirer_common_1 = require("@sap-ux/inquirer-common");
20
20
  const constants_1 = require("../utils/constants");
21
21
  const utils_1 = require("../utils");
22
- const prompts_1 = require("../utils/prompts");
23
22
  const telemetryEvents_1 = require("../telemetryEvents");
23
+ const flpConfigSubGenNamespace = '@sap-ux/flp-config-sub-generator';
24
24
  /**
25
25
  * FLP config generator adds an inbound navigation config to an existing manifest.json.
26
26
  */
@@ -35,7 +35,7 @@ class default_1 extends yeoman_generator_1.default {
35
35
  abort = false;
36
36
  manifest;
37
37
  manifestPath;
38
- extensionPromptOpts;
38
+ promptOptions;
39
39
  options;
40
40
  setPromptsCallback;
41
41
  /**
@@ -50,12 +50,13 @@ class default_1 extends yeoman_generator_1.default {
50
50
  this.vscode = opts.vscode;
51
51
  this.launchFlpConfigAsSubGenerator = opts.launchFlpConfigAsSubGenerator ?? false;
52
52
  this.appRootPath = opts.data?.appRootPath ?? opts?.appRootPath ?? this.destinationRoot();
53
+ this.promptOptions = this.options?.inquirerPromptOptions;
53
54
  this.options = opts;
54
55
  logger_1.default.configureLogging(this.rootGeneratorName(), this.log, this.options.logWrapper, this.options.logLevel, this.options.logger, this.vscode);
55
56
  // If launched standalone, set the header, title and description
56
57
  if (!this.launchFlpConfigAsSubGenerator) {
57
58
  this.appWizard.setHeaderTitle(constants_1.generatorTitle);
58
- this.prompts = new yeoman_ui_types_1.Prompts((0, prompts_1.getYUIDetails)(this.appRootPath));
59
+ this.prompts = new yeoman_ui_types_1.Prompts((0, utils_1.getYUIDetails)(this.appRootPath));
59
60
  this.setPromptsCallback = (fn) => {
60
61
  if (this.prompts) {
61
62
  this.prompts.setCallback(fn);
@@ -68,10 +69,14 @@ class default_1 extends yeoman_generator_1.default {
68
69
  if (this.env.conflicter) {
69
70
  this.env.conflicter.force = this.options.force ?? true;
70
71
  }
71
- this.extensionPromptOpts = await (0, deploy_config_generator_shared_1.getExtensionGenPromptOpts)(this.env.create.bind(this.env), this.rootGeneratorName(), this.vscode);
72
+ const extensionPromptOpts = await (0, deploy_config_generator_shared_1.getExtensionGenPromptOpts)(this.env.create.bind(this.env), flpConfigSubGenNamespace, this.vscode);
73
+ this.promptOptions = {
74
+ ...extensionPromptOpts,
75
+ ...this.promptOptions
76
+ };
72
77
  await fiori_generator_shared_1.TelemetryHelper.initTelemetrySettings({
73
78
  consumerModule: {
74
- name: '@sap-ux/flp-config-sub-generator',
79
+ name: flpConfigSubGenNamespace,
75
80
  version: this.rootGeneratorVersion()
76
81
  },
77
82
  internalFeature: (0, feature_toggle_1.isInternalFeaturesSettingEnabled)(),
@@ -112,13 +117,10 @@ class default_1 extends yeoman_generator_1.default {
112
117
  const silentOverwrite = this.options.overwrite;
113
118
  let questions = (await (0, flp_config_inquirer_1.getPrompts)(inbounds, {
114
119
  silentOverwrite,
115
- inboundId: { hide: true },
116
- existingFlpConfigInfo: { hide: true },
117
- icon: { hide: true },
118
- additionalParameters: { hide: true }
120
+ ...(0, utils_1.getPromptOptions)(this.promptOptions)
119
121
  }));
120
- if (this.extensionPromptOpts && !this.launchFlpConfigAsSubGenerator) {
121
- questions = (0, inquirer_common_1.extendWithOptions)(questions, this.extensionPromptOpts);
122
+ if (this.promptOptions) {
123
+ questions = (0, inquirer_common_1.extendWithOptions)(questions, this.promptOptions);
122
124
  }
123
125
  this.answers = {};
124
126
  const answers = await this.prompt(questions);
@@ -2,6 +2,7 @@ import type Generator from 'yeoman-generator';
2
2
  import type { AppWizard } from '@sap-devx/yeoman-ui-types';
3
3
  import type { VSCodeInstance, TelemetryData, LogWrapper } from '@sap-ux/fiori-generator-shared';
4
4
  import type { ManifestNamespace } from '@sap-ux/project-access';
5
+ import type { FLPConfigPromptOptions } from '@sap-ux/flp-config-inquirer';
5
6
  export interface FlpConfigOptions extends Generator.GeneratorOptions {
6
7
  /**
7
8
  * VSCode instance
@@ -52,5 +53,9 @@ export interface FlpConfigOptions extends Generator.GeneratorOptions {
52
53
  * Logger instance
53
54
  */
54
55
  logWrapper?: LogWrapper;
56
+ /**
57
+ * FLP configuration inqurier prompt options
58
+ */
59
+ inquirerPromptOptions?: FLPConfigPromptOptions;
55
60
  }
56
61
  //# sourceMappingURL=types.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export * from './i18n';
2
+ export { getYUIDetails, getPromptOptions } from './prompts';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -14,5 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.getPromptOptions = exports.getYUIDetails = void 0;
17
18
  __exportStar(require("./i18n"), exports);
19
+ var prompts_1 = require("./prompts");
20
+ Object.defineProperty(exports, "getYUIDetails", { enumerable: true, get: function () { return prompts_1.getYUIDetails; } });
21
+ Object.defineProperty(exports, "getPromptOptions", { enumerable: true, get: function () { return prompts_1.getPromptOptions; } });
18
22
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,4 @@
1
+ import { type FLPConfigPromptOptions } from '@sap-ux/flp-config-inquirer';
1
2
  /**
2
3
  * Returns the details for the YUI prompt.
3
4
  *
@@ -8,4 +9,11 @@ export declare function getYUIDetails(appRootPath: string): {
8
9
  name: string;
9
10
  description: string;
10
11
  }[];
12
+ /**
13
+ * Adds the provided prompt options to the default FLP config prompt options.
14
+ *
15
+ * @param promptOptions - FLP configuration prompt options
16
+ * @returns - FLP configuration prompt options with defaults applied
17
+ */
18
+ export declare function getPromptOptions(promptOptions?: FLPConfigPromptOptions): FLPConfigPromptOptions;
11
19
  //# sourceMappingURL=prompts.d.ts.map
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getYUIDetails = getYUIDetails;
4
+ exports.getPromptOptions = getPromptOptions;
4
5
  const path_1 = require("path");
6
+ const flp_config_inquirer_1 = require("@sap-ux/flp-config-inquirer");
5
7
  /**
6
8
  * Returns the details for the YUI prompt.
7
9
  *
@@ -16,4 +18,19 @@ function getYUIDetails(appRootPath) {
16
18
  }
17
19
  ];
18
20
  }
21
+ /**
22
+ * Adds the provided prompt options to the default FLP config prompt options.
23
+ *
24
+ * @param promptOptions - FLP configuration prompt options
25
+ * @returns - FLP configuration prompt options with defaults applied
26
+ */
27
+ function getPromptOptions(promptOptions) {
28
+ return {
29
+ ...promptOptions,
30
+ [flp_config_inquirer_1.promptNames.inboundId]: { hide: true, ...promptOptions?.inboundId },
31
+ [flp_config_inquirer_1.promptNames.existingFlpConfigInfo]: { hide: true, ...promptOptions?.existingFlpConfigInfo },
32
+ [flp_config_inquirer_1.promptNames.icon]: { hide: true, ...promptOptions?.icon },
33
+ [flp_config_inquirer_1.promptNames.additionalParameters]: { hide: true, ...promptOptions?.additionalParameters }
34
+ };
35
+ }
19
36
  //# sourceMappingURL=prompts.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/flp-config-sub-generator",
3
3
  "description": "Generator for creating Fiori Launcpad configuration",
4
- "version": "0.2.55",
4
+ "version": "0.3.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -27,13 +27,13 @@
27
27
  "@sap-ux/deploy-config-generator-shared": "0.1.22",
28
28
  "@sap-ux/feature-toggle": "0.3.0",
29
29
  "@sap-ux/fiori-generator-shared": "0.13.3",
30
- "@sap-ux/flp-config-inquirer": "0.3.49",
30
+ "@sap-ux/flp-config-inquirer": "0.4.0",
31
31
  "@sap-ux/i18n": "0.3.1",
32
32
  "@sap-ux/inquirer-common": "0.7.27",
33
33
  "@sap-ux/project-access": "1.30.7"
34
34
  },
35
35
  "devDependencies": {
36
- "@jest/types": "29.6.3",
36
+ "@jest/types": "30.0.1",
37
37
  "@types/inquirer": "8.2.6",
38
38
  "@types/mem-fs": "1.1.2",
39
39
  "@types/mem-fs-editor": "7.0.1",
@@ -59,7 +59,7 @@
59
59
  "watch": "tsc --watch",
60
60
  "lint": "eslint . --ext .ts",
61
61
  "lint:fix": "eslint . --ext .ts --fix",
62
- "test": "jest --ci --forceExit --detectOpenHandles --colors --passWithNoTests",
62
+ "test": "jest --ci --forceExit --detectOpenHandles --colors",
63
63
  "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
64
64
  "link": "pnpm link --global",
65
65
  "unlink": "pnpm unlink --global"