@sap-ux/deploy-config-sub-generator 0.0.7 → 0.0.9

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,6 +1,6 @@
1
1
  import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
2
+ import { AppWizard, Prompts } from '@sap-devx/yeoman-ui-types';
2
3
  import { promptNames } from '../prompts/deploy-target';
3
- import { AppWizard, type Prompts } from '@sap-devx/yeoman-ui-types';
4
4
  import type { Answers } from 'inquirer';
5
5
  import type { DeployConfigGenerator, DeployConfigOptions } from '../types';
6
6
  import type { FioriToolsProxyConfigBackend } from '@sap-ux/ui5-config';
@@ -10,10 +10,10 @@ const project_access_1 = require("@sap-ux/project-access");
10
10
  const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
11
11
  const utils_1 = require("./utils");
12
12
  const utils_2 = require("../utils");
13
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
13
14
  const prompting_1 = require("./prompting");
14
15
  const deploy_target_1 = require("../prompts/deploy-target");
15
16
  Object.defineProperty(exports, "promptNames", { enumerable: true, get: function () { return deploy_target_1.promptNames; } });
16
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
17
17
  /**
18
18
  * The main deployment configuration generator.
19
19
  */
@@ -47,6 +47,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
47
47
  this.launchDeployConfigAsSubGenerator = opts.launchDeployConfigAsSubGenerator ?? false;
48
48
  this.target = (0, utils_1.parseTarget)(args, opts);
49
49
  this.vscode = opts.vscode;
50
+ (0, utils_1.registerNamespaces)(this.rootGeneratorName(), this.genNamespace, this.env.isPackageRegistered.bind(this.env), this.env.lookup.bind(this.env));
50
51
  // Extensions use options.data to pass in the options
51
52
  if (this.options.data?.destinationRoot) {
52
53
  this.launchStandaloneFromYui = true;
@@ -67,6 +68,16 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
67
68
  this.apiHubConfig = this.options.apiHubConfig ?? (0, utils_2.getEnvApiHubConfig)();
68
69
  this.launchStandaloneFromYui = false;
69
70
  }
71
+ // If launched standalone, set the header, title and description
72
+ if (this.launchStandaloneFromYui) {
73
+ this.appWizard.setHeaderTitle(utils_2.generatorTitle);
74
+ this.prompts = new yeoman_ui_types_1.Prompts((0, utils_1.getYUIDetails)(this.options.projectRoot));
75
+ this.setPromptsCallback = (fn) => {
76
+ if (this.prompts) {
77
+ this.prompts.setCallback(fn);
78
+ }
79
+ };
80
+ }
70
81
  }
71
82
  /**
72
83
  * Initialization phase for deployment configuration.
@@ -80,7 +91,7 @@ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
80
91
  if (this.isCap && !this.mtaPath) {
81
92
  this.target = deploy_config_generator_shared_1.TargetName.CF; // when CAP project and no mta.yaml, default to Cloud Foundry
82
93
  }
83
- this.options.projectRoot = capRoot ?? this.mtaPath ?? this.options.appRootPath;
94
+ this.options.projectRoot = capRoot ?? (this.mtaPath && (0, path_1.dirname)(this.mtaPath)) ?? this.options.appRootPath;
84
95
  ({ backendConfig: this.backendConfig, isLibrary: this.isLibrary } = await (0, utils_2.getBackendConfig)(this.fs, this.options, this.launchStandaloneFromYui, this.options.appRootPath));
85
96
  const { destinationName, servicePath } = await (0, utils_2.getApiHubOptions)(this.fs, {
86
97
  appPath: this.options.appRootPath,
@@ -1,4 +1,5 @@
1
1
  import type { DeployConfigOptions } from '../types';
2
+ import type { GeneratorOptions } from 'yeoman-generator';
2
3
  /**
3
4
  * Parses the target from the CLI args or the options.
4
5
  *
@@ -7,4 +8,23 @@ import type { DeployConfigOptions } from '../types';
7
8
  * @returns - the target
8
9
  */
9
10
  export declare function parseTarget(args: string | string[], opts: DeployConfigOptions): string | undefined;
11
+ /**
12
+ * Returns the details for the YUI prompt.
13
+ *
14
+ * @param appRootPath - path to the application to be displayed in YUI step description
15
+ * @returns step details
16
+ */
17
+ export declare function getYUIDetails(appRootPath: string): {
18
+ name: string;
19
+ description: string;
20
+ }[];
21
+ /**
22
+ * Registers all the root generator's namespaces i.e the subgenerators.
23
+ *
24
+ * @param rootGenerator - the root generator name
25
+ * @param generatorNamespace - the namespace of the generator
26
+ * @param isPackageRegistered - function to check if a package is registered
27
+ * @param lookup - function to lookup and register the package's namespaces
28
+ */
29
+ export declare function registerNamespaces(rootGenerator: string, generatorNamespace: string, isPackageRegistered: GeneratorOptions['env.isPackageRegistered'], lookup: GeneratorOptions['env.lookup']): void;
10
30
  //# sourceMappingURL=utils.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseTarget = void 0;
3
+ exports.registerNamespaces = exports.getYUIDetails = exports.parseTarget = void 0;
4
+ const path_1 = require("path");
4
5
  /**
5
6
  * Parses the target from the CLI args or the options.
6
7
  *
@@ -22,4 +23,33 @@ function parseTarget(args, opts) {
22
23
  return result;
23
24
  }
24
25
  exports.parseTarget = parseTarget;
26
+ /**
27
+ * Returns the details for the YUI prompt.
28
+ *
29
+ * @param appRootPath - path to the application to be displayed in YUI step description
30
+ * @returns step details
31
+ */
32
+ function getYUIDetails(appRootPath) {
33
+ return [
34
+ {
35
+ name: 'Deployment Configuration',
36
+ description: `Configure Deployment settings - ${(0, path_1.basename)(appRootPath)}`
37
+ }
38
+ ];
39
+ }
40
+ exports.getYUIDetails = getYUIDetails;
41
+ /**
42
+ * Registers all the root generator's namespaces i.e the subgenerators.
43
+ *
44
+ * @param rootGenerator - the root generator name
45
+ * @param generatorNamespace - the namespace of the generator
46
+ * @param isPackageRegistered - function to check if a package is registered
47
+ * @param lookup - function to lookup and register the package's namespaces
48
+ */
49
+ function registerNamespaces(rootGenerator, generatorNamespace, isPackageRegistered, lookup) {
50
+ if (rootGenerator && !isPackageRegistered(generatorNamespace)) {
51
+ lookup({ packagePatterns: [rootGenerator] });
52
+ }
53
+ }
54
+ exports.registerNamespaces = registerNamespaces;
25
55
  //# sourceMappingURL=utils.js.map
@@ -1,5 +1,6 @@
1
1
  import type { Target } from '../types';
2
2
  export declare const generatorNamespace: (bundledRootGeneratorName: string, subGenName: string) => string;
3
+ export declare const generatorTitle = "Deployment Configuration Generator";
3
4
  export declare const abapChoice: Target;
4
5
  export declare const cfChoice: Target;
5
6
  //# sourceMappingURL=constants.d.ts.map
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cfChoice = exports.abapChoice = exports.generatorNamespace = void 0;
3
+ exports.cfChoice = exports.abapChoice = exports.generatorTitle = exports.generatorNamespace = void 0;
4
4
  // When deployment generator is bundled the namespacing is relative to the root generator
5
5
  const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
6
6
  const generatorNamespace = (bundledRootGeneratorName, subGenName) => `${bundledRootGeneratorName}_${subGenName}`;
7
7
  exports.generatorNamespace = generatorNamespace;
8
+ exports.generatorTitle = 'Deployment Configuration Generator';
8
9
  exports.abapChoice = { name: deploy_config_generator_shared_1.TargetName.ABAP, description: 'ABAP' };
9
10
  exports.cfChoice = { name: deploy_config_generator_shared_1.TargetName.CF, description: 'Cloud Foundry' };
10
11
  //# sourceMappingURL=constants.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/deploy-config-sub-generator",
3
3
  "description": "Main generator for configuring ABAP or Cloud Foundry deployment configuration",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -25,9 +25,9 @@
25
25
  "i18next": "23.5.1",
26
26
  "inquirer-autocomplete-prompt": "2.0.1",
27
27
  "yeoman-generator": "5.10.0",
28
- "@sap-ux/cf-deploy-config-sub-generator": "0.1.27",
29
28
  "@sap-ux/axios-extension": "1.19.1",
30
29
  "@sap-ux/btp-utils": "1.0.2",
30
+ "@sap-ux/cf-deploy-config-sub-generator": "0.1.28",
31
31
  "@sap-ux/abap-deploy-config-sub-generator": "0.0.51",
32
32
  "@sap-ux/deploy-config-generator-shared": "0.0.37",
33
33
  "@sap-ux/fiori-generator-shared": "0.9.9",
@@ -57,7 +57,7 @@
57
57
  "typescript": "5.3.3",
58
58
  "unionfs": "4.4.0",
59
59
  "yeoman-test": "6.3.0",
60
- "@sap-ux/cf-deploy-config-inquirer": "0.2.18",
60
+ "@sap-ux/cf-deploy-config-inquirer": "0.2.19",
61
61
  "@sap-ux/cf-deploy-config-writer": "0.1.22",
62
62
  "@sap-ux/logger": "0.6.0"
63
63
  },