@sap-ux/create 0.13.49 → 0.13.51
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,22 +1,8 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
-
import { type Editor } from 'mem-fs-editor';
|
|
3
|
-
import type { ToolsLogger } from '@sap-ux/logger';
|
|
4
|
-
import type { Manifest } from '@sap-ux/project-access';
|
|
5
2
|
/**
|
|
6
3
|
* Add the "add inbound-navigation" command to a passed command.
|
|
7
4
|
*
|
|
8
5
|
* @param cmd - commander command for adding navigation inbounds config command
|
|
9
6
|
*/
|
|
10
7
|
export declare function addInboundNavigationConfigCommand(cmd: Command): void;
|
|
11
|
-
/**
|
|
12
|
-
* Retrieves the project's manifest file, handling both Fiori and Adaptation project scenarios.
|
|
13
|
-
*
|
|
14
|
-
* @param {string} basePath - The base path to the project.
|
|
15
|
-
* @param {boolean} isAdp - Indicates whether the project is an ADP project.
|
|
16
|
-
* @param {Editor} fs - The mem-fs editor instance.
|
|
17
|
-
* @param {ToolsLogger} logger - The logger instance.
|
|
18
|
-
* @returns {Promise<Manifest>} The manifest file content.
|
|
19
|
-
* @throws {Error} If the project is not CloudReady or the manifest cannot be retrieved.
|
|
20
|
-
*/
|
|
21
|
-
export declare function getManifest(basePath: string, isAdp: boolean, fs: Editor, logger: ToolsLogger): Promise<Manifest>;
|
|
22
8
|
//# sourceMappingURL=navigation-config.d.ts.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addInboundNavigationConfigCommand = addInboundNavigationConfigCommand;
|
|
4
|
-
exports.getManifest = getManifest;
|
|
5
|
-
const path_1 = require("path");
|
|
6
4
|
const mem_fs_1 = require("mem-fs");
|
|
7
5
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
8
6
|
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
@@ -10,6 +8,7 @@ const flp_config_inquirer_1 = require("@sap-ux/flp-config-inquirer");
|
|
|
10
8
|
const project_access_1 = require("@sap-ux/project-access");
|
|
11
9
|
const system_access_1 = require("@sap-ux/system-access");
|
|
12
10
|
const app_config_writer_1 = require("@sap-ux/app-config-writer");
|
|
11
|
+
const flp_config_inquirer_2 = require("@sap-ux/flp-config-inquirer");
|
|
13
12
|
const common_1 = require("../../common");
|
|
14
13
|
const validation_1 = require("../../validation");
|
|
15
14
|
const prompts_1 = require("../../common/prompts");
|
|
@@ -23,11 +22,12 @@ function addInboundNavigationConfigCommand(cmd) {
|
|
|
23
22
|
cmd.command('inbound-navigation [path]')
|
|
24
23
|
.option('-s, --simulate', 'simulate only do not write config; sets also --verbose')
|
|
25
24
|
.option('-v, --verbose', 'show verbose information')
|
|
25
|
+
.option('-c, --config <string>', 'Path to project configuration file in YAML format', project_access_1.FileName.Ui5Yaml)
|
|
26
26
|
.action(async (path, options) => {
|
|
27
27
|
if (options.verbose === true || options.simulate) {
|
|
28
28
|
(0, tracing_1.setLogLevelVerbose)();
|
|
29
29
|
}
|
|
30
|
-
await addInboundNavigationConfig(path || process.cwd(), !!options.simulate);
|
|
30
|
+
await addInboundNavigationConfig(path || process.cwd(), !!options.simulate, options.config);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -35,33 +35,33 @@ function addInboundNavigationConfigCommand(cmd) {
|
|
|
35
35
|
*
|
|
36
36
|
* @param {string} basePath - The path to the application root.
|
|
37
37
|
* @param {boolean} simulate - If true, simulates the changes without writing them; otherwise, writes changes.
|
|
38
|
+
* @param {string} yamlPath - The path to the project configuration file in YAML format.
|
|
38
39
|
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
39
40
|
*/
|
|
40
|
-
async function addInboundNavigationConfig(basePath, simulate) {
|
|
41
|
+
async function addInboundNavigationConfig(basePath, simulate, yamlPath) {
|
|
41
42
|
const logger = (0, tracing_1.getLogger)();
|
|
42
43
|
try {
|
|
43
44
|
logger.debug(`Called add inbound navigation-config for path '${basePath}', simulate is '${simulate}'`);
|
|
44
45
|
await (0, validation_1.validateBasePath)(basePath);
|
|
45
46
|
const appType = await (0, project_access_1.getAppType)(basePath);
|
|
46
47
|
const isAdp = appType === 'Fiori Adaptation';
|
|
47
|
-
if (isAdp && (await (0, adp_tooling_1.flpConfigurationExists)(basePath))) {
|
|
48
|
-
logger.info('FLP Configuration already exists.');
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
48
|
const fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const inbounds = await getInbounds(basePath, yamlPath, isAdp, fs, logger);
|
|
50
|
+
let tileSettingsAnswers;
|
|
51
|
+
if (inbounds && isAdp) {
|
|
52
|
+
tileSettingsAnswers = await (0, common_1.promptYUIQuestions)((0, flp_config_inquirer_2.getTileSettingsQuestions)(), false);
|
|
53
|
+
}
|
|
54
|
+
const answers = await getUserAnswers(inbounds, isAdp, tileSettingsAnswers);
|
|
55
|
+
if (!answers) {
|
|
57
56
|
logger.info('User chose not to overwrite existing inbound navigation configuration.');
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
if (isAdp) {
|
|
60
|
+
const config = (0, flp_config_inquirer_2.getAdpFlpInboundsWriterConfig)(answers, tileSettingsAnswers);
|
|
61
61
|
await (0, adp_tooling_1.generateInboundConfig)(basePath, config, fs);
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
|
-
await (0, app_config_writer_1.generateInboundNavigationConfig)(basePath,
|
|
64
|
+
await (0, app_config_writer_1.generateInboundNavigationConfig)(basePath, answers, true, fs);
|
|
65
65
|
}
|
|
66
66
|
if (!simulate) {
|
|
67
67
|
fs.commit(() => logger.info(`Inbound navigation configuration complete.`));
|
|
@@ -76,20 +76,24 @@ async function addInboundNavigationConfig(basePath, simulate) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* Retrieves the
|
|
79
|
+
* Retrieves the inbounds for the given project, handling both ADP and Fiori scenarios.
|
|
80
80
|
*
|
|
81
81
|
* @param {string} basePath - The base path to the project.
|
|
82
|
+
* @param {string} yamlPath - The path to the project configuration file in YAML format.
|
|
82
83
|
* @param {boolean} isAdp - Indicates whether the project is an ADP project.
|
|
83
84
|
* @param {Editor} fs - The mem-fs editor instance.
|
|
84
85
|
* @param {ToolsLogger} logger - The logger instance.
|
|
85
|
-
* @returns {Promise<
|
|
86
|
-
* @throws {Error} If the project is not CloudReady or the manifest cannot be retrieved.
|
|
86
|
+
* @returns {Promise<ManifestNamespace.Inbound | undefined>} The inbounds from the manifest or mapped from the system.
|
|
87
87
|
*/
|
|
88
|
-
async function
|
|
88
|
+
async function getInbounds(basePath, yamlPath, isAdp, fs, logger) {
|
|
89
89
|
if (isAdp) {
|
|
90
|
-
|
|
90
|
+
const appId = (await (0, adp_tooling_1.getVariant)(basePath)).reference;
|
|
91
|
+
const { target, ignoreCertErrors = false } = await (0, adp_tooling_1.getAdpConfig)(basePath, yamlPath);
|
|
92
|
+
const provider = await (0, system_access_1.createAbapServiceProvider)(target, { ignoreCertErrors }, true, logger);
|
|
93
|
+
return (0, adp_tooling_1.getBaseAppInbounds)(appId, provider);
|
|
91
94
|
}
|
|
92
|
-
|
|
95
|
+
const manifest = await retrieveManifest(basePath, fs);
|
|
96
|
+
return (0, adp_tooling_1.getInboundsFromManifest)(manifest);
|
|
93
97
|
}
|
|
94
98
|
/**
|
|
95
99
|
* Retrieves the manifest for a Fiori project.
|
|
@@ -102,44 +106,27 @@ async function retrieveManifest(basePath, fs) {
|
|
|
102
106
|
const { manifest } = await (0, app_config_writer_1.readManifest)(basePath, fs);
|
|
103
107
|
return manifest;
|
|
104
108
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Retrieves the manifest for an Adaptation Project (ADP).
|
|
107
|
-
*
|
|
108
|
-
* @param {string} basePath - The base path to the ADP project.
|
|
109
|
-
* @param {ToolsLogger} logger - The logger instance.
|
|
110
|
-
* @returns {Promise<Manifest>} The merged manifest for the ADP project.
|
|
111
|
-
* @throws {Error} If the project is not CloudReady.
|
|
112
|
-
*/
|
|
113
|
-
async function retrieveMergedManifest(basePath, logger) {
|
|
114
|
-
const variant = await (0, adp_tooling_1.getVariant)(basePath);
|
|
115
|
-
const { target, ignoreCertErrors = false } = await (0, adp_tooling_1.getAdpConfig)(basePath, (0, path_1.join)(basePath, project_access_1.FileName.Ui5Yaml));
|
|
116
|
-
const provider = await (0, system_access_1.createAbapServiceProvider)(target, { ignoreCertErrors }, true, logger);
|
|
117
|
-
const manifestService = await adp_tooling_1.ManifestService.initMergedManifest(provider, basePath, variant, logger);
|
|
118
|
-
return manifestService.getManifest();
|
|
119
|
-
}
|
|
120
109
|
/**
|
|
121
110
|
* Prompts the user for inbound navigation configuration.
|
|
122
111
|
*
|
|
123
112
|
* @param {ManifestNamespace.Inbound | undefined} inbounds - The existing inbounds if any.
|
|
124
113
|
* @param {boolean} isAdp - Indicates whether the project is an ADP project.
|
|
125
|
-
* @param {
|
|
114
|
+
* @param {TileSettingsAnswers} [tileSettingsAnswers] - The answers for tile settings.
|
|
126
115
|
* @returns {Promise<FLPConfigAnswers | undefined>} A promise resolving to the user-provided configuration,
|
|
127
116
|
* or `undefined` if the user opts not to overwrite.
|
|
128
117
|
*/
|
|
129
|
-
async function
|
|
118
|
+
async function getUserAnswers(inbounds, isAdp, tileSettingsAnswers) {
|
|
130
119
|
let promptOptions;
|
|
131
120
|
if (!isAdp) {
|
|
132
121
|
promptOptions = {
|
|
133
122
|
inboundId: { hide: true },
|
|
134
|
-
additionalParameters: { hide: true }
|
|
135
|
-
createAnotherInbound: { hide: true },
|
|
136
|
-
emptyInboundsInfo: { hide: true }
|
|
123
|
+
additionalParameters: { hide: true }
|
|
137
124
|
};
|
|
138
125
|
}
|
|
139
126
|
else {
|
|
140
|
-
promptOptions =
|
|
127
|
+
promptOptions = (0, flp_config_inquirer_2.getAdpFlpConfigPromptOptions)(tileSettingsAnswers, inbounds);
|
|
141
128
|
}
|
|
142
|
-
const prompts = await (0, prompts_1.filterLabelTypeQuestions)(await (0, flp_config_inquirer_1.getPrompts)(inbounds,
|
|
129
|
+
const prompts = await (0, prompts_1.filterLabelTypeQuestions)(await (0, flp_config_inquirer_1.getPrompts)(inbounds, promptOptions));
|
|
143
130
|
const config = await (0, common_1.promptYUIQuestions)(prompts, false);
|
|
144
131
|
if (config?.subTitle === '') {
|
|
145
132
|
config.subTitle = undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/create",
|
|
3
3
|
"description": "SAP Fiori tools module to add or remove features",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.51",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
"mem-fs": "2.1.0",
|
|
31
31
|
"mem-fs-editor": "9.4.0",
|
|
32
32
|
"prompts": "2.4.2",
|
|
33
|
-
"@sap-ux/abap-deploy-config-inquirer": "1.4.
|
|
34
|
-
"@sap-ux/abap-deploy-config-writer": "0.1.
|
|
35
|
-
"@sap-ux/adp-tooling": "0.14.
|
|
36
|
-
"@sap-ux/app-config-writer": "0.6.
|
|
37
|
-
"@sap-ux/cap-config-writer": "0.10.
|
|
33
|
+
"@sap-ux/abap-deploy-config-inquirer": "1.4.24",
|
|
34
|
+
"@sap-ux/abap-deploy-config-writer": "0.1.11",
|
|
35
|
+
"@sap-ux/adp-tooling": "0.14.29",
|
|
36
|
+
"@sap-ux/app-config-writer": "0.6.15",
|
|
37
|
+
"@sap-ux/cap-config-writer": "0.10.10",
|
|
38
38
|
"@sap-ux/cards-editor-config-writer": "0.5.2",
|
|
39
39
|
"@sap-ux/logger": "0.7.0",
|
|
40
|
-
"@sap-ux/mockserver-config-writer": "0.9.
|
|
41
|
-
"@sap-ux/odata-service-writer": "0.27.
|
|
42
|
-
"@sap-ux/preview-middleware": "0.20.
|
|
43
|
-
"@sap-ux/project-access": "1.30.
|
|
44
|
-
"@sap-ux/system-access": "0.6.
|
|
40
|
+
"@sap-ux/mockserver-config-writer": "0.9.3",
|
|
41
|
+
"@sap-ux/odata-service-writer": "0.27.6",
|
|
42
|
+
"@sap-ux/preview-middleware": "0.20.41",
|
|
43
|
+
"@sap-ux/project-access": "1.30.3",
|
|
44
|
+
"@sap-ux/system-access": "0.6.8",
|
|
45
45
|
"@sap-ux/ui5-config": "0.28.2",
|
|
46
|
-
"@sap-ux/flp-config-inquirer": "0.3.
|
|
46
|
+
"@sap-ux/flp-config-inquirer": "0.3.29"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/diff": "5.0.9",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@types/mem-fs": "1.1.2",
|
|
52
52
|
"@types/mem-fs-editor": "7.0.1",
|
|
53
53
|
"@types/prompts": "2.4.4",
|
|
54
|
-
"@sap-ux/inquirer-common": "0.7.
|
|
54
|
+
"@sap-ux/inquirer-common": "0.7.14",
|
|
55
55
|
"@sap-ux/store": "1.1.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|