@sap-ux/fiori-elements-writer 0.20.1 → 0.21.0
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/data/templateAttributes.js +7 -7
- package/dist/index.js +35 -15
- package/package.json +5 -5
|
@@ -23,7 +23,7 @@ const commonUi5Libs = {
|
|
|
23
23
|
'sap.ui.generic.app',
|
|
24
24
|
'sap.suite.ui.generic.template'
|
|
25
25
|
],
|
|
26
|
-
[types_1.OdataVersion.v4]: ['sap.m'
|
|
26
|
+
[types_1.OdataVersion.v4]: ['sap.m']
|
|
27
27
|
};
|
|
28
28
|
const templateLibs = {
|
|
29
29
|
[types_1.OdataVersion.v2]: {
|
|
@@ -47,27 +47,27 @@ const templateLibs = {
|
|
|
47
47
|
[types_1.OdataVersion.v4]: {
|
|
48
48
|
[types_1.TemplateType.ListReportObjectPage]: {
|
|
49
49
|
baseComponent: appComponentLibFioriElements,
|
|
50
|
-
ui5Libs: commonUi5Libs[types_1.OdataVersion.v4]
|
|
50
|
+
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.fe.templates']
|
|
51
51
|
},
|
|
52
52
|
[types_1.TemplateType.FormEntryObjectPage]: {
|
|
53
53
|
baseComponent: appComponentLibFioriElements,
|
|
54
|
-
ui5Libs: commonUi5Libs[types_1.OdataVersion.v4]
|
|
54
|
+
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.fe.templates']
|
|
55
55
|
},
|
|
56
56
|
[types_1.TemplateType.AnalyticalListPage]: {
|
|
57
57
|
baseComponent: appComponentLibFioriElements,
|
|
58
|
-
ui5Libs: commonUi5Libs[types_1.OdataVersion.v4]
|
|
58
|
+
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.fe.templates']
|
|
59
59
|
},
|
|
60
60
|
[types_1.TemplateType.Worklist]: {
|
|
61
61
|
baseComponent: appComponentLibFioriElements,
|
|
62
|
-
ui5Libs: commonUi5Libs[types_1.OdataVersion.v4]
|
|
62
|
+
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.fe.templates']
|
|
63
63
|
},
|
|
64
64
|
[types_1.TemplateType.OverviewPage]: {
|
|
65
65
|
baseComponent: appComponentLibOVP,
|
|
66
|
-
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.ovp', 'sap.ui.rta', 'sap.ui.layout']
|
|
66
|
+
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.fe.templates', 'sap.ovp', 'sap.ui.rta', 'sap.ui.layout']
|
|
67
67
|
},
|
|
68
68
|
[types_1.TemplateType.FlexibleProgrammingModel]: {
|
|
69
69
|
baseComponent: appComponentLibFioriElements,
|
|
70
|
-
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.fe.
|
|
70
|
+
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.fe.core']
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
};
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,7 @@ Object.defineProperty(exports, "minSupportedUI5VersionV4", { enumerable: true, g
|
|
|
45
45
|
const templateAttributes_2 = require("./data/templateAttributes");
|
|
46
46
|
const manifestSettings_1 = require("./data/manifestSettings");
|
|
47
47
|
const semver_1 = __importDefault(require("semver"));
|
|
48
|
+
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
48
49
|
exports.V2_FE_TYPES_AVAILABLE = '1.108.0';
|
|
49
50
|
/**
|
|
50
51
|
* Get TypeScript Ignore Glob Pattern.
|
|
@@ -84,7 +85,7 @@ function getTypeScriptIgnoreGlob(feApp, coercedUI5Version) {
|
|
|
84
85
|
* @returns Reference to a mem-fs-editor
|
|
85
86
|
*/
|
|
86
87
|
function generate(basePath, data, fs) {
|
|
87
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
88
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
90
|
// Clone rather than modifying callers refs
|
|
90
91
|
const feApp = (0, cloneDeep_1.default)(data);
|
|
@@ -109,10 +110,21 @@ function generate(basePath, data, fs) {
|
|
|
109
110
|
if (((_c = feApp.appOptions) === null || _c === void 0 ? void 0 : _c.typescript) === true) {
|
|
110
111
|
ignore = getTypeScriptIgnoreGlob(feApp, coercedUI5Version);
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
+
// Check if sap.ushell is already in the ui5Libs array
|
|
114
|
+
const ushellLib = 'sap.ushell';
|
|
115
|
+
const ui5Libs = Array.isArray((_d = feApp.ui5) === null || _d === void 0 ? void 0 : _d.ui5Libs) ? feApp.ui5.ui5Libs : [(_e = feApp.ui5) === null || _e === void 0 ? void 0 : _e.ui5Libs];
|
|
116
|
+
if (!ui5Libs.includes(ushellLib)) {
|
|
117
|
+
ui5Libs.push(ushellLib);
|
|
118
|
+
}
|
|
119
|
+
fs.copyTpl((0, path_1.join)(rootTemplatesPath, 'common', 'add', '**/*.*'), basePath, Object.assign(Object.assign({}, feApp), { ui5: Object.assign(Object.assign({}, feApp.ui5), { ui5Libs }), templateOptions,
|
|
113
120
|
escapeFLPText: templateAttributes_2.escapeFLPText }), undefined, {
|
|
114
121
|
globOptions: { ignore, dot: true }
|
|
115
122
|
});
|
|
123
|
+
// Extend ui5-local.yaml
|
|
124
|
+
const ui5LocalConfigPath = (0, path_1.join)(basePath, 'ui5-local.yaml');
|
|
125
|
+
const ui5LocalConfig = yield ui5_config_1.UI5Config.newInstance(fs.read(ui5LocalConfigPath));
|
|
126
|
+
ui5LocalConfig.addUI5Libs([ushellLib]);
|
|
127
|
+
fs.write(ui5LocalConfigPath, ui5LocalConfig.toString());
|
|
116
128
|
// Extend common files
|
|
117
129
|
const packagePath = (0, path_1.join)(basePath, 'package.json');
|
|
118
130
|
// Extend package.json
|
|
@@ -123,13 +135,21 @@ function generate(basePath, data, fs) {
|
|
|
123
135
|
(0, fe_fpm_writer_1.generateCustomPage)(basePath, {
|
|
124
136
|
entity: config.entityConfig.mainEntityName,
|
|
125
137
|
name: config.pageName,
|
|
126
|
-
minUI5Version: (
|
|
127
|
-
typescript: (
|
|
138
|
+
minUI5Version: (_f = feApp.ui5) === null || _f === void 0 ? void 0 : _f.minUI5Version,
|
|
139
|
+
typescript: (_g = feApp.appOptions) === null || _g === void 0 ? void 0 : _g.typescript
|
|
128
140
|
}, fs);
|
|
141
|
+
// Updating ui5-local for V4 FPM specific libs
|
|
142
|
+
if (feApp.service.version === odata_service_writer_1.OdataVersion.v4) {
|
|
143
|
+
const ui5LocalConfigPath = (0, path_1.join)(basePath, 'ui5-local.yaml');
|
|
144
|
+
const ui5LocalConfig = yield ui5_config_1.UI5Config.newInstance(fs.read(ui5LocalConfigPath));
|
|
145
|
+
const ui5Libs = ['sap.fe.templates'];
|
|
146
|
+
ui5LocalConfig.addUI5Libs(ui5Libs);
|
|
147
|
+
fs.write(ui5LocalConfigPath, ui5LocalConfig.toString());
|
|
148
|
+
}
|
|
129
149
|
}
|
|
130
150
|
else {
|
|
131
151
|
// Copy odata version specific common templates and version specific, floorplan specific templates
|
|
132
|
-
const templateVersionPath = (0, path_1.join)(rootTemplatesPath, `v${(
|
|
152
|
+
const templateVersionPath = (0, path_1.join)(rootTemplatesPath, `v${(_h = feApp.service) === null || _h === void 0 ? void 0 : _h.version}`);
|
|
133
153
|
[(0, path_1.join)(templateVersionPath, 'common', 'add'), (0, path_1.join)(templateVersionPath, feApp.template.type, 'add')].forEach((templatePath) => {
|
|
134
154
|
fs.copyTpl((0, path_1.join)(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true, globOptions: { ignore, dot: true } });
|
|
135
155
|
});
|
|
@@ -139,22 +159,22 @@ function generate(basePath, data, fs) {
|
|
|
139
159
|
const packageJson = JSON.parse(fs.read(packagePath));
|
|
140
160
|
// Add tests only if v4, for now, and we have metadata (and therefore a mock server config) or has a cds service
|
|
141
161
|
const addTest = !!feApp.appOptions.addTests &&
|
|
142
|
-
((
|
|
143
|
-
(!!((
|
|
144
|
-
packageJson.scripts = Object.assign((
|
|
145
|
-
localOnly: !((
|
|
146
|
-
addMock: !!((
|
|
162
|
+
((_j = feApp.service) === null || _j === void 0 ? void 0 : _j.version) === odata_service_writer_1.OdataVersion.v4 &&
|
|
163
|
+
(!!((_k = feApp.service) === null || _k === void 0 ? void 0 : _k.metadata) || feApp.service.type === odata_service_writer_1.ServiceType.CDS);
|
|
164
|
+
packageJson.scripts = Object.assign((_l = packageJson.scripts) !== null && _l !== void 0 ? _l : {}, Object.assign({}, (0, packageConfig_1.getPackageJsonTasks)({
|
|
165
|
+
localOnly: !((_m = feApp.service) === null || _m === void 0 ? void 0 : _m.url),
|
|
166
|
+
addMock: !!((_o = feApp.service) === null || _o === void 0 ? void 0 : _o.metadata),
|
|
147
167
|
addTest,
|
|
148
|
-
sapClient: (
|
|
168
|
+
sapClient: (_p = feApp.service) === null || _p === void 0 ? void 0 : _p.client,
|
|
149
169
|
flpAppId: feApp.app.flpAppId,
|
|
150
|
-
startFile: (
|
|
151
|
-
localStartFile: (
|
|
152
|
-
generateIndex: (
|
|
170
|
+
startFile: (_q = data === null || data === void 0 ? void 0 : data.app) === null || _q === void 0 ? void 0 : _q.startFile,
|
|
171
|
+
localStartFile: (_r = data === null || data === void 0 ? void 0 : data.app) === null || _r === void 0 ? void 0 : _r.localStartFile,
|
|
172
|
+
generateIndex: (_s = feApp.appOptions) === null || _s === void 0 ? void 0 : _s.generateIndex
|
|
153
173
|
})));
|
|
154
174
|
fs.writeJSON(packagePath, packageJson);
|
|
155
175
|
if (addTest) {
|
|
156
176
|
(0, ui5_test_writer_1.generateOPAFiles)(basePath, {
|
|
157
|
-
htmlTarget: ((
|
|
177
|
+
htmlTarget: ((_t = feApp.appOptions) === null || _t === void 0 ? void 0 : _t.generateIndex)
|
|
158
178
|
? 'index.html'
|
|
159
179
|
: `test/flpSandbox.html?sap-ui-xx-viewCache=false#${feApp.app.flpAppId}`
|
|
160
180
|
}, fs);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fiori-elements-writer",
|
|
3
3
|
"description": "SAP Fiori elements application writer",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.21.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"read-pkg-up": "7.0.1",
|
|
29
29
|
"semver": "7.5.4",
|
|
30
|
-
"@sap-ux/odata-service-writer": "0.20.
|
|
31
|
-
"@sap-ux/ui5-application-writer": "0.26.
|
|
32
|
-
"@sap-ux/fe-fpm-writer": "0.24.
|
|
33
|
-
"@sap-ux/ui5-config": "0.22.
|
|
30
|
+
"@sap-ux/odata-service-writer": "0.20.2",
|
|
31
|
+
"@sap-ux/ui5-application-writer": "0.26.15",
|
|
32
|
+
"@sap-ux/fe-fpm-writer": "0.24.15",
|
|
33
|
+
"@sap-ux/ui5-config": "0.22.7",
|
|
34
34
|
"@sap-ux/ui5-test-writer": "0.3.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|