@sap-ux/fiori-elements-writer 0.8.16 → 0.8.18
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/defaults.d.ts +1 -1
- package/dist/data/defaults.js +2 -2
- package/dist/data/manifestSettings.js +7 -7
- package/dist/data/templateAttributes.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -19
- package/dist/packageConfig.js +2 -2
- package/dist/validate.js +6 -6
- package/package.json +6 -6
package/dist/data/defaults.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { FioriElementsApp, Template } from '../types';
|
|
|
7
7
|
* @param odataVersion - may be used to determine the default properties set
|
|
8
8
|
* @returns Updated template settings
|
|
9
9
|
*/
|
|
10
|
-
export declare function setDefaultTemplateSettings<T>(template: Template<T>, odataVersion?: OdataVersion): T;
|
|
10
|
+
export declare function setDefaultTemplateSettings<T extends {}>(template: Template<T>, odataVersion?: OdataVersion): T;
|
|
11
11
|
/**
|
|
12
12
|
* Sets defaults for the specified Fiori elements application.
|
|
13
13
|
*
|
package/dist/data/defaults.js
CHANGED
|
@@ -62,10 +62,10 @@ function setAppDefaults(feApp) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
// Generate base UI5 project
|
|
65
|
-
feApp.app.baseComponent = feApp.app.baseComponent || templateAttributes_1.getBaseComponent(feApp.template.type, feApp.service.version);
|
|
65
|
+
feApp.app.baseComponent = feApp.app.baseComponent || (0, templateAttributes_1.getBaseComponent)(feApp.template.type, feApp.service.version);
|
|
66
66
|
// Add ui5 libs for specified template and odata version
|
|
67
67
|
// Dups will be removed by call to `generateUI5Project`
|
|
68
|
-
feApp.ui5 = Object.assign(Object.assign({}, feApp.ui5), { ui5Libs: (_d = templateAttributes_1.getUi5Libs(feApp.template.type, feApp.service.version)) === null || _d === void 0 ? void 0 : _d.concat((_f = (_e = feApp.ui5) === null || _e === void 0 ? void 0 : _e.ui5Libs) !== null && _f !== void 0 ? _f : []) });
|
|
68
|
+
feApp.ui5 = Object.assign(Object.assign({}, feApp.ui5), { ui5Libs: (_d = (0, templateAttributes_1.getUi5Libs)(feApp.template.type, feApp.service.version)) === null || _d === void 0 ? void 0 : _d.concat((_f = (_e = feApp.ui5) === null || _e === void 0 ? void 0 : _e.ui5Libs) !== null && _f !== void 0 ? _f : []) });
|
|
69
69
|
if (!feApp.service.localAnnotationsName) {
|
|
70
70
|
feApp.service.localAnnotationsName = 'annotation';
|
|
71
71
|
}
|
|
@@ -31,16 +31,16 @@ function extendManifestJson(fs, targetPath, rootTemplatesPath, feApp) {
|
|
|
31
31
|
const templateSettings = Object.assign(Object.assign({}, feApp.template.settings), { defaultModel: feApp.service.model, type: feApp.template.type });
|
|
32
32
|
// Manifest paths to be extended
|
|
33
33
|
const extendTemplatePaths = [
|
|
34
|
-
path_1.join(rootTemplatesPath, 'common', 'extend', 'webapp'),
|
|
35
|
-
path_1.join(rootTemplatesPath, templatePath, 'extend', 'webapp'),
|
|
36
|
-
path_1.join(rootTemplatesPath, `v${feApp.service.version}`, templatePath, 'extend', 'webapp'),
|
|
37
|
-
path_1.join(rootTemplatesPath, `v${feApp.service.version}`, 'common', 'extend', 'webapp')
|
|
34
|
+
(0, path_1.join)(rootTemplatesPath, 'common', 'extend', 'webapp'),
|
|
35
|
+
(0, path_1.join)(rootTemplatesPath, templatePath, 'extend', 'webapp'),
|
|
36
|
+
(0, path_1.join)(rootTemplatesPath, `v${feApp.service.version}`, templatePath, 'extend', 'webapp'),
|
|
37
|
+
(0, path_1.join)(rootTemplatesPath, `v${feApp.service.version}`, 'common', 'extend', 'webapp')
|
|
38
38
|
];
|
|
39
|
-
const manifestPath = path_1.join(targetPath, 'webapp', 'manifest.json');
|
|
39
|
+
const manifestPath = (0, path_1.join)(targetPath, 'webapp', 'manifest.json');
|
|
40
40
|
extendTemplatePaths.forEach((extendTemplatePath) => {
|
|
41
|
-
const manifestTemplatePath = path_1.join(extendTemplatePath, 'manifest.json');
|
|
41
|
+
const manifestTemplatePath = (0, path_1.join)(extendTemplatePath, 'manifest.json');
|
|
42
42
|
if (fs.exists(manifestTemplatePath)) {
|
|
43
|
-
fs.extendJSON(manifestPath, JSON.parse(ejs_1.render(fs.read(manifestTemplatePath), templateSettings, {})));
|
|
43
|
+
fs.extendJSON(manifestPath, JSON.parse((0, ejs_1.render)(fs.read(manifestTemplatePath), templateSettings, {})));
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OdataVersion, TemplateType } from '../types';
|
|
2
2
|
export declare const oldestSupportedUI5Version = "1.65.0";
|
|
3
3
|
export declare const changesPreviewToVersion = "1.78.0";
|
|
4
|
-
export
|
|
4
|
+
export type TemplateOptions = {
|
|
5
5
|
changesPreview?: boolean;
|
|
6
6
|
changesLoader?: boolean;
|
|
7
7
|
};
|
|
@@ -22,7 +22,7 @@ export declare function getBaseComponent(type: TemplateType, version: OdataVersi
|
|
|
22
22
|
* @returns The Ui5 libs required by the specified template type and OData version
|
|
23
23
|
*/
|
|
24
24
|
export declare function getUi5Libs(type: TemplateType, version: OdataVersion): string[] | undefined;
|
|
25
|
-
|
|
25
|
+
type TemplateAttributes = {
|
|
26
26
|
[K in TemplateType]: {
|
|
27
27
|
supportedODataVersions: OdataVersion[];
|
|
28
28
|
minimumUi5Version: {
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { FioriElementsApp } from './types';
|
|
|
9
9
|
* @param fs - an optional reference to a mem-fs editor
|
|
10
10
|
* @returns Reference to a mem-fs-editor
|
|
11
11
|
*/
|
|
12
|
-
declare function generate<T>(basePath: string, data: FioriElementsApp<T>, fs?: Editor): Promise<Editor>;
|
|
12
|
+
declare function generate<T extends {}>(basePath: string, data: FioriElementsApp<T>, fs?: Editor): Promise<Editor>;
|
|
13
13
|
export { generate, FioriElementsApp, App };
|
|
14
14
|
export * from './types';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -49,15 +53,15 @@ function generate(basePath, data, fs) {
|
|
|
49
53
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
50
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
55
|
// Clone rather than modifying callers refs
|
|
52
|
-
const feApp = cloneDeep_1.default(data);
|
|
56
|
+
const feApp = (0, cloneDeep_1.default)(data);
|
|
53
57
|
// Ensure input data contains at least the manadatory properties required for app genertation
|
|
54
|
-
validate_1.validateRequiredProperties(feApp);
|
|
55
|
-
defaults_1.setAppDefaults(feApp);
|
|
56
|
-
fs = yield ui5_application_writer_1.generate(basePath, feApp, fs);
|
|
57
|
-
feApp.template.settings = defaults_1.setDefaultTemplateSettings(feApp.template, feApp.service.version);
|
|
58
|
+
(0, validate_1.validateRequiredProperties)(feApp);
|
|
59
|
+
(0, defaults_1.setAppDefaults)(feApp);
|
|
60
|
+
fs = yield (0, ui5_application_writer_1.generate)(basePath, feApp, fs);
|
|
61
|
+
feApp.template.settings = (0, defaults_1.setDefaultTemplateSettings)(feApp.template, feApp.service.version);
|
|
58
62
|
// This is done after `generateUi5Project` since defaults are set if values are not provided
|
|
59
|
-
validate_1.validateApp(feApp);
|
|
60
|
-
yield odata_service_writer_1.generate(basePath, feApp.service, fs);
|
|
63
|
+
(0, validate_1.validateApp)(feApp);
|
|
64
|
+
yield (0, odata_service_writer_1.generate)(basePath, feApp.service, fs);
|
|
61
65
|
const templateOptions = {
|
|
62
66
|
changesPreview: ((_a = feApp.ui5) === null || _a === void 0 ? void 0 : _a.version)
|
|
63
67
|
? semver_1.default.lt(semver_1.default.coerce((_b = feApp.ui5) === null || _b === void 0 ? void 0 : _b.version), templateAttributes_1.changesPreviewToVersion)
|
|
@@ -65,22 +69,22 @@ function generate(basePath, data, fs) {
|
|
|
65
69
|
changesLoader: feApp.service.version === odata_service_writer_1.OdataVersion.v2
|
|
66
70
|
};
|
|
67
71
|
// Add new files from templates e.g.
|
|
68
|
-
const rootTemplatesPath = path_1.join(__dirname, '..', 'templates');
|
|
72
|
+
const rootTemplatesPath = (0, path_1.join)(__dirname, '..', 'templates');
|
|
69
73
|
// Add templates common to all template types
|
|
70
74
|
// Common files
|
|
71
75
|
const ignore = [((_c = feApp.appOptions) === null || _c === void 0 ? void 0 : _c.typescript) ? '**/*.js' : '**/*.ts'];
|
|
72
|
-
fs.copyTpl(path_1.join(rootTemplatesPath, 'common', 'add', '**/*.*'), basePath, Object.assign(Object.assign({}, feApp), { templateOptions,
|
|
76
|
+
fs.copyTpl((0, path_1.join)(rootTemplatesPath, 'common', 'add', '**/*.*'), basePath, Object.assign(Object.assign({}, feApp), { templateOptions,
|
|
73
77
|
escapeFLPText: templateAttributes_1.escapeFLPText }), undefined, {
|
|
74
78
|
globOptions: { ignore, dot: true }
|
|
75
79
|
});
|
|
76
80
|
// Extend common files
|
|
77
|
-
const packagePath = path_1.join(basePath, 'package.json');
|
|
81
|
+
const packagePath = (0, path_1.join)(basePath, 'package.json');
|
|
78
82
|
// Extend package.json
|
|
79
|
-
fs.extendJSON(packagePath, JSON.parse(ejs_1.render(fs.read(path_1.join(rootTemplatesPath, 'common', 'extend', 'package.json')), feApp, {})));
|
|
83
|
+
fs.extendJSON(packagePath, JSON.parse((0, ejs_1.render)(fs.read((0, path_1.join)(rootTemplatesPath, 'common', 'extend', 'package.json')), feApp, {})));
|
|
80
84
|
// Special handling for FPM because it is not based on template files but used the fpm writer
|
|
81
85
|
if (feApp.template.type === types_1.TemplateType.FlexibleProgrammingModel) {
|
|
82
86
|
const config = feApp.template.settings;
|
|
83
|
-
fe_fpm_writer_1.generateCustomPage(basePath, {
|
|
87
|
+
(0, fe_fpm_writer_1.generateCustomPage)(basePath, {
|
|
84
88
|
entity: config.entityConfig.mainEntityName,
|
|
85
89
|
name: config.pageName,
|
|
86
90
|
minUI5Version: (_d = feApp.ui5) === null || _d === void 0 ? void 0 : _d.minUI5Version,
|
|
@@ -89,17 +93,17 @@ function generate(basePath, data, fs) {
|
|
|
89
93
|
}
|
|
90
94
|
else {
|
|
91
95
|
// Copy version specific common templates and version specific, floorplan specific templates
|
|
92
|
-
const templateVersionPath = path_1.join(rootTemplatesPath, `v${(_f = feApp.service) === null || _f === void 0 ? void 0 : _f.version}`);
|
|
93
|
-
[path_1.join(templateVersionPath, 'common', 'add'), path_1.join(templateVersionPath, feApp.template.type, 'add')].forEach((templatePath) => {
|
|
94
|
-
fs.copyTpl(path_1.join(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true, globOptions: { ignore, dot: true } });
|
|
96
|
+
const templateVersionPath = (0, path_1.join)(rootTemplatesPath, `v${(_f = feApp.service) === null || _f === void 0 ? void 0 : _f.version}`);
|
|
97
|
+
[(0, path_1.join)(templateVersionPath, 'common', 'add'), (0, path_1.join)(templateVersionPath, feApp.template.type, 'add')].forEach((templatePath) => {
|
|
98
|
+
fs.copyTpl((0, path_1.join)(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true, globOptions: { ignore, dot: true } });
|
|
95
99
|
});
|
|
96
100
|
}
|
|
97
101
|
// Update manifest.json with template specific settings
|
|
98
|
-
manifestSettings_1.extendManifestJson(fs, basePath, rootTemplatesPath, feApp);
|
|
102
|
+
(0, manifestSettings_1.extendManifestJson)(fs, basePath, rootTemplatesPath, feApp);
|
|
99
103
|
const packageJson = JSON.parse(fs.read(packagePath));
|
|
100
104
|
// Add tests only if v4, for now, and we have metadata (and therefore a mock server config)
|
|
101
105
|
const addTest = !!feApp.appOptions.addTests && ((_g = feApp.service) === null || _g === void 0 ? void 0 : _g.version) === odata_service_writer_1.OdataVersion.v4 && !!((_h = feApp.service) === null || _h === void 0 ? void 0 : _h.metadata);
|
|
102
|
-
packageJson.scripts = Object.assign(packageJson.scripts, Object.assign({}, packageConfig_1.getPackageJsonTasks({
|
|
106
|
+
packageJson.scripts = Object.assign(packageJson.scripts || {}, Object.assign({}, (0, packageConfig_1.getPackageJsonTasks)({
|
|
103
107
|
localOnly: !((_j = feApp.service) === null || _j === void 0 ? void 0 : _j.url),
|
|
104
108
|
addMock: !!((_k = feApp.service) === null || _k === void 0 ? void 0 : _k.metadata),
|
|
105
109
|
addTest,
|
|
@@ -110,7 +114,7 @@ function generate(basePath, data, fs) {
|
|
|
110
114
|
})));
|
|
111
115
|
fs.writeJSON(packagePath, packageJson);
|
|
112
116
|
if (addTest) {
|
|
113
|
-
ui5_test_writer_1.generateOPAFiles(basePath, {}, fs);
|
|
117
|
+
(0, ui5_test_writer_1.generateOPAFiles)(basePath, {}, fs);
|
|
114
118
|
}
|
|
115
119
|
return fs;
|
|
116
120
|
});
|
package/dist/packageConfig.js
CHANGED
|
@@ -30,11 +30,11 @@ function getPackageJsonTasks({ localOnly, addMock = true, addTest = false, sapCl
|
|
|
30
30
|
// Full parameter section composed by search param and fragment identifier
|
|
31
31
|
const params = `${searchParam}${hashFragment}`;
|
|
32
32
|
const startCommand = localOnly
|
|
33
|
-
? `echo \\"${i18n_1.t('info.mockOnlyWarning')}\\"`
|
|
33
|
+
? `echo \\"${(0, i18n_1.t)('info.mockOnlyWarning')}\\"`
|
|
34
34
|
: `fiori run --open "${startFile || 'test/flpSandbox.html'}${params}"`;
|
|
35
35
|
const startLocalCommand = `fiori run --config ./ui5-local.yaml --open "${localStartFile || 'test/flpSandbox.html'}${params}"`;
|
|
36
36
|
const startNoFlpCommand = localOnly
|
|
37
|
-
? `echo \\"${i18n_1.t('info.mockOnlyWarning')}\\"`
|
|
37
|
+
? `echo \\"${(0, i18n_1.t)('info.mockOnlyWarning')}\\"`
|
|
38
38
|
: `fiori run --open "${'index.html'}${searchParam}"`;
|
|
39
39
|
const mockTask = `fiori run --config ./ui5-mock.yaml --open "test/flpSandbox.html${params}"`;
|
|
40
40
|
const testTask = 'fiori run --config ./ui5-mock.yaml --open "test/integration/opaTests.qunit.html"';
|
package/dist/validate.js
CHANGED
|
@@ -18,7 +18,7 @@ function validateApp(feApp) {
|
|
|
18
18
|
// Validate odata version
|
|
19
19
|
if (feApp.service.version &&
|
|
20
20
|
!templateAttributes_1.TemplateTypeAttributes[feApp.template.type].supportedODataVersions.includes(feApp.service.version)) {
|
|
21
|
-
throw new types_1.ValidationError(i18n_1.t('error.unsupportedOdataVersion', {
|
|
21
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.unsupportedOdataVersion', {
|
|
22
22
|
serviceVersion: feApp.service.version,
|
|
23
23
|
templateType: feApp.template.type
|
|
24
24
|
}));
|
|
@@ -28,7 +28,7 @@ function validateApp(feApp) {
|
|
|
28
28
|
if ((_a = feApp.ui5) === null || _a === void 0 ? void 0 : _a.version) {
|
|
29
29
|
ui5Version = semver_1.default.coerce((_b = feApp.ui5) === null || _b === void 0 ? void 0 : _b.version);
|
|
30
30
|
if (!ui5Version) {
|
|
31
|
-
throw new types_1.ValidationError(i18n_1.t('error.invalidUI5Version', { versionProperty: 'version', ui5Version: (_c = feApp.ui5) === null || _c === void 0 ? void 0 : _c.version }));
|
|
31
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.invalidUI5Version', { versionProperty: 'version', ui5Version: (_c = feApp.ui5) === null || _c === void 0 ? void 0 : _c.version }));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
let minUI5Version;
|
|
@@ -36,14 +36,14 @@ function validateApp(feApp) {
|
|
|
36
36
|
if ((_d = feApp.ui5) === null || _d === void 0 ? void 0 : _d.minUI5Version) {
|
|
37
37
|
minUI5Version = semver_1.default.coerce((_e = feApp.ui5) === null || _e === void 0 ? void 0 : _e.minUI5Version);
|
|
38
38
|
if (!minUI5Version) {
|
|
39
|
-
throw new types_1.ValidationError(i18n_1.t('error.invalidUI5Version', { versionProperty: 'minUI5Version', ui5Version: (_f = feApp.ui5) === null || _f === void 0 ? void 0 : _f.minUI5Version }));
|
|
39
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.invalidUI5Version', { versionProperty: 'minUI5Version', ui5Version: (_f = feApp.ui5) === null || _f === void 0 ? void 0 : _f.minUI5Version }));
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
minUI5Version = semver_1.default.coerce(minRequiredUI5Version);
|
|
44
44
|
}
|
|
45
45
|
if (ui5Version && semver_1.default.lt(ui5Version, minRequiredUI5Version)) {
|
|
46
|
-
throw new types_1.ValidationError(i18n_1.t('error.unsupportedUI5Version', {
|
|
46
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.unsupportedUI5Version', {
|
|
47
47
|
versionProperty: 'version',
|
|
48
48
|
ui5Version: (_g = feApp.ui5) === null || _g === void 0 ? void 0 : _g.version,
|
|
49
49
|
templateType: feApp.template.type,
|
|
@@ -51,7 +51,7 @@ function validateApp(feApp) {
|
|
|
51
51
|
}));
|
|
52
52
|
}
|
|
53
53
|
if (semver_1.default.lt(minUI5Version, minRequiredUI5Version)) {
|
|
54
|
-
throw new types_1.ValidationError(i18n_1.t('error.unsupportedUI5Version', {
|
|
54
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.unsupportedUI5Version', {
|
|
55
55
|
versionProperty: 'minUI5Version',
|
|
56
56
|
ui5Version: (_h = feApp.ui5) === null || _h === void 0 ? void 0 : _h.minUI5Version,
|
|
57
57
|
templateType: feApp.template.type,
|
|
@@ -68,7 +68,7 @@ exports.validateApp = validateApp;
|
|
|
68
68
|
function validateRequiredProperties(feApp) {
|
|
69
69
|
// Service is mandatory for generation of Fiori Elements apps
|
|
70
70
|
if (!feApp.service) {
|
|
71
|
-
throw new types_1.ValidationError(i18n_1.t('error.missingRequiredProperty', {
|
|
71
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.missingRequiredProperty', {
|
|
72
72
|
propertyName: 'FioriElementsApp.service'
|
|
73
73
|
}));
|
|
74
74
|
}
|
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.8.
|
|
4
|
+
"version": "0.8.18",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"!dist/**/*.map"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sap-ux/odata-service-writer": "0.14.
|
|
24
|
-
"@sap-ux/ui5-application-writer": "0.18.
|
|
25
|
-
"@sap-ux/fe-fpm-writer": "0.18.
|
|
26
|
-
"@sap-ux/ui5-config": "0.16.
|
|
27
|
-
"@sap-ux/ui5-test-writer": "0.1.
|
|
23
|
+
"@sap-ux/odata-service-writer": "0.14.17",
|
|
24
|
+
"@sap-ux/ui5-application-writer": "0.18.8",
|
|
25
|
+
"@sap-ux/fe-fpm-writer": "0.18.7",
|
|
26
|
+
"@sap-ux/ui5-config": "0.16.4",
|
|
27
|
+
"@sap-ux/ui5-test-writer": "0.1.7",
|
|
28
28
|
"ejs": "3.1.7",
|
|
29
29
|
"i18next": "20.3.2",
|
|
30
30
|
"lodash": "4.17.21",
|