@sap-ux/fe-fpm-writer 0.40.6 → 0.40.8
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/app/index.js +2 -1
- package/dist/building-block/index.js +2 -2
- package/dist/column/index.js +1 -1
- package/dist/common/event-handler.js +2 -1
- package/dist/common/file.d.ts +15 -1
- package/dist/common/file.js +20 -0
- package/dist/common/utils.js +2 -1
- package/dist/controller-extension/index.js +1 -1
- package/dist/field/index.js +1 -1
- package/dist/filter/index.js +1 -1
- package/dist/page/custom.js +3 -3
- package/dist/section/index.js +2 -2
- package/dist/view/index.js +2 -2
- package/package.json +3 -3
package/dist/app/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const project_access_1 = require("@sap-ux/project-access");
|
|
|
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.MIN_VERSION = '1.94.0';
|
|
14
15
|
/**
|
|
15
16
|
* If a minUI5Version is set and it is smaller than the minimum required, increase it.
|
|
@@ -104,7 +105,7 @@ async function enableFPM(basePath, config = {}, fs) {
|
|
|
104
105
|
if (config.replaceAppComponent) {
|
|
105
106
|
const ext = config.typescript ? 'ts' : 'js';
|
|
106
107
|
const componentTemplate = (0, templates_1.getTemplatePath)(`/app/Component.${ext}`);
|
|
107
|
-
|
|
108
|
+
(0, file_1.copyTpl)(fs, componentTemplate, (0, node_path_1.join)(basePath, `webapp/Component.${ext}`), manifest['sap.app']);
|
|
108
109
|
}
|
|
109
110
|
return fs;
|
|
110
111
|
}
|
|
@@ -247,7 +247,7 @@ function processCustomColumn(buildingBlockData, fs, viewPath, config) {
|
|
|
247
247
|
}
|
|
248
248
|
columnConfig.content = (0, defaults_1.getDefaultFragmentContent)('Sample Text', processedEventHandler);
|
|
249
249
|
if (!fs.exists(viewPath)) {
|
|
250
|
-
|
|
250
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)(config.templateFile), viewPath, columnConfig);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
@@ -285,7 +285,7 @@ function processCustomFilterField(buildingBlockData, fs, viewPath, config, embed
|
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
if (!fs.exists(viewPath)) {
|
|
288
|
-
|
|
288
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)(config.templateFile), viewPath, filterConfig);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
/**
|
package/dist/column/index.js
CHANGED
|
@@ -78,7 +78,7 @@ async function generateCustomColumn(basePath, customColumn, fs) {
|
|
|
78
78
|
// add fragment
|
|
79
79
|
const viewPath = (0, node_path_1.join)(completeColumn.path, `${completeColumn.fragmentFile ?? completeColumn.name}.fragment.xml`);
|
|
80
80
|
if (completeColumn.control || !fs.exists(viewPath)) {
|
|
81
|
-
|
|
81
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)('common/Fragment.xml'), viewPath, completeColumn);
|
|
82
82
|
}
|
|
83
83
|
// enhance manifest with column definition
|
|
84
84
|
const manifestRoot = getManifestRoot(customColumn.minUI5Version);
|
|
@@ -5,6 +5,7 @@ exports.applyEventHandlerConfiguration = applyEventHandlerConfiguration;
|
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const templates_1 = require("../templates");
|
|
7
7
|
const utils_1 = require("../common/utils");
|
|
8
|
+
const file_1 = require("./file");
|
|
8
9
|
/**
|
|
9
10
|
* Default values for the input parameters of newly created event handlers.
|
|
10
11
|
*/
|
|
@@ -91,7 +92,7 @@ function applyEventHandlerConfiguration(fs, config, eventHandler, eventHandlerOp
|
|
|
91
92
|
const ext = typescript ? 'ts' : 'js';
|
|
92
93
|
const controllerPath = (0, node_path_1.join)(config.path || '', `${fileName}${controllerSuffix ? '.controller' : ''}.${ext}`);
|
|
93
94
|
if (!fs.exists(controllerPath)) {
|
|
94
|
-
|
|
95
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)(`${templatePath}.${ext}`), controllerPath, {
|
|
95
96
|
eventHandlerFnName,
|
|
96
97
|
parameters,
|
|
97
98
|
...config
|
package/dist/common/file.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { Editor } from 'mem-fs-editor';
|
|
1
|
+
import type { CopyOptions, Editor } from 'mem-fs-editor';
|
|
2
2
|
import type { TabInfo } from '../common/types';
|
|
3
|
+
export declare const COPY_TEMPLATE_OPTIONS: CopyOptions & {
|
|
4
|
+
noGlob: boolean;
|
|
5
|
+
};
|
|
3
6
|
type WriteJsonReplacer = ((key: string, value: any) => any) | Array<string | number>;
|
|
4
7
|
type WriteJsonSpace = number | string;
|
|
5
8
|
interface ExtendJsonParams {
|
|
@@ -32,5 +35,16 @@ export declare function getJsonSpace(fs: Editor, filePath: string, tabInfo?: Tab
|
|
|
32
35
|
* @param params - options for JSON extend.
|
|
33
36
|
*/
|
|
34
37
|
export declare function extendJSON(fs: Editor, params: ExtendJsonParams): void;
|
|
38
|
+
/**
|
|
39
|
+
* Copies a template file or directory to a target location and applies template interpolation.
|
|
40
|
+
* This method wraps `mem-fs-editor`'s `copyTpl` and passes predefined copy options
|
|
41
|
+
* (e.g. `noGlob: true`) to prevent glob pattern expansion in source paths.
|
|
42
|
+
*
|
|
43
|
+
* @param fs - The mem-fs editor instance used to perform the file operations.
|
|
44
|
+
* @param from - Source path of the template file or directory.
|
|
45
|
+
* @param to - Destination path where the rendered files will be written.
|
|
46
|
+
* @param context - Optional template context used for interpolation.
|
|
47
|
+
*/
|
|
48
|
+
export declare function copyTpl(fs: Editor, from: string, to: string, context?: object): void;
|
|
35
49
|
export {};
|
|
36
50
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/common/file.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COPY_TEMPLATE_OPTIONS = void 0;
|
|
3
4
|
exports.detectTabSpacing = detectTabSpacing;
|
|
4
5
|
exports.getJsonSpace = getJsonSpace;
|
|
5
6
|
exports.extendJSON = extendJSON;
|
|
7
|
+
exports.copyTpl = copyTpl;
|
|
6
8
|
const CHAR_SPACE = ' ';
|
|
7
9
|
const CHAR_TAB = '\t';
|
|
10
|
+
// `noGlob` is supported in `mem-fs-editor` v9,
|
|
11
|
+
// but is missing from `@types/mem-fs-editor` (no v9 typings), so we extend the type here.
|
|
12
|
+
exports.COPY_TEMPLATE_OPTIONS = {
|
|
13
|
+
noGlob: true
|
|
14
|
+
};
|
|
8
15
|
/**
|
|
9
16
|
* Method returns tab info for passed line.
|
|
10
17
|
*
|
|
@@ -86,4 +93,17 @@ function extendJSON(fs, params) {
|
|
|
86
93
|
// Write json
|
|
87
94
|
fs.extendJSON(filepath, JSON.parse(content), replacer, space);
|
|
88
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Copies a template file or directory to a target location and applies template interpolation.
|
|
98
|
+
* This method wraps `mem-fs-editor`'s `copyTpl` and passes predefined copy options
|
|
99
|
+
* (e.g. `noGlob: true`) to prevent glob pattern expansion in source paths.
|
|
100
|
+
*
|
|
101
|
+
* @param fs - The mem-fs editor instance used to perform the file operations.
|
|
102
|
+
* @param from - Source path of the template file or directory.
|
|
103
|
+
* @param to - Destination path where the rendered files will be written.
|
|
104
|
+
* @param context - Optional template context used for interpolation.
|
|
105
|
+
*/
|
|
106
|
+
function copyTpl(fs, from, to, context) {
|
|
107
|
+
fs.copyTpl(from, to, context, undefined, exports.COPY_TEMPLATE_OPTIONS);
|
|
108
|
+
}
|
|
89
109
|
//# sourceMappingURL=file.js.map
|
package/dist/common/utils.js
CHANGED
|
@@ -13,6 +13,7 @@ const node_path_1 = require("node:path");
|
|
|
13
13
|
const semver_1 = require("semver");
|
|
14
14
|
const project_access_1 = require("@sap-ux/project-access");
|
|
15
15
|
const templates_1 = require("../templates");
|
|
16
|
+
const file_1 = require("./file");
|
|
16
17
|
/**
|
|
17
18
|
* Method inserts passed text into content by char index position.
|
|
18
19
|
* In case if position is out of range, then whitespaces would be created.
|
|
@@ -71,7 +72,7 @@ function addExtensionTypes(basePath, minUI5Version, fs) {
|
|
|
71
72
|
const version = (0, semver_1.minor)((0, semver_1.coerce)(minUI5Version) ?? '1.108.0');
|
|
72
73
|
const path = (0, node_path_1.join)(basePath, '/webapp/ext/sap.fe.d.ts');
|
|
73
74
|
if (version < 108 && version !== 102 && !fs.exists(path)) {
|
|
74
|
-
|
|
75
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)('common/sap.fe.d.ts'), path, { version });
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
@@ -195,7 +195,7 @@ async function generateControllerExtension(basePath, controllerConfig, fs) {
|
|
|
195
195
|
const ext = controllerConfig.typescript ? 'ts' : 'js';
|
|
196
196
|
const viewPath = (0, node_path_1.join)(internalConfig.path, `${internalConfig.name}.controller.${ext}`);
|
|
197
197
|
if (!fs.exists(viewPath)) {
|
|
198
|
-
|
|
198
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)(`controller-extension/Controller.${ext}`), viewPath, internalConfig);
|
|
199
199
|
}
|
|
200
200
|
if (controllerConfig.typescript) {
|
|
201
201
|
(0, utils_1.addExtensionTypes)(basePath, controllerConfig.minUI5Version, fs);
|
package/dist/field/index.js
CHANGED
|
@@ -60,7 +60,7 @@ async function generateCustomField(basePath, customField, fs) {
|
|
|
60
60
|
// add fragment
|
|
61
61
|
const viewPath = (0, node_path_1.join)(completeField.path, `${completeField.fragmentFile ?? completeField.name}.fragment.xml`);
|
|
62
62
|
if (!fs.exists(viewPath)) {
|
|
63
|
-
|
|
63
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)('common/Fragment.xml'), viewPath, completeField);
|
|
64
64
|
}
|
|
65
65
|
// enhance manifest with field definition
|
|
66
66
|
const templatePath = (0, templates_1.getTemplatePath)('/field/manifest.json');
|
package/dist/filter/index.js
CHANGED
|
@@ -65,7 +65,7 @@ async function generateCustomFilter(basePath, filterConfig, fs) {
|
|
|
65
65
|
// create a fragment file
|
|
66
66
|
const fragmentPath = (0, node_path_1.join)(config.path, `${config.fragmentFile}.fragment.xml`);
|
|
67
67
|
if (!fs.exists(fragmentPath)) {
|
|
68
|
-
|
|
68
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)(`filter/fragment.xml`), fragmentPath, config);
|
|
69
69
|
}
|
|
70
70
|
return fs;
|
|
71
71
|
}
|
package/dist/page/custom.js
CHANGED
|
@@ -121,7 +121,7 @@ async function generate(basePath, data, fs, log) {
|
|
|
121
121
|
// add extension content
|
|
122
122
|
const viewPath = (0, node_path_1.join)(config.path, `${config.name}.view.xml`);
|
|
123
123
|
if (!fs.exists(viewPath)) {
|
|
124
|
-
|
|
124
|
+
(0, file_1.copyTpl)(fs, (0, node_path_1.join)(root, 'ext/View.xml'), viewPath, config);
|
|
125
125
|
// i18n.properties
|
|
126
126
|
const manifest = fs.readJSON(manifestPath);
|
|
127
127
|
const defaultI18nPath = 'i18n/i18n.properties';
|
|
@@ -132,7 +132,7 @@ async function generate(basePath, data, fs, log) {
|
|
|
132
132
|
fs.append(i18nPath, (0, ejs_1.render)(fs.read(i18TemplatePath), config, {}));
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
135
|
-
|
|
135
|
+
(0, file_1.copyTpl)(fs, i18TemplatePath, i18nPath, config);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
if (data.pageBuildingBlockTitle) {
|
|
@@ -141,7 +141,7 @@ async function generate(basePath, data, fs, log) {
|
|
|
141
141
|
const ext = data.typescript ? 'ts' : 'js';
|
|
142
142
|
const controllerPath = (0, node_path_1.join)(config.path, `${config.name}.controller.${ext}`);
|
|
143
143
|
if (!fs.exists(controllerPath)) {
|
|
144
|
-
|
|
144
|
+
(0, file_1.copyTpl)(fs, (0, node_path_1.join)(root, `ext/Controller.${ext}`), controllerPath, config);
|
|
145
145
|
}
|
|
146
146
|
if (data.typescript) {
|
|
147
147
|
(0, utils_1.addExtensionTypes)(basePath, data.minUI5Version, fs);
|
package/dist/section/index.js
CHANGED
|
@@ -99,7 +99,7 @@ async function generate(basePath, customSection, manifestTemplateRoot, fs) {
|
|
|
99
99
|
// add fragment
|
|
100
100
|
const viewPath = (0, node_path_1.join)(completeSection.path, `${completeSection.fragmentFile ?? completeSection.name}.fragment.xml`);
|
|
101
101
|
if (!fs.exists(viewPath)) {
|
|
102
|
-
|
|
102
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)('common/FragmentWithVBox.xml'), viewPath, completeSection);
|
|
103
103
|
}
|
|
104
104
|
return { editor: fs, section: completeSection };
|
|
105
105
|
}
|
|
@@ -147,7 +147,7 @@ async function generateCustomHeaderSection(basePath, customHeaderSection, fs) {
|
|
|
147
147
|
if (editSection.path) {
|
|
148
148
|
const viewPath = (0, node_path_1.join)(editSection.path, `${editSection.name}.fragment.xml`);
|
|
149
149
|
if (!editor.exists(viewPath)) {
|
|
150
|
-
|
|
150
|
+
(0, file_1.copyTpl)(editor, (0, templates_1.getTemplatePath)('common/FragmentWithForm.xml'), viewPath, editSection);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
package/dist/view/index.js
CHANGED
|
@@ -100,10 +100,10 @@ async function generateCustomView(basePath, customView, fs) {
|
|
|
100
100
|
if (customView.viewUpdate !== false) {
|
|
101
101
|
const viewPath = (0, node_path_1.join)(completeView.path, `${completeView.name}.fragment.xml`);
|
|
102
102
|
if (completeView.control === true) {
|
|
103
|
-
|
|
103
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)('view/ext/CustomViewWithTable.xml'), viewPath, completeView);
|
|
104
104
|
}
|
|
105
105
|
else if (!fs.exists(viewPath)) {
|
|
106
|
-
|
|
106
|
+
(0, file_1.copyTpl)(fs, (0, templates_1.getTemplatePath)('common/Fragment.xml'), viewPath, completeView);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
return fs;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fe-fpm-writer",
|
|
3
3
|
"description": "SAP Fiori elements flexible programming model writer",
|
|
4
|
-
"version": "0.40.
|
|
4
|
+
"version": "0.40.8",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"semver": "7.5.4",
|
|
31
31
|
"xml-formatter": "2.6.1",
|
|
32
32
|
"xpath": "0.0.33",
|
|
33
|
-
"@sap-ux/fiori-annotation-api": "0.
|
|
34
|
-
"@sap-ux/project-access": "1.
|
|
33
|
+
"@sap-ux/fiori-annotation-api": "0.9.0",
|
|
34
|
+
"@sap-ux/project-access": "1.34.0",
|
|
35
35
|
"@sap-ux/logger": "0.8.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|