@sap-ux/app-config-writer 0.5.50 → 0.5.52
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/{variants-config → common}/ui5-yaml.d.ts +1 -1
- package/dist/{variants-config → common}/ui5-yaml.js +3 -3
- package/dist/common/utils.d.ts +41 -0
- package/dist/common/utils.js +64 -0
- package/dist/preview-config/ui5-yaml.js +2 -2
- package/dist/variants-config/generateVariantsConfig.js +2 -2
- package/dist/variants-config/package-json.js +3 -2
- package/dist/variants-config/utils.d.ts +1 -33
- package/dist/variants-config/utils.js +9 -66
- package/package.json +3 -3
|
@@ -28,5 +28,5 @@ export declare function createPreviewMiddlewareConfig(fs: Editor, basePath: stri
|
|
|
28
28
|
* @param yamlPath - path to the ui5*.yaml file passed by cli
|
|
29
29
|
* @param logger - logger
|
|
30
30
|
*/
|
|
31
|
-
export declare function
|
|
31
|
+
export declare function updateMiddlewaresForPreview(fs: Editor, basePath: string, yamlPath?: string, logger?: ToolsLogger): Promise<void>;
|
|
32
32
|
//# sourceMappingURL=ui5-yaml.d.ts.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEnhancedReloadMiddleware = getEnhancedReloadMiddleware;
|
|
4
4
|
exports.createPreviewMiddlewareConfig = createPreviewMiddlewareConfig;
|
|
5
|
-
exports.
|
|
5
|
+
exports.updateMiddlewaresForPreview = updateMiddlewaresForPreview;
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const types_1 = require("../types");
|
|
8
8
|
const project_access_1 = require("@sap-ux/project-access");
|
|
9
|
-
const utils_1 = require("
|
|
9
|
+
const utils_1 = require("../common/utils");
|
|
10
10
|
/**
|
|
11
11
|
* Gets the reload middleware form the provided yamlConfig.
|
|
12
12
|
* The middleware can either be named 'fiori-tools-appreload' or 'reload-middleware'.
|
|
@@ -52,7 +52,7 @@ function createPreviewMiddlewareConfig(fs, basePath) {
|
|
|
52
52
|
* @param yamlPath - path to the ui5*.yaml file passed by cli
|
|
53
53
|
* @param logger - logger
|
|
54
54
|
*/
|
|
55
|
-
async function
|
|
55
|
+
async function updateMiddlewaresForPreview(fs, basePath, yamlPath, logger) {
|
|
56
56
|
const ui5YamlFile = yamlPath ? (0, path_1.basename)(yamlPath) : project_access_1.FileName.Ui5Yaml;
|
|
57
57
|
const ui5YamlConfig = await (0, project_access_1.readUi5Yaml)(basePath, ui5YamlFile, fs);
|
|
58
58
|
let previewMiddleware = await (0, utils_1.getPreviewMiddleware)(ui5YamlConfig);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CustomMiddleware, UI5Config } from '@sap-ux/ui5-config';
|
|
2
|
+
import type { PreviewConfigOptions, FioriToolsDeprecatedPreviewConfig } from '../types';
|
|
3
|
+
import type { Editor } from 'mem-fs-editor';
|
|
4
|
+
/**
|
|
5
|
+
* Type guard to check if the given configuration is a deprecated preview middleware configuration.
|
|
6
|
+
*
|
|
7
|
+
* @param configuration preview middleware configuration
|
|
8
|
+
* @returns true, if a preview middleware configuration is deprecated
|
|
9
|
+
*/
|
|
10
|
+
export declare function isFioriToolsDeprecatedPreviewConfig(configuration: PreviewConfigOptions | undefined): configuration is FioriToolsDeprecatedPreviewConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the preview middleware form the yamlConfig or provided path.
|
|
13
|
+
* The middleware can either be named 'fiori-tools-preview' or 'preview-middleware'.
|
|
14
|
+
*
|
|
15
|
+
* @param yamlConfig - the yaml configuration to use; if not provided, the file will be read with the provided basePath and filename
|
|
16
|
+
* @param basePath - path to project root, where ui5.yaml is located
|
|
17
|
+
* @param filename - name of the ui5 yaml file to read from basePath; default is 'ui5.yaml'
|
|
18
|
+
* @param fs - the memfs editor instance
|
|
19
|
+
* @returns preview middleware configuration if found
|
|
20
|
+
* Rejects if neither yamlConfig nor basePath is provided or if the file can't be read
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPreviewMiddleware(yamlConfig?: UI5Config, basePath?: string, filename?: string, fs?: Editor): Promise<CustomMiddleware<PreviewConfigOptions> | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the intent of the preview middleware configuration from the ui5.yaml file, if given.
|
|
25
|
+
*
|
|
26
|
+
* @param previewMiddlewareConfig - configuration of the preview middleware
|
|
27
|
+
* @returns - preview intent or undefined
|
|
28
|
+
*/
|
|
29
|
+
export declare function getIntentFromPreviewConfig(previewMiddlewareConfig: PreviewConfigOptions | undefined): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the serve command for the preview middleware configuration of the ui5.yaml file, if given.
|
|
32
|
+
* If the fiori-tools-preview middleware is used, then the serve command will be 'fiori run'.
|
|
33
|
+
* If the preview middleware is used, the serve command will be 'ui5 serve'.
|
|
34
|
+
*
|
|
35
|
+
* @param basePath - path to project root, where ui5.yaml is located
|
|
36
|
+
* @param yamlFileName - name of the ui5 yaml file to read from basePath; default is 'ui5.yaml'
|
|
37
|
+
* @param fs - the memfs editor instance
|
|
38
|
+
* @returns - preview serve or undefined
|
|
39
|
+
*/
|
|
40
|
+
export declare function getCLIForPreview(basePath: string, yamlFileName: string, fs: Editor): Promise<string | undefined>;
|
|
41
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isFioriToolsDeprecatedPreviewConfig = isFioriToolsDeprecatedPreviewConfig;
|
|
4
|
+
exports.getPreviewMiddleware = getPreviewMiddleware;
|
|
5
|
+
exports.getIntentFromPreviewConfig = getIntentFromPreviewConfig;
|
|
6
|
+
exports.getCLIForPreview = getCLIForPreview;
|
|
7
|
+
const project_access_1 = require("@sap-ux/project-access");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
|
+
/**
|
|
10
|
+
* Type guard to check if the given configuration is a deprecated preview middleware configuration.
|
|
11
|
+
*
|
|
12
|
+
* @param configuration preview middleware configuration
|
|
13
|
+
* @returns true, if a preview middleware configuration is deprecated
|
|
14
|
+
*/
|
|
15
|
+
function isFioriToolsDeprecatedPreviewConfig(configuration) {
|
|
16
|
+
return configuration?.component !== undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets the preview middleware form the yamlConfig or provided path.
|
|
20
|
+
* The middleware can either be named 'fiori-tools-preview' or 'preview-middleware'.
|
|
21
|
+
*
|
|
22
|
+
* @param yamlConfig - the yaml configuration to use; if not provided, the file will be read with the provided basePath and filename
|
|
23
|
+
* @param basePath - path to project root, where ui5.yaml is located
|
|
24
|
+
* @param filename - name of the ui5 yaml file to read from basePath; default is 'ui5.yaml'
|
|
25
|
+
* @param fs - the memfs editor instance
|
|
26
|
+
* @returns preview middleware configuration if found
|
|
27
|
+
* Rejects if neither yamlConfig nor basePath is provided or if the file can't be read
|
|
28
|
+
*/
|
|
29
|
+
async function getPreviewMiddleware(yamlConfig, basePath, filename = project_access_1.FileName.Ui5Yaml, fs) {
|
|
30
|
+
if (!basePath && !yamlConfig) {
|
|
31
|
+
throw new Error('Either base path or yaml config must be provided.');
|
|
32
|
+
}
|
|
33
|
+
yamlConfig = yamlConfig ?? (await (0, project_access_1.readUi5Yaml)(basePath, filename, fs));
|
|
34
|
+
return (yamlConfig.findCustomMiddleware(types_1.MiddlewareConfigs.FioriToolsPreview) ??
|
|
35
|
+
yamlConfig.findCustomMiddleware(types_1.MiddlewareConfigs.PreviewMiddleware));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns the intent of the preview middleware configuration from the ui5.yaml file, if given.
|
|
39
|
+
*
|
|
40
|
+
* @param previewMiddlewareConfig - configuration of the preview middleware
|
|
41
|
+
* @returns - preview intent or undefined
|
|
42
|
+
*/
|
|
43
|
+
function getIntentFromPreviewConfig(previewMiddlewareConfig) {
|
|
44
|
+
if (isFioriToolsDeprecatedPreviewConfig(previewMiddlewareConfig)) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const intent = previewMiddlewareConfig?.flp?.intent;
|
|
48
|
+
return intent ? `#${intent.object}-${intent.action}` : undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Returns the serve command for the preview middleware configuration of the ui5.yaml file, if given.
|
|
52
|
+
* If the fiori-tools-preview middleware is used, then the serve command will be 'fiori run'.
|
|
53
|
+
* If the preview middleware is used, the serve command will be 'ui5 serve'.
|
|
54
|
+
*
|
|
55
|
+
* @param basePath - path to project root, where ui5.yaml is located
|
|
56
|
+
* @param yamlFileName - name of the ui5 yaml file to read from basePath; default is 'ui5.yaml'
|
|
57
|
+
* @param fs - the memfs editor instance
|
|
58
|
+
* @returns - preview serve or undefined
|
|
59
|
+
*/
|
|
60
|
+
async function getCLIForPreview(basePath, yamlFileName, fs) {
|
|
61
|
+
const previewMiddleware = await getPreviewMiddleware(undefined, basePath, yamlFileName, fs);
|
|
62
|
+
return previewMiddleware?.name === types_1.MiddlewareConfigs.PreviewMiddleware ? 'ui5 serve' : 'fiori run';
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -12,10 +12,10 @@ exports.updateDefaultTestConfig = updateDefaultTestConfig;
|
|
|
12
12
|
exports.getScriptsFromPackageJson = getScriptsFromPackageJson;
|
|
13
13
|
exports.updatePreviewMiddlewareConfigs = updatePreviewMiddlewareConfigs;
|
|
14
14
|
const path_1 = require("path");
|
|
15
|
-
const ui5_yaml_1 = require("../
|
|
15
|
+
const ui5_yaml_1 = require("../common/ui5-yaml");
|
|
16
16
|
const package_json_1 = require("./package-json");
|
|
17
17
|
const project_access_1 = require("@sap-ux/project-access");
|
|
18
|
-
const utils_1 = require("../
|
|
18
|
+
const utils_1 = require("../common/utils");
|
|
19
19
|
const preview_files_1 = require("./preview-files");
|
|
20
20
|
const DEFAULT_FLP_PATH = '/test/flp.html';
|
|
21
21
|
const DEFAULT_INTENT = {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateVariantsConfig = generateVariantsConfig;
|
|
4
4
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
5
5
|
const mem_fs_1 = require("mem-fs");
|
|
6
|
-
const ui5_yaml_1 = require("
|
|
6
|
+
const ui5_yaml_1 = require("../common/ui5-yaml");
|
|
7
7
|
const package_json_1 = require("./package-json");
|
|
8
8
|
/**
|
|
9
9
|
* Add variants configuration to an app or project.
|
|
@@ -18,7 +18,7 @@ async function generateVariantsConfig(basePath, yamlPath, logger, fs) {
|
|
|
18
18
|
if (!fs) {
|
|
19
19
|
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
20
20
|
}
|
|
21
|
-
await (0, ui5_yaml_1.
|
|
21
|
+
await (0, ui5_yaml_1.updateMiddlewaresForPreview)(fs, basePath, yamlPath, logger);
|
|
22
22
|
await (0, package_json_1.addVariantsManagementScript)(fs, basePath, yamlPath, logger);
|
|
23
23
|
return fs;
|
|
24
24
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addVariantsManagementScript = addVariantsManagementScript;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
|
+
const utils_2 = require("../common/utils");
|
|
6
7
|
const project_access_1 = require("@sap-ux/project-access");
|
|
7
8
|
const ERROR_MSG = `Script 'start-variants-management' cannot be written to package.json.`;
|
|
8
9
|
/**
|
|
@@ -25,8 +26,8 @@ async function addVariantsManagementScript(fs, basePath, yamlPath, logger) {
|
|
|
25
26
|
logger?.warn(`File 'package.json' does not contain a script section. Script section added.`);
|
|
26
27
|
packageJson.scripts = {};
|
|
27
28
|
}
|
|
28
|
-
const url = await (0, utils_1.getRTAUrl)(basePath, (0, utils_1.
|
|
29
|
-
const serveCommand = await (0,
|
|
29
|
+
const url = await (0, utils_1.getRTAUrl)(basePath, (0, utils_1.getRTAUrlParameters)(packageJson), ui5YamlFileName, fs);
|
|
30
|
+
const serveCommand = await (0, utils_2.getCLIForPreview)(basePath, ui5YamlFileName, fs);
|
|
30
31
|
if (!url) {
|
|
31
32
|
throw new Error(`${ERROR_MSG} No RTA editor specified in ui5.yaml.`);
|
|
32
33
|
}
|
|
@@ -1,44 +1,12 @@
|
|
|
1
1
|
import type { Package } from '@sap-ux/project-access';
|
|
2
|
-
import type { CustomMiddleware, UI5Config } from '@sap-ux/ui5-config';
|
|
3
|
-
import type { PreviewConfigOptions, FioriToolsDeprecatedPreviewConfig } from '../types';
|
|
4
2
|
import type { Editor } from 'mem-fs-editor';
|
|
5
|
-
/**
|
|
6
|
-
* Gets the preview middleware form the yamlConfig or provided path.
|
|
7
|
-
* The middleware can either be named 'fiori-tools-preview' or 'preview-middleware'.
|
|
8
|
-
*
|
|
9
|
-
* @param yamlConfig - the yaml configuration to use; if not provided, the file will be read with the provided basePath and filename
|
|
10
|
-
* @param basePath - path to project root, where ui5.yaml is located
|
|
11
|
-
* @param filename - name of the ui5 yaml file to read from basePath; default is 'ui5.yaml'
|
|
12
|
-
* @param fs - the memfs editor instance
|
|
13
|
-
* @returns preview middleware configuration if found
|
|
14
|
-
* Rejects if neither yamlConfig nor basePath is provided or if the file can't be read
|
|
15
|
-
*/
|
|
16
|
-
export declare function getPreviewMiddleware(yamlConfig?: UI5Config, basePath?: string, filename?: string, fs?: Editor): Promise<CustomMiddleware<PreviewConfigOptions> | undefined>;
|
|
17
|
-
/**
|
|
18
|
-
* Type guard to check if the given configuration is a deprecated preview middleware configuration.
|
|
19
|
-
*
|
|
20
|
-
* @param configuration preview middleware configuration
|
|
21
|
-
* @returns true, if a preview middleware configuration is deprecated
|
|
22
|
-
*/
|
|
23
|
-
export declare function isFioriToolsDeprecatedPreviewConfig(configuration: PreviewConfigOptions | undefined): configuration is FioriToolsDeprecatedPreviewConfig;
|
|
24
3
|
/**
|
|
25
4
|
* Get the url parameters needed for the UI5 run time adaptation.
|
|
26
5
|
*
|
|
27
6
|
@param packageJson - package.json file
|
|
28
7
|
* @returns enhanced url parameters
|
|
29
8
|
*/
|
|
30
|
-
export declare function
|
|
31
|
-
/**
|
|
32
|
-
* Returns the serve command for the preview middleware configuration of the ui5.yaml file, if given.
|
|
33
|
-
* If the fiori-tools-preview middleware is used, then the serve command will be 'fiori run'.
|
|
34
|
-
* If the preview middleware is used, the serve command will be 'ui5 serve'.
|
|
35
|
-
*
|
|
36
|
-
* @param basePath - path to project root, where ui5.yaml is located
|
|
37
|
-
* @param yamlFileName - name of the ui5 yaml file to read from basePath; default is 'ui5.yaml'
|
|
38
|
-
* @param fs - the memfs editor instance
|
|
39
|
-
* @returns - preview serve or undefined
|
|
40
|
-
*/
|
|
41
|
-
export declare function getRTAServe(basePath: string, yamlFileName: string, fs: Editor): Promise<string | undefined>;
|
|
9
|
+
export declare function getRTAUrlParameters(packageJson: Package): string;
|
|
42
10
|
/**
|
|
43
11
|
* Returns the url for variants management in RTA mode.
|
|
44
12
|
* The url consist of a specified mount point and intent given from the ui5.yaml file as well as parameters for the RTA mode.
|
|
@@ -1,49 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.isFioriToolsDeprecatedPreviewConfig = isFioriToolsDeprecatedPreviewConfig;
|
|
5
|
-
exports.getRtaUrlParameters = getRtaUrlParameters;
|
|
6
|
-
exports.getRTAServe = getRTAServe;
|
|
3
|
+
exports.getRTAUrlParameters = getRTAUrlParameters;
|
|
7
4
|
exports.getRTAUrl = getRTAUrl;
|
|
8
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
9
5
|
const types_1 = require("../types");
|
|
10
6
|
const querystring_1 = require("querystring");
|
|
11
7
|
const semver_1 = require("semver");
|
|
12
|
-
|
|
13
|
-
* Gets the preview middleware form the yamlConfig or provided path.
|
|
14
|
-
* The middleware can either be named 'fiori-tools-preview' or 'preview-middleware'.
|
|
15
|
-
*
|
|
16
|
-
* @param yamlConfig - the yaml configuration to use; if not provided, the file will be read with the provided basePath and filename
|
|
17
|
-
* @param basePath - path to project root, where ui5.yaml is located
|
|
18
|
-
* @param filename - name of the ui5 yaml file to read from basePath; default is 'ui5.yaml'
|
|
19
|
-
* @param fs - the memfs editor instance
|
|
20
|
-
* @returns preview middleware configuration if found
|
|
21
|
-
* Rejects if neither yamlConfig nor basePath is provided or if the file can't be read
|
|
22
|
-
*/
|
|
23
|
-
async function getPreviewMiddleware(yamlConfig, basePath, filename = project_access_1.FileName.Ui5Yaml, fs) {
|
|
24
|
-
if (!basePath && !yamlConfig) {
|
|
25
|
-
throw new Error('Either base path or yaml config must be provided.');
|
|
26
|
-
}
|
|
27
|
-
yamlConfig = yamlConfig ?? (await (0, project_access_1.readUi5Yaml)(basePath, filename, fs));
|
|
28
|
-
return (yamlConfig.findCustomMiddleware(types_1.MiddlewareConfigs.FioriToolsPreview) ??
|
|
29
|
-
yamlConfig.findCustomMiddleware(types_1.MiddlewareConfigs.PreviewMiddleware));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Type guard to check if the given configuration is a deprecated preview middleware configuration.
|
|
33
|
-
*
|
|
34
|
-
* @param configuration preview middleware configuration
|
|
35
|
-
* @returns true, if a preview middleware configuration is deprecated
|
|
36
|
-
*/
|
|
37
|
-
function isFioriToolsDeprecatedPreviewConfig(configuration) {
|
|
38
|
-
return configuration?.component !== undefined;
|
|
39
|
-
}
|
|
8
|
+
const utils_1 = require("../common/utils");
|
|
40
9
|
/**
|
|
41
10
|
* Get the url parameters needed for the UI5 run time adaptation.
|
|
42
11
|
*
|
|
43
12
|
@param packageJson - package.json file
|
|
44
13
|
* @returns enhanced url parameters
|
|
45
14
|
*/
|
|
46
|
-
function
|
|
15
|
+
function getRTAUrlParameters(packageJson) {
|
|
47
16
|
const getDependencyVersion = (packageJson, dependencyName) => {
|
|
48
17
|
return packageJson?.devDependencies?.[dependencyName] ?? packageJson?.dependencies?.[dependencyName];
|
|
49
18
|
};
|
|
@@ -67,8 +36,9 @@ function getRtaUrlParameters(packageJson) {
|
|
|
67
36
|
* @returns - RTA mount point or undefined
|
|
68
37
|
*/
|
|
69
38
|
function getRTAMountPoint(previewMiddlewareConfig) {
|
|
70
|
-
if (!isFioriToolsDeprecatedPreviewConfig(previewMiddlewareConfig) && previewMiddlewareConfig?.rta?.editors) {
|
|
71
|
-
|
|
39
|
+
if (!(0, utils_1.isFioriToolsDeprecatedPreviewConfig)(previewMiddlewareConfig) && previewMiddlewareConfig?.rta?.editors) {
|
|
40
|
+
// check if deprecated RTA config is used
|
|
41
|
+
const editors = previewMiddlewareConfig.rta.editors ?? previewMiddlewareConfig?.editors?.rta?.endpoints; //NOSONAR
|
|
72
42
|
for (const editor of editors) {
|
|
73
43
|
if (!('developerMode' in editor)) {
|
|
74
44
|
return editor.path;
|
|
@@ -77,33 +47,6 @@ function getRTAMountPoint(previewMiddlewareConfig) {
|
|
|
77
47
|
}
|
|
78
48
|
return undefined;
|
|
79
49
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Returns the intent of the preview middleware configuration from the ui5.yaml file, if given.
|
|
82
|
-
*
|
|
83
|
-
* @param previewMiddlewareConfig - configuration of the preview middleware
|
|
84
|
-
* @returns - preview intent or undefined
|
|
85
|
-
*/
|
|
86
|
-
function getRTAIntent(previewMiddlewareConfig) {
|
|
87
|
-
if (isFioriToolsDeprecatedPreviewConfig(previewMiddlewareConfig)) {
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
const intent = previewMiddlewareConfig?.flp?.intent;
|
|
91
|
-
return intent ? `#${intent.object}-${intent.action}` : undefined;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Returns the serve command for the preview middleware configuration of the ui5.yaml file, if given.
|
|
95
|
-
* If the fiori-tools-preview middleware is used, then the serve command will be 'fiori run'.
|
|
96
|
-
* If the preview middleware is used, the serve command will be 'ui5 serve'.
|
|
97
|
-
*
|
|
98
|
-
* @param basePath - path to project root, where ui5.yaml is located
|
|
99
|
-
* @param yamlFileName - name of the ui5 yaml file to read from basePath; default is 'ui5.yaml'
|
|
100
|
-
* @param fs - the memfs editor instance
|
|
101
|
-
* @returns - preview serve or undefined
|
|
102
|
-
*/
|
|
103
|
-
async function getRTAServe(basePath, yamlFileName, fs) {
|
|
104
|
-
const previewMiddleware = await getPreviewMiddleware(undefined, basePath, yamlFileName, fs);
|
|
105
|
-
return previewMiddleware?.name === types_1.MiddlewareConfigs.PreviewMiddleware ? 'ui5 serve' : 'fiori run';
|
|
106
|
-
}
|
|
107
50
|
/**
|
|
108
51
|
* Returns the url for variants management in RTA mode.
|
|
109
52
|
* The url consist of a specified mount point and intent given from the ui5.yaml file as well as parameters for the RTA mode.
|
|
@@ -117,7 +60,7 @@ async function getRTAServe(basePath, yamlFileName, fs) {
|
|
|
117
60
|
async function getRTAUrl(basePath, query, yamlFileName, fs) {
|
|
118
61
|
let previewMiddleware;
|
|
119
62
|
try {
|
|
120
|
-
previewMiddleware = await getPreviewMiddleware(undefined, basePath, yamlFileName, fs);
|
|
63
|
+
previewMiddleware = await (0, utils_1.getPreviewMiddleware)(undefined, basePath, yamlFileName, fs);
|
|
121
64
|
}
|
|
122
65
|
catch (error) {
|
|
123
66
|
throw new Error(`No ${yamlFileName} file found. ${error}`);
|
|
@@ -127,9 +70,9 @@ async function getRTAUrl(basePath, query, yamlFileName, fs) {
|
|
|
127
70
|
return undefined;
|
|
128
71
|
}
|
|
129
72
|
const mountPoint = getRTAMountPoint(previewMiddleware?.configuration) ?? '/preview.html';
|
|
130
|
-
const intent =
|
|
73
|
+
const intent = (0, utils_1.getIntentFromPreviewConfig)(previewMiddleware?.configuration) ?? '#app-preview';
|
|
131
74
|
const queryString = query ? '?' + query : '';
|
|
132
|
-
return isFioriToolsDeprecatedPreviewConfig(previewMiddleware?.configuration)
|
|
75
|
+
return (0, utils_1.isFioriToolsDeprecatedPreviewConfig)(previewMiddleware?.configuration)
|
|
133
76
|
? `${mountPoint}${queryString}#preview-app`
|
|
134
77
|
: `${mountPoint}${queryString}${intent}`;
|
|
135
78
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/app-config-writer",
|
|
3
3
|
"description": "Add or update configuration for SAP Fiori tools application",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.52",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"prompts": "2.4.2",
|
|
29
29
|
"semver": "7.6.3",
|
|
30
|
-
"@sap-ux/axios-extension": "1.20.
|
|
30
|
+
"@sap-ux/axios-extension": "1.20.2",
|
|
31
31
|
"@sap-ux/btp-utils": "1.0.3",
|
|
32
32
|
"@sap-ux/logger": "0.6.0",
|
|
33
33
|
"@sap-ux/project-access": "1.29.21",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@types/semver": "7.5.8",
|
|
43
43
|
"axios": "1.8.2",
|
|
44
44
|
"nock": "13.4.0",
|
|
45
|
-
"@sap-ux/preview-middleware": "0.19.
|
|
45
|
+
"@sap-ux/preview-middleware": "0.19.37"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=18.x"
|