@sap-ux/deploy-config-generator-shared 0.0.34 → 0.0.36

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,4 +1,4 @@
1
1
  export { DeploymentGenerator } from './base/generator';
2
2
  export * from './utils';
3
- export { getConfirmConfigUpdatePrompt, getConfirmMtaContinuePrompt } from './prompts';
3
+ export { getConfirmMtaContinuePrompt } from './prompts';
4
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -14,11 +14,10 @@ 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.getConfirmMtaContinuePrompt = exports.getConfirmConfigUpdatePrompt = exports.DeploymentGenerator = void 0;
17
+ exports.getConfirmMtaContinuePrompt = exports.DeploymentGenerator = void 0;
18
18
  var generator_1 = require("./base/generator");
19
19
  Object.defineProperty(exports, "DeploymentGenerator", { enumerable: true, get: function () { return generator_1.DeploymentGenerator; } });
20
20
  __exportStar(require("./utils"), exports);
21
21
  var prompts_1 = require("./prompts");
22
- Object.defineProperty(exports, "getConfirmConfigUpdatePrompt", { enumerable: true, get: function () { return prompts_1.getConfirmConfigUpdatePrompt; } });
23
22
  Object.defineProperty(exports, "getConfirmMtaContinuePrompt", { enumerable: true, get: function () { return prompts_1.getConfirmMtaContinuePrompt; } });
24
23
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,4 @@
1
1
  import type { Question } from 'inquirer';
2
- /**
3
- * Returns prompt which asks whether the user wants to continue with the configuration update even though it is managed centrally as part of the CI pipeline.
4
- *
5
- * @param configType - the type of configuration being generated e.g FLP, Deployment
6
- * @returns the prompt question
7
- */
8
- export declare function getConfirmConfigUpdatePrompt(configType?: string): Question[];
9
2
  /**
10
3
  * Generate a new prompt asking if the user wants to create an approuter configuration within a CAP project.
11
4
  *
@@ -1,31 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfirmMtaContinuePrompt = exports.getConfirmConfigUpdatePrompt = void 0;
4
- const i18n_1 = require("../utils/i18n");
3
+ exports.getConfirmMtaContinuePrompt = void 0;
4
+ const utils_1 = require("../utils");
5
5
  /**
6
6
  * Enumeration of prompt names
7
7
  */
8
8
  var promptNames;
9
9
  (function (promptNames) {
10
- promptNames["confirmConfigUpdate"] = "confirmConfigUpdate";
10
+ promptNames["addCapMtaContinue"] = "addCapMtaContinue";
11
11
  })(promptNames || (promptNames = {}));
12
- /**
13
- * Returns prompt which asks whether the user wants to continue with the configuration update even though it is managed centrally as part of the CI pipeline.
14
- *
15
- * @param configType - the type of configuration being generated e.g FLP, Deployment
16
- * @returns the prompt question
17
- */
18
- function getConfirmConfigUpdatePrompt(configType) {
19
- return [
20
- {
21
- type: 'confirm',
22
- name: promptNames.confirmConfigUpdate,
23
- message: (0, i18n_1.t)('prompts.confirmConfigUpdate.message', { configType }),
24
- default: false
25
- }
26
- ];
27
- }
28
- exports.getConfirmConfigUpdatePrompt = getConfirmConfigUpdatePrompt;
29
12
  /**
30
13
  * Generate a new prompt asking if the user wants to create an approuter configuration within a CAP project.
31
14
  *
@@ -35,8 +18,8 @@ function getConfirmMtaContinuePrompt() {
35
18
  return [
36
19
  {
37
20
  type: 'confirm',
38
- name: 'addCapMtaContinue',
39
- message: (0, i18n_1.t)('prompts.confirmCAPMtaContinue.message'),
21
+ name: promptNames.addCapMtaContinue,
22
+ message: (0, utils_1.t)('prompts.confirmCAPMtaContinue.message'),
40
23
  default: false
41
24
  }
42
25
  ];
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "prompts": {
3
- "confirmConfigUpdate": {
4
- "message": "{{- configType}} configuration is managed centrally as part of the CI pipeline, local updates to the configuration will not be for productive use. Are you sure you want to continue?"
5
- },
6
3
  "confirmCAPMtaContinue": {
7
- "message": "There is no mta.yaml file defined for this project. In order to add deployment configuration for this application, this file must be present. Do you want to create an mta.yaml to continue?"
4
+ "message": "There is no `mta.yaml` file defined for this project. To add a deployment configuration for this application, this file must be present. Do you want to create an `mta.yaml` file to continue?"
8
5
  }
9
6
  },
10
7
  "errors": {
@@ -0,0 +1,14 @@
1
+ import type { VSCodeInstance } from '@sap-ux/fiori-generator-shared';
2
+ import type { GeneratorOptions } from 'yeoman-generator';
3
+ import type { CommonPromptOptions } from '@sap-ux/inquirer-common';
4
+ /**
5
+ * Loads the fiori generator extension and returns the extension prompt options.
6
+ * This a lightweight temp version for loading the extension generator prompts options.
7
+ *
8
+ * @param createEnv - the env create function from yeoman generator
9
+ * @param rootGeneratorName - the name of the root generator
10
+ * @param vscode - instance of vscode
11
+ * @returns - the extension prompt options
12
+ */
13
+ export declare function getExtensionGenPromptOpts(createEnv: GeneratorOptions['env.create'], rootGeneratorName: string, vscode?: VSCodeInstance): Promise<Record<string, CommonPromptOptions> | undefined>;
14
+ //# sourceMappingURL=extension-prompts.d.ts.map
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExtensionGenPromptOpts = void 0;
4
+ const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
5
+ /**
6
+ * Find fiori generator extension generators and return the path to the first one found.
7
+ *
8
+ * @param vscode - instance of vscode
9
+ * @returns - the path to the extension generator
10
+ */
11
+ async function getExtensionGenPath(vscode) {
12
+ let extensionGenPath;
13
+ // Find generator extensions
14
+ const foundSubGens = await (0, nodejs_utils_1.findInstalledPackages)('fiori-gen-ext', {
15
+ keyword: 'fiori-generator-extension',
16
+ vscWorkspaceConfig: vscode?.workspace?.getConfiguration()
17
+ });
18
+ if (foundSubGens.length > 0) {
19
+ extensionGenPath = foundSubGens?.[0].path;
20
+ }
21
+ return extensionGenPath;
22
+ }
23
+ /**
24
+ * Loads the fiori generator extension and returns the extension prompt options.
25
+ * This a lightweight temp version for loading the extension generator prompts options.
26
+ *
27
+ * @param createEnv - the env create function from yeoman generator
28
+ * @param rootGeneratorName - the name of the root generator
29
+ * @param vscode - instance of vscode
30
+ * @returns - the extension prompt options
31
+ */
32
+ async function getExtensionGenPromptOpts(createEnv, rootGeneratorName, vscode) {
33
+ let extGenPromptOpts;
34
+ const extensionGenPath = await getExtensionGenPath(vscode);
35
+ if (extensionGenPath) {
36
+ const generatorExtension = createEnv(extensionGenPath, []);
37
+ extGenPromptOpts =
38
+ typeof generatorExtension._getExtensions === 'function'
39
+ ? generatorExtension._getExtensions()?.[rootGeneratorName]
40
+ : {};
41
+ }
42
+ return extGenPromptOpts;
43
+ }
44
+ exports.getExtensionGenPromptOpts = getExtensionGenPromptOpts;
45
+ //# sourceMappingURL=extension-prompts.js.map
@@ -1,6 +1,7 @@
1
1
  export { t, initI18n } from './i18n';
2
2
  export { showOverwriteQuestion } from './conditions';
3
3
  export { ErrorHandler, ERROR_TYPE, bail, handleErrorMessage } from './error-handler';
4
+ export { getExtensionGenPromptOpts } from './extension-prompts';
4
5
  export * from './constants';
5
6
  export * from './destination';
6
7
  export * from './types';
@@ -14,7 +14,7 @@ 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.handleErrorMessage = exports.bail = exports.ERROR_TYPE = exports.ErrorHandler = exports.showOverwriteQuestion = exports.initI18n = exports.t = void 0;
17
+ exports.getExtensionGenPromptOpts = exports.handleErrorMessage = exports.bail = exports.ERROR_TYPE = exports.ErrorHandler = exports.showOverwriteQuestion = exports.initI18n = exports.t = void 0;
18
18
  var i18n_1 = require("./i18n");
19
19
  Object.defineProperty(exports, "t", { enumerable: true, get: function () { return i18n_1.t; } });
20
20
  Object.defineProperty(exports, "initI18n", { enumerable: true, get: function () { return i18n_1.initI18n; } });
@@ -25,6 +25,8 @@ Object.defineProperty(exports, "ErrorHandler", { enumerable: true, get: function
25
25
  Object.defineProperty(exports, "ERROR_TYPE", { enumerable: true, get: function () { return error_handler_1.ERROR_TYPE; } });
26
26
  Object.defineProperty(exports, "bail", { enumerable: true, get: function () { return error_handler_1.bail; } });
27
27
  Object.defineProperty(exports, "handleErrorMessage", { enumerable: true, get: function () { return error_handler_1.handleErrorMessage; } });
28
+ var extension_prompts_1 = require("./extension-prompts");
29
+ Object.defineProperty(exports, "getExtensionGenPromptOpts", { enumerable: true, get: function () { return extension_prompts_1.getExtensionGenPromptOpts; } });
28
30
  __exportStar(require("./constants"), exports);
29
31
  __exportStar(require("./destination"), exports);
30
32
  __exportStar(require("./types"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/deploy-config-generator-shared",
3
3
  "description": "Commonly used shared functionality and types to support the deploy config generator.",
4
- "version": "0.0.34",
4
+ "version": "0.0.36",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -21,7 +21,7 @@
21
21
  "i18next": "20.6.1",
22
22
  "yeoman-generator": "5.10.0",
23
23
  "@sap-ux/btp-utils": "1.0.1",
24
- "@sap-ux/fiori-generator-shared": "0.9.7",
24
+ "@sap-ux/fiori-generator-shared": "0.9.8",
25
25
  "@sap-ux/nodejs-utils": "0.1.7"
26
26
  },
27
27
  "devDependencies": {
@@ -30,6 +30,7 @@
30
30
  "@types/yeoman-generator": "5.2.11",
31
31
  "typescript": "5.3.3",
32
32
  "@sap-ux/axios-extension": "1.19.0",
33
+ "@sap-ux/inquirer-common": "0.6.28",
33
34
  "@sap-ux/store": "1.0.0"
34
35
  },
35
36
  "engines": {