@sap-ux/fe-fpm-writer 0.18.3 → 0.18.4
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/action/index.js +2 -1
- package/dist/column/index.js +6 -1
- package/dist/common/file.d.ts +36 -0
- package/dist/common/file.js +90 -0
- package/dist/common/types.d.ts +12 -1
- package/dist/controller-extension/index.js +7 -1
- package/dist/page/common.d.ts +15 -1
- package/dist/page/common.js +35 -1
- package/dist/page/custom.js +7 -1
- package/dist/page/list.js +1 -15
- package/dist/page/object.js +1 -15
- package/dist/page/types.d.ts +3 -3
- package/dist/section/index.js +6 -1
- package/dist/view/index.js +6 -1
- package/package.json +1 -1
package/dist/action/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const validate_1 = require("../common/validate");
|
|
|
10
10
|
const defaults_1 = require("../common/defaults");
|
|
11
11
|
const event_handler_1 = require("../common/event-handler");
|
|
12
12
|
const templates_1 = require("../templates");
|
|
13
|
+
const file_1 = require("../common/file");
|
|
13
14
|
/**
|
|
14
15
|
* Enhances the provided custom action configuration with default data.
|
|
15
16
|
*
|
|
@@ -82,7 +83,7 @@ function generateCustomAction(basePath, actionConfig, fs) {
|
|
|
82
83
|
// enhance manifest with action definition and controller reference
|
|
83
84
|
const actions = enhanceManifestAndGetActionsElementReference(manifest, config.target);
|
|
84
85
|
Object.assign(actions, JSON.parse(ejs_1.render(fs.read(templates_1.getTemplatePath(`action/manifest.action.json`)), config, {})));
|
|
85
|
-
fs.writeJSON(manifestPath, manifest);
|
|
86
|
+
fs.writeJSON(manifestPath, manifest, undefined, file_1.getJsonSpace(fs, manifestPath, actionConfig.tabInfo));
|
|
86
87
|
return fs;
|
|
87
88
|
}
|
|
88
89
|
exports.generateCustomAction = generateCustomAction;
|
package/dist/column/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const path_1 = require("path");
|
|
|
8
8
|
const defaults_1 = require("../common/defaults");
|
|
9
9
|
const validate_1 = require("../common/validate");
|
|
10
10
|
const event_handler_1 = require("../common/event-handler");
|
|
11
|
+
const file_1 = require("../common/file");
|
|
11
12
|
const templates_1 = require("../templates");
|
|
12
13
|
const semver_1 = require("semver");
|
|
13
14
|
/**
|
|
@@ -74,7 +75,11 @@ function generateCustomColumn(basePath, customColumn, fs) {
|
|
|
74
75
|
// enhance manifest with column definition
|
|
75
76
|
const manifestRoot = getManifestRoot(customColumn.minUI5Version);
|
|
76
77
|
const filledTemplate = ejs_1.render(fs.read(path_1.join(manifestRoot, `manifest.json`)), completeColumn, {});
|
|
77
|
-
|
|
78
|
+
file_1.extendJSON(fs, {
|
|
79
|
+
filepath: manifestPath,
|
|
80
|
+
content: filledTemplate,
|
|
81
|
+
tabInfo: customColumn.tabInfo
|
|
82
|
+
});
|
|
78
83
|
// add fragment
|
|
79
84
|
const viewPath = path_1.join(completeColumn.path, `${completeColumn.name}.fragment.xml`);
|
|
80
85
|
if (completeColumn.control || !fs.exists(viewPath)) {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Editor } from 'mem-fs-editor';
|
|
2
|
+
import type { TabInfo } from '../common/types';
|
|
3
|
+
declare type WriteJsonReplacer = ((key: string, value: any) => any) | Array<string | number>;
|
|
4
|
+
declare type WriteJsonSpace = number | string;
|
|
5
|
+
interface ExtendJsonParams {
|
|
6
|
+
filepath: string;
|
|
7
|
+
content: string;
|
|
8
|
+
replacer?: WriteJsonReplacer;
|
|
9
|
+
tabInfo?: TabInfo;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Method calculates tab space info for passed file content.
|
|
13
|
+
*
|
|
14
|
+
* @param content - file content.
|
|
15
|
+
* @returns tab size information.
|
|
16
|
+
*/
|
|
17
|
+
export declare function detectTabSpacing(content: string): TabInfo | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Method calculates tab spacing parameter for 'JSON.stringify' method.
|
|
20
|
+
*
|
|
21
|
+
* @param fs - the mem-fs editor instance.
|
|
22
|
+
* @param filePath - path to file to read.
|
|
23
|
+
* @param tabInfo - External tab configuration.
|
|
24
|
+
* @returns tab size information.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getJsonSpace(fs: Editor, filePath: string, tabInfo?: TabInfo | undefined): WriteJsonSpace | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Method extends target JSON file with passed JSOn content.
|
|
29
|
+
* Method uses 'fs.extendJSON', but applies additional calculation to reuse existing content tab sizing information.
|
|
30
|
+
*
|
|
31
|
+
* @param fs - the mem-fs editor instance.
|
|
32
|
+
* @param params - options for JSON extend.
|
|
33
|
+
*/
|
|
34
|
+
export declare function extendJSON(fs: Editor, params: ExtendJsonParams): void;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=file.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extendJSON = exports.getJsonSpace = exports.detectTabSpacing = void 0;
|
|
4
|
+
const CHAR_SPACE = ' ';
|
|
5
|
+
const CHAR_TAB = '\t';
|
|
6
|
+
/**
|
|
7
|
+
* Method returns tab info for passed line.
|
|
8
|
+
*
|
|
9
|
+
* @param line - line with tab spacing
|
|
10
|
+
* @returns tab size information
|
|
11
|
+
*/
|
|
12
|
+
function getLineTabInfo(line) {
|
|
13
|
+
let tabSize;
|
|
14
|
+
const symbol = line[0] === CHAR_TAB ? CHAR_TAB : CHAR_SPACE;
|
|
15
|
+
// get count of tabs
|
|
16
|
+
for (let i = 0; i < line.length; i++) {
|
|
17
|
+
const char = line[i];
|
|
18
|
+
if (char !== symbol) {
|
|
19
|
+
tabSize = {
|
|
20
|
+
size: i,
|
|
21
|
+
useTabSymbol: symbol === CHAR_TAB
|
|
22
|
+
};
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return tabSize;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Method calculates tab space info for passed file content.
|
|
30
|
+
*
|
|
31
|
+
* @param content - file content.
|
|
32
|
+
* @returns tab size information.
|
|
33
|
+
*/
|
|
34
|
+
function detectTabSpacing(content) {
|
|
35
|
+
let tabSize;
|
|
36
|
+
const tabSymbols = [CHAR_SPACE, CHAR_TAB];
|
|
37
|
+
const lines = content.split(/\r\n|\n/);
|
|
38
|
+
const lineWithSpacing = lines.find((line) => {
|
|
39
|
+
return tabSymbols.includes(line[0]);
|
|
40
|
+
});
|
|
41
|
+
if (lineWithSpacing) {
|
|
42
|
+
tabSize = getLineTabInfo(lineWithSpacing);
|
|
43
|
+
}
|
|
44
|
+
return tabSize;
|
|
45
|
+
}
|
|
46
|
+
exports.detectTabSpacing = detectTabSpacing;
|
|
47
|
+
/**
|
|
48
|
+
* Method calculates tab spacing parameter for 'JSON.stringify' method.
|
|
49
|
+
*
|
|
50
|
+
* @param fs - the mem-fs editor instance.
|
|
51
|
+
* @param filePath - path to file to read.
|
|
52
|
+
* @param tabInfo - External tab configuration.
|
|
53
|
+
* @returns tab size information.
|
|
54
|
+
*/
|
|
55
|
+
function getJsonSpace(fs, filePath, tabInfo) {
|
|
56
|
+
if (!tabInfo) {
|
|
57
|
+
// 'tabInfo' was not passed - calculate 'tabInfo' by checking existing content of target file
|
|
58
|
+
const content = fs.read(filePath);
|
|
59
|
+
tabInfo = detectTabSpacing(content);
|
|
60
|
+
}
|
|
61
|
+
let space;
|
|
62
|
+
if (tabInfo) {
|
|
63
|
+
// 'tabInfo' exists - it was passed as custom configuration or calculated from target file
|
|
64
|
+
if (tabInfo.useTabSymbol) {
|
|
65
|
+
// Tab symbol should be used as tab
|
|
66
|
+
space = CHAR_TAB.repeat(tabInfo.size || 1);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// Spaces should be used as tab
|
|
70
|
+
space = tabInfo.size;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return space;
|
|
74
|
+
}
|
|
75
|
+
exports.getJsonSpace = getJsonSpace;
|
|
76
|
+
/**
|
|
77
|
+
* Method extends target JSON file with passed JSOn content.
|
|
78
|
+
* Method uses 'fs.extendJSON', but applies additional calculation to reuse existing content tab sizing information.
|
|
79
|
+
*
|
|
80
|
+
* @param fs - the mem-fs editor instance.
|
|
81
|
+
* @param params - options for JSON extend.
|
|
82
|
+
*/
|
|
83
|
+
function extendJSON(fs, params) {
|
|
84
|
+
const { filepath, content, replacer } = params;
|
|
85
|
+
const space = getJsonSpace(fs, filepath, params.tabInfo);
|
|
86
|
+
// Write json
|
|
87
|
+
fs.extendJSON(filepath, JSON.parse(content), replacer, space);
|
|
88
|
+
}
|
|
89
|
+
exports.extendJSON = extendJSON;
|
|
90
|
+
//# sourceMappingURL=file.js.map
|
package/dist/common/types.d.ts
CHANGED
|
@@ -2,10 +2,14 @@ import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
|
2
2
|
export declare type Manifest = ManifestNamespace.SAPJSONSchemaForWebApplicationManifestFile & {
|
|
3
3
|
[key: string]: unknown;
|
|
4
4
|
};
|
|
5
|
+
export interface TabInfo {
|
|
6
|
+
size?: number;
|
|
7
|
+
useTabSymbol?: boolean;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Common properties for any custom element of the flexible programming model.
|
|
7
11
|
*/
|
|
8
|
-
export interface CustomElement {
|
|
12
|
+
export interface CustomElement extends WriterConfig {
|
|
9
13
|
/**
|
|
10
14
|
* Name of the custom element that is to be added to the application.
|
|
11
15
|
*/
|
|
@@ -149,4 +153,11 @@ export interface EventHandler {
|
|
|
149
153
|
*/
|
|
150
154
|
eventHandler?: true | string | EventHandlerConfiguration;
|
|
151
155
|
}
|
|
156
|
+
export interface WriterConfig {
|
|
157
|
+
/**
|
|
158
|
+
* Tab size info.
|
|
159
|
+
* Currently is used only for 'manifest.json' update.
|
|
160
|
+
*/
|
|
161
|
+
tabInfo?: TabInfo;
|
|
162
|
+
}
|
|
152
163
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -10,6 +10,7 @@ const validate_1 = require("../common/validate");
|
|
|
10
10
|
const defaults_1 = require("../common/defaults");
|
|
11
11
|
const templates_1 = require("../templates");
|
|
12
12
|
const utils_1 = require("../common/utils");
|
|
13
|
+
const file_1 = require("../common/file");
|
|
13
14
|
exports.UI5_CONTROLLER_EXTENSION_LIST_REPORT = 'sap.fe.templates.ListReport.ListReportController';
|
|
14
15
|
exports.UI5_CONTROLLER_EXTENSION_OBJECT_PAGE = 'sap.fe.templates.ObjectPage.ObjectPageController';
|
|
15
16
|
const UI5_CONTROLLER_EXTENSIONS = 'sap.ui.controllerExtensions';
|
|
@@ -183,7 +184,12 @@ function generateControllerExtension(basePath, controllerConfig, fs) {
|
|
|
183
184
|
const internalConfig = enhanceConfig(controllerConfig, manifestPath, manifest);
|
|
184
185
|
// enhance manifest with view definition
|
|
185
186
|
const filledTemplate = ejs_1.render(fs.read(templates_1.getTemplatePath('controller-extension/manifest.json')), internalConfig, {});
|
|
186
|
-
|
|
187
|
+
file_1.extendJSON(fs, {
|
|
188
|
+
filepath: manifestPath,
|
|
189
|
+
content: filledTemplate,
|
|
190
|
+
replacer: getManifestReplacer(internalConfig),
|
|
191
|
+
tabInfo: controllerConfig.tabInfo
|
|
192
|
+
});
|
|
187
193
|
// add controller js file
|
|
188
194
|
const ext = controllerConfig.typescript ? 'ts' : 'js';
|
|
189
195
|
const viewPath = path_1.join(internalConfig.path, `${internalConfig.name}.controller.${ext}`);
|
package/dist/page/common.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
2
|
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
3
|
-
import type { CustomPage, FCL, InternalCustomPage, InternalObjectPage, ObjectPage, Navigation, InternalListReport } from './types';
|
|
3
|
+
import type { CustomPage, FCL, InternalCustomPage, InternalObjectPage, ObjectPage, ListReport, Navigation, InternalListReport } from './types';
|
|
4
4
|
import type { Manifest } from '../common/types';
|
|
5
|
+
declare type EnhancePageConfigFunction = (data: ObjectPage | ListReport, manifest: Manifest) => InternalObjectPage | InternalListReport;
|
|
5
6
|
/**
|
|
6
7
|
* Suffix for patterns to support arbitrary paramters
|
|
7
8
|
*/
|
|
@@ -49,4 +50,17 @@ export declare function getFclConfig(manifest: Manifest, navigation?: Navigation
|
|
|
49
50
|
* @returns the updated memfs editor instance
|
|
50
51
|
*/
|
|
51
52
|
export declare function validatePageConfig(basePath: string, config: CustomPage | ObjectPage, fs: Editor): Editor;
|
|
53
|
+
/**
|
|
54
|
+
* Add an generic page to an existing UI5 application.
|
|
55
|
+
* Supported pages - ListReport or ObjectPage.
|
|
56
|
+
*
|
|
57
|
+
* @param basePath - the base path
|
|
58
|
+
* @param data - the page configuration
|
|
59
|
+
* @param enhanceDataFn - Callback function for data enhancement
|
|
60
|
+
* @param templatePath - path to 'manifest.json' template
|
|
61
|
+
* @param fs - the memfs editor instance
|
|
62
|
+
* @returns the updated memfs editor instance
|
|
63
|
+
*/
|
|
64
|
+
export declare function extendPageJSON(basePath: string, data: ObjectPage, enhanceDataFn: EnhancePageConfigFunction, templatePath: string, fs?: Editor): Editor;
|
|
65
|
+
export {};
|
|
52
66
|
//# sourceMappingURL=common.d.ts.map
|
package/dist/page/common.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePageConfig = exports.getFclConfig = exports.getManifestJsonExtensionHelper = exports.generateRouteTarget = exports.generateRoutePattern = exports.PATTERN_SUFFIX = void 0;
|
|
3
|
+
exports.extendPageJSON = exports.validatePageConfig = exports.getFclConfig = exports.getManifestJsonExtensionHelper = exports.generateRouteTarget = exports.generateRoutePattern = exports.PATTERN_SUFFIX = void 0;
|
|
4
|
+
const mem_fs_1 = require("mem-fs");
|
|
5
|
+
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
4
6
|
const path_1 = require("path");
|
|
7
|
+
const ejs_1 = require("ejs");
|
|
5
8
|
const validate_1 = require("../common/validate");
|
|
6
9
|
const defaults_1 = require("../common/defaults");
|
|
10
|
+
const file_1 = require("../common/file");
|
|
11
|
+
const templates_1 = require("../templates");
|
|
7
12
|
/**
|
|
8
13
|
* Suffix for patterns to support arbitrary paramters
|
|
9
14
|
*/
|
|
@@ -154,4 +159,33 @@ function validatePageConfig(basePath, config, fs) {
|
|
|
154
159
|
return fs;
|
|
155
160
|
}
|
|
156
161
|
exports.validatePageConfig = validatePageConfig;
|
|
162
|
+
/**
|
|
163
|
+
* Add an generic page to an existing UI5 application.
|
|
164
|
+
* Supported pages - ListReport or ObjectPage.
|
|
165
|
+
*
|
|
166
|
+
* @param basePath - the base path
|
|
167
|
+
* @param data - the page configuration
|
|
168
|
+
* @param enhanceDataFn - Callback function for data enhancement
|
|
169
|
+
* @param templatePath - path to 'manifest.json' template
|
|
170
|
+
* @param fs - the memfs editor instance
|
|
171
|
+
* @returns the updated memfs editor instance
|
|
172
|
+
*/
|
|
173
|
+
function extendPageJSON(basePath, data, enhanceDataFn, templatePath, fs) {
|
|
174
|
+
if (!fs) {
|
|
175
|
+
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
176
|
+
}
|
|
177
|
+
validatePageConfig(basePath, data, fs);
|
|
178
|
+
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
179
|
+
const manifest = fs.readJSON(manifestPath);
|
|
180
|
+
const config = enhanceDataFn(data, manifest);
|
|
181
|
+
// enhance manifest.json
|
|
182
|
+
file_1.extendJSON(fs, {
|
|
183
|
+
filepath: manifestPath,
|
|
184
|
+
content: ejs_1.render(fs.read(templates_1.getTemplatePath(templatePath)), config, {}),
|
|
185
|
+
replacer: getManifestJsonExtensionHelper(config),
|
|
186
|
+
tabInfo: data.tabInfo
|
|
187
|
+
});
|
|
188
|
+
return fs;
|
|
189
|
+
}
|
|
190
|
+
exports.extendPageJSON = extendPageJSON;
|
|
157
191
|
//# sourceMappingURL=common.js.map
|
package/dist/page/custom.js
CHANGED
|
@@ -11,6 +11,7 @@ const validate_1 = require("../common/validate");
|
|
|
11
11
|
const templates_1 = require("../templates");
|
|
12
12
|
const semver_1 = require("semver");
|
|
13
13
|
const utils_1 = require("../common/utils");
|
|
14
|
+
const file_1 = require("../common/file");
|
|
14
15
|
/**
|
|
15
16
|
* Enhances the provided custom page configuration with default data.
|
|
16
17
|
*
|
|
@@ -70,7 +71,12 @@ function generate(basePath, data, fs) {
|
|
|
70
71
|
// merge content into existing files
|
|
71
72
|
const root = getTemplateRoot(data.minUI5Version);
|
|
72
73
|
// enhance manifest.json
|
|
73
|
-
|
|
74
|
+
file_1.extendJSON(fs, {
|
|
75
|
+
filepath: manifestPath,
|
|
76
|
+
content: ejs_1.render(fs.read(path_1.join(root, `manifest.json`)), config, {}),
|
|
77
|
+
replacer: common_1.getManifestJsonExtensionHelper(config),
|
|
78
|
+
tabInfo: data.tabInfo
|
|
79
|
+
});
|
|
74
80
|
// add extension content
|
|
75
81
|
const viewPath = path_1.join(config.path, `${config.name}.view.xml`);
|
|
76
82
|
if (!fs.exists(viewPath)) {
|
package/dist/page/list.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generate = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const mem_fs_1 = require("mem-fs");
|
|
6
|
-
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
7
|
-
const ejs_1 = require("ejs");
|
|
8
4
|
const common_1 = require("./common");
|
|
9
|
-
const templates_1 = require("../templates");
|
|
10
5
|
/**
|
|
11
6
|
* Enhances the provided list report configuration with default data.
|
|
12
7
|
*
|
|
@@ -44,16 +39,7 @@ function enhanceData(data, manifest) {
|
|
|
44
39
|
* @returns the updated memfs editor instance
|
|
45
40
|
*/
|
|
46
41
|
function generate(basePath, data, fs) {
|
|
47
|
-
|
|
48
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
49
|
-
}
|
|
50
|
-
common_1.validatePageConfig(basePath, data, fs);
|
|
51
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
52
|
-
const manifest = fs.readJSON(manifestPath);
|
|
53
|
-
const config = enhanceData(data, manifest);
|
|
54
|
-
// enhance manifest.json
|
|
55
|
-
fs.extendJSON(manifestPath, JSON.parse(ejs_1.render(fs.read(templates_1.getTemplatePath('page/list/manifest.json')), config, {})), common_1.getManifestJsonExtensionHelper(config));
|
|
56
|
-
return fs;
|
|
42
|
+
return common_1.extendPageJSON(basePath, data, enhanceData, 'page/list/manifest.json', fs);
|
|
57
43
|
}
|
|
58
44
|
exports.generate = generate;
|
|
59
45
|
//# sourceMappingURL=list.js.map
|
package/dist/page/object.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generate = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const mem_fs_1 = require("mem-fs");
|
|
6
|
-
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
7
|
-
const ejs_1 = require("ejs");
|
|
8
4
|
const common_1 = require("./common");
|
|
9
|
-
const templates_1 = require("../templates");
|
|
10
5
|
/**
|
|
11
6
|
* Enhances the provided list report configuration with default data.
|
|
12
7
|
*
|
|
@@ -34,16 +29,7 @@ function enhanceData(data, manifest) {
|
|
|
34
29
|
* @returns the updated memfs editor instance
|
|
35
30
|
*/
|
|
36
31
|
function generate(basePath, data, fs) {
|
|
37
|
-
|
|
38
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
39
|
-
}
|
|
40
|
-
common_1.validatePageConfig(basePath, data, fs);
|
|
41
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
42
|
-
const manifest = fs.readJSON(manifestPath);
|
|
43
|
-
const config = enhanceData(data, manifest);
|
|
44
|
-
// enhance manifest.json
|
|
45
|
-
fs.extendJSON(manifestPath, JSON.parse(ejs_1.render(fs.read(templates_1.getTemplatePath('/page/object/manifest.json')), config, {})), common_1.getManifestJsonExtensionHelper(config));
|
|
46
|
-
return fs;
|
|
32
|
+
return common_1.extendPageJSON(basePath, data, enhanceData, '/page/object/manifest.json', fs);
|
|
47
33
|
}
|
|
48
34
|
exports.generate = generate;
|
|
49
35
|
//# sourceMappingURL=object.js.map
|
package/dist/page/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CustomElement, InternalCustomElement } from '../common/types';
|
|
1
|
+
import type { CustomElement, InternalCustomElement, WriterConfig } from '../common/types';
|
|
2
2
|
/**
|
|
3
3
|
* Incoming navigation configuration.
|
|
4
4
|
*/
|
|
@@ -33,7 +33,7 @@ export interface ListReportSettings extends StandardPageSettings {
|
|
|
33
33
|
/**
|
|
34
34
|
* Configuration options for adding a list report page.
|
|
35
35
|
*/
|
|
36
|
-
export interface ListReport {
|
|
36
|
+
export interface ListReport extends WriterConfig {
|
|
37
37
|
/**
|
|
38
38
|
* Name of the entity used for the custom page.
|
|
39
39
|
*/
|
|
@@ -46,7 +46,7 @@ export interface ListReport {
|
|
|
46
46
|
/**
|
|
47
47
|
* Configuration options for adding an object page.
|
|
48
48
|
*/
|
|
49
|
-
export interface ObjectPage {
|
|
49
|
+
export interface ObjectPage extends WriterConfig {
|
|
50
50
|
/**
|
|
51
51
|
* Name of the entity used for the custom page.
|
|
52
52
|
*/
|
package/dist/section/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const ejs_1 = require("ejs");
|
|
|
8
8
|
const validate_1 = require("../common/validate");
|
|
9
9
|
const defaults_1 = require("../common/defaults");
|
|
10
10
|
const event_handler_1 = require("../common/event-handler");
|
|
11
|
+
const file_1 = require("../common/file");
|
|
11
12
|
const templates_1 = require("../templates");
|
|
12
13
|
const semver_1 = require("semver");
|
|
13
14
|
/**
|
|
@@ -79,7 +80,11 @@ function generateCustomSection(basePath, customSection, fs) {
|
|
|
79
80
|
// enhance manifest with section definition
|
|
80
81
|
const manifestRoot = getManifestRoot(customSection.minUI5Version);
|
|
81
82
|
const filledTemplate = ejs_1.render(fs.read(path_1.join(manifestRoot, `manifest.json`)), completeSection, {});
|
|
82
|
-
|
|
83
|
+
file_1.extendJSON(fs, {
|
|
84
|
+
filepath: manifestPath,
|
|
85
|
+
content: filledTemplate,
|
|
86
|
+
tabInfo: customSection.tabInfo
|
|
87
|
+
});
|
|
83
88
|
// add fragment
|
|
84
89
|
const viewPath = path_1.join(completeSection.path, `${completeSection.name}.fragment.xml`);
|
|
85
90
|
if (!fs.exists(viewPath)) {
|
package/dist/view/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const ejs_1 = require("ejs");
|
|
|
8
8
|
const validate_1 = require("../common/validate");
|
|
9
9
|
const defaults_1 = require("../common/defaults");
|
|
10
10
|
const event_handler_1 = require("../common/event-handler");
|
|
11
|
+
const file_1 = require("../common/file");
|
|
11
12
|
const templates_1 = require("../templates");
|
|
12
13
|
/**
|
|
13
14
|
* Merge the new view into the list of existing views (if any).
|
|
@@ -88,7 +89,11 @@ function generateCustomView(basePath, customView, fs) {
|
|
|
88
89
|
const completeView = enhanceConfig(fs, customView, manifestPath, manifest);
|
|
89
90
|
// enhance manifest with view definition
|
|
90
91
|
const filledTemplate = ejs_1.render(fs.read(templates_1.getTemplatePath('view/manifest.json')), completeView, {});
|
|
91
|
-
|
|
92
|
+
file_1.extendJSON(fs, {
|
|
93
|
+
filepath: manifestPath,
|
|
94
|
+
content: filledTemplate,
|
|
95
|
+
tabInfo: customView.tabInfo
|
|
96
|
+
});
|
|
92
97
|
// add fragment
|
|
93
98
|
if (customView.viewUpdate !== false) {
|
|
94
99
|
const viewPath = path_1.join(completeView.path, `${completeView.name}.fragment.xml`);
|
package/package.json
CHANGED