@sap-ux/ui5-application-writer 1.5.8 → 1.5.10
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/index.js +14 -9
- package/dist/types.d.ts +10 -0
- package/dist/utils.d.ts +21 -1
- package/dist/utils.js +31 -0
- package/package.json +3 -3
- package/templates/core/1.120.0/webapp/index.html +35 -0
- package/templates/core/1.71.0/webapp/Component.js +25 -0
- package/templates/core/1.71.0/webapp/i18n/i18n.properties +9 -0
- package/templates/core/1.71.0/webapp/manifest.json +64 -0
- /package/templates/core/{webapp → 1.120.0/webapp}/Component.js +0 -0
- /package/templates/core/{webapp → 1.120.0/webapp}/i18n/i18n.properties +0 -0
- /package/templates/core/{webapp → 1.120.0/webapp}/manifest.json +0 -0
- /package/templates/core/{webapp → 1.71.0/webapp}/index.html +0 -0
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const project_access_1 = require("@sap-ux/project-access");
|
|
|
12
12
|
const data_1 = require("./data");
|
|
13
13
|
const ui5Libs_1 = require("./data/ui5Libs");
|
|
14
14
|
const options_1 = require("./options");
|
|
15
|
+
const utils_1 = require("./utils");
|
|
15
16
|
/**
|
|
16
17
|
* Writes the template to the memfs editor instance.
|
|
17
18
|
*
|
|
@@ -43,9 +44,13 @@ async function generate(basePath, ui5AppConfig, fs) {
|
|
|
43
44
|
...ui5App,
|
|
44
45
|
ui5ResourceUrl
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
(0, utils_1.copyTemplates)({
|
|
48
|
+
fs,
|
|
49
|
+
basePath,
|
|
50
|
+
tmplPath,
|
|
51
|
+
templateOptions,
|
|
52
|
+
ignore,
|
|
53
|
+
ui5Version: ui5App.ui5?.version
|
|
49
54
|
});
|
|
50
55
|
// ui5.yaml
|
|
51
56
|
const ui5ConfigPath = (0, path_1.join)(basePath, 'ui5.yaml');
|
|
@@ -162,12 +167,12 @@ async function enableTypescript(basePath, fs) {
|
|
|
162
167
|
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
163
168
|
return fs;
|
|
164
169
|
}
|
|
165
|
-
var
|
|
166
|
-
Object.defineProperty(exports, "compareUI5VersionGte", { enumerable: true, get: function () { return
|
|
167
|
-
Object.defineProperty(exports, "ui5LtsVersion_1_120", { enumerable: true, get: function () { return
|
|
168
|
-
Object.defineProperty(exports, "ui5LtsVersion_1_71", { enumerable: true, get: function () { return
|
|
169
|
-
Object.defineProperty(exports, "processDestinationPath", { enumerable: true, get: function () { return
|
|
170
|
-
Object.defineProperty(exports, "getTemplateVersionPath", { enumerable: true, get: function () { return
|
|
170
|
+
var utils_2 = require("./utils");
|
|
171
|
+
Object.defineProperty(exports, "compareUI5VersionGte", { enumerable: true, get: function () { return utils_2.compareUI5VersionGte; } });
|
|
172
|
+
Object.defineProperty(exports, "ui5LtsVersion_1_120", { enumerable: true, get: function () { return utils_2.ui5LtsVersion_1_120; } });
|
|
173
|
+
Object.defineProperty(exports, "ui5LtsVersion_1_71", { enumerable: true, get: function () { return utils_2.ui5LtsVersion_1_71; } });
|
|
174
|
+
Object.defineProperty(exports, "processDestinationPath", { enumerable: true, get: function () { return utils_2.processDestinationPath; } });
|
|
175
|
+
Object.defineProperty(exports, "getTemplateVersionPath", { enumerable: true, get: function () { return utils_2.getTemplateVersionPath; } });
|
|
171
176
|
var defaults_1 = require("./data/defaults");
|
|
172
177
|
Object.defineProperty(exports, "getManifestVersion", { enumerable: true, get: function () { return defaults_1.getManifestVersion; } });
|
|
173
178
|
//# sourceMappingURL=index.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -158,6 +158,16 @@ export interface AppOptions {
|
|
|
158
158
|
*/
|
|
159
159
|
useVirtualPreviewEndpoints?: boolean;
|
|
160
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Options for template generation.
|
|
163
|
+
*/
|
|
164
|
+
export type TemplateOptions = {
|
|
165
|
+
app: App;
|
|
166
|
+
appOptions: Partial<AppOptions>;
|
|
167
|
+
ui5: UI5;
|
|
168
|
+
package: Package;
|
|
169
|
+
ui5ResourceUrl: string;
|
|
170
|
+
};
|
|
161
171
|
export interface Ui5App {
|
|
162
172
|
app: App;
|
|
163
173
|
appOptions?: Partial<AppOptions>;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type UI5 } from './types';
|
|
1
|
+
import { type UI5, type TemplateOptions } from './types';
|
|
2
|
+
import type { Editor } from 'mem-fs-editor';
|
|
2
3
|
export declare const ui5LtsVersion_1_71 = "1.71.0";
|
|
3
4
|
export declare const ui5LtsVersion_1_120 = "1.120.0";
|
|
4
5
|
/**
|
|
@@ -23,4 +24,23 @@ export declare function getTemplateVersionPath(ui5: UI5): string;
|
|
|
23
24
|
* @returns {string} - The processed file path.
|
|
24
25
|
*/
|
|
25
26
|
export declare function processDestinationPath(filePath: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Copies UI5 project template files and common files to the target base path.
|
|
29
|
+
*
|
|
30
|
+
* @param options - Options for copying template files
|
|
31
|
+
* @param options.fs - The mem-fs editor instance
|
|
32
|
+
* @param options.basePath - The target base path
|
|
33
|
+
* @param options.tmplPath - The template root path
|
|
34
|
+
* @param options.templateOptions - Template variables for file rendering
|
|
35
|
+
* @param options.ignore - Glob patterns to ignore during copy
|
|
36
|
+
* @param options.ui5Version - Optional UI5 version to determine template version
|
|
37
|
+
*/
|
|
38
|
+
export declare function copyTemplates(options: {
|
|
39
|
+
fs: Editor;
|
|
40
|
+
basePath: string;
|
|
41
|
+
tmplPath: string;
|
|
42
|
+
templateOptions: TemplateOptions;
|
|
43
|
+
ignore: string[];
|
|
44
|
+
ui5Version?: string;
|
|
45
|
+
}): void;
|
|
26
46
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
CHANGED
|
@@ -4,7 +4,10 @@ exports.ui5LtsVersion_1_120 = exports.ui5LtsVersion_1_71 = void 0;
|
|
|
4
4
|
exports.compareUI5VersionGte = compareUI5VersionGte;
|
|
5
5
|
exports.getTemplateVersionPath = getTemplateVersionPath;
|
|
6
6
|
exports.processDestinationPath = processDestinationPath;
|
|
7
|
+
exports.copyTemplates = copyTemplates;
|
|
7
8
|
const semver_1 = require("semver");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const project_access_1 = require("@sap-ux/project-access");
|
|
8
11
|
exports.ui5LtsVersion_1_71 = '1.71.0';
|
|
9
12
|
exports.ui5LtsVersion_1_120 = '1.120.0';
|
|
10
13
|
/**
|
|
@@ -49,4 +52,32 @@ function getTemplateVersionPath(ui5) {
|
|
|
49
52
|
function processDestinationPath(filePath) {
|
|
50
53
|
return filePath.replace('/1.120.0', '').replace('/1.71.0', '');
|
|
51
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Copies UI5 project template files and common files to the target base path.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Options for copying template files
|
|
59
|
+
* @param options.fs - The mem-fs editor instance
|
|
60
|
+
* @param options.basePath - The target base path
|
|
61
|
+
* @param options.tmplPath - The template root path
|
|
62
|
+
* @param options.templateOptions - Template variables for file rendering
|
|
63
|
+
* @param options.ignore - Glob patterns to ignore during copy
|
|
64
|
+
* @param options.ui5Version - Optional UI5 version to determine template version
|
|
65
|
+
*/
|
|
66
|
+
function copyTemplates(options) {
|
|
67
|
+
const { fs, basePath, tmplPath, templateOptions, ignore, ui5Version } = options;
|
|
68
|
+
const remainingCoreFiles = ['gitignore.tmpl', project_access_1.FileName.Package, project_access_1.FileName.Ui5LocalYaml, project_access_1.FileName.Ui5Yaml];
|
|
69
|
+
const resolvedUi5Version = ui5Version ?? exports.ui5LtsVersion_1_120;
|
|
70
|
+
const templateUi5Version = compareUI5VersionGte(resolvedUi5Version, exports.ui5LtsVersion_1_120)
|
|
71
|
+
? exports.ui5LtsVersion_1_120
|
|
72
|
+
: exports.ui5LtsVersion_1_71;
|
|
73
|
+
// Copy version-specific template files
|
|
74
|
+
fs.copyTpl((0, path_1.join)(tmplPath, 'core', templateUi5Version, '**/*.*'), (0, path_1.join)(basePath), templateOptions, undefined, {
|
|
75
|
+
globOptions: { dot: true, ignore }
|
|
76
|
+
});
|
|
77
|
+
// Copy remaining common files
|
|
78
|
+
fs.copyTpl(remainingCoreFiles.map((fileName) => (0, path_1.join)(tmplPath, 'core', fileName)), (0, path_1.join)(basePath), templateOptions, undefined, {
|
|
79
|
+
globOptions: { dot: true, ignore },
|
|
80
|
+
processDestinationPath: (filePath) => filePath.replace(/gitignore.tmpl/g, '.gitignore')
|
|
81
|
+
});
|
|
82
|
+
}
|
|
52
83
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aui5-application-writer"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.5.
|
|
12
|
+
"version": "1.5.10",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"files": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"!dist/**/*.map"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@ui5/manifest": "1.
|
|
23
|
+
"@ui5/manifest": "1.76.0",
|
|
24
24
|
"ejs": "3.1.10",
|
|
25
25
|
"i18next": "25.3.0",
|
|
26
26
|
"lodash": "4.17.21",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/semver": "7.5.2",
|
|
39
39
|
"fs-extra": "10.0.0",
|
|
40
40
|
"@sap-ux/eslint-plugin-fiori-tools": "0.6.0",
|
|
41
|
-
"@sap-ux/project-access": "1.30.
|
|
41
|
+
"@sap-ux/project-access": "1.30.8"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=20.x"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
7
|
+
<title><%= app.title %></title>
|
|
8
|
+
<style>
|
|
9
|
+
html, body, body > div, #container, #container-uiarea {
|
|
10
|
+
height: 100%;
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
<script
|
|
14
|
+
id="sap-ui-bootstrap"
|
|
15
|
+
src="<%- locals.ui5ResourceUrl %>"
|
|
16
|
+
data-sap-ui-theme="<%- ui5.ui5Theme %>"
|
|
17
|
+
data-sap-ui-resource-roots='{
|
|
18
|
+
"<%- app.id %>": "./"
|
|
19
|
+
}'
|
|
20
|
+
data-sap-ui-on-init="module:sap/ui/core/ComponentSupport"
|
|
21
|
+
data-sap-ui-compat-version="edge"
|
|
22
|
+
data-sap-ui-async="true"
|
|
23
|
+
data-sap-ui-frame-options="trusted"
|
|
24
|
+
></script>
|
|
25
|
+
</head>
|
|
26
|
+
<body class="sapUiBody sapUiSizeCompact" id="content">
|
|
27
|
+
<div
|
|
28
|
+
data-sap-ui-component
|
|
29
|
+
data-name="<%- app.id %>"
|
|
30
|
+
data-id="container"
|
|
31
|
+
data-settings='{"id" : "<%- app.id %>"}'
|
|
32
|
+
data-handle-validation="true"
|
|
33
|
+
></div>
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
sap.ui.define(
|
|
2
|
+
["<%- app.baseComponent %>"],
|
|
3
|
+
function (UIComponent) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
return UIComponent.extend("<%- app.id %>.Component", {
|
|
7
|
+
metadata: {
|
|
8
|
+
manifest: "json"
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
|
|
13
|
+
* @public
|
|
14
|
+
* @override
|
|
15
|
+
*/
|
|
16
|
+
init: function () {
|
|
17
|
+
// call the base component's init function
|
|
18
|
+
UIComponent.prototype.init.apply(this, arguments);
|
|
19
|
+
|
|
20
|
+
// enable routing
|
|
21
|
+
this.getRouter().initialize();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_version": "<%- ui5.descriptorVersion %>",
|
|
3
|
+
"sap.app": {
|
|
4
|
+
"id": "<%- app.id %>",
|
|
5
|
+
"type": "application",
|
|
6
|
+
"i18n": "i18n/i18n.properties",
|
|
7
|
+
"applicationVersion": {
|
|
8
|
+
"version": "<%- app.version %>"
|
|
9
|
+
},
|
|
10
|
+
"title": "{{appTitle}}",
|
|
11
|
+
"description": "{{appDescription}}",
|
|
12
|
+
"resources": "resources.json",
|
|
13
|
+
"sourceTemplate": {
|
|
14
|
+
"id": "<%= app.sourceTemplate.id %>",
|
|
15
|
+
"version": "<%= app.sourceTemplate.version %>"<% if (app.sourceTemplate.toolsId) { %>,
|
|
16
|
+
"toolsId": "<%= app.sourceTemplate.toolsId %>"<% } %>
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"sap.ui": {
|
|
20
|
+
"technology": "UI5",
|
|
21
|
+
"icons": {
|
|
22
|
+
"icon": "",
|
|
23
|
+
"favIcon": "",
|
|
24
|
+
"phone": "",
|
|
25
|
+
"phone@2": "",
|
|
26
|
+
"tablet": "",
|
|
27
|
+
"tablet@2": ""
|
|
28
|
+
},
|
|
29
|
+
"deviceTypes": {
|
|
30
|
+
"desktop": true,
|
|
31
|
+
"tablet": true,
|
|
32
|
+
"phone": true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"sap.ui5": {
|
|
36
|
+
"flexEnabled": true,
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"minUI5Version": "<%- ui5.minUI5Version %>",
|
|
39
|
+
"libs": {<% (ui5.manifestLibs?.length ? ui5.manifestLibs : ui5.ui5Libs).concat(ui5.customUi5Libs ?? []).forEach((ui5Lib, idx, libs) => {%>
|
|
40
|
+
<%- `"${ui5Lib}": {}${idx+1 < libs.length ? ',' : ''}` %><% }); %>
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"contentDensities": {
|
|
44
|
+
"compact": true,
|
|
45
|
+
"cozy": true
|
|
46
|
+
},
|
|
47
|
+
"models": {
|
|
48
|
+
"i18n": {
|
|
49
|
+
"type": "sap.ui.model.resource.ResourceModel",
|
|
50
|
+
"settings": {
|
|
51
|
+
"bundleName": "<%- app.id %>.i18n.i18n"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"resources": {
|
|
56
|
+
"css": []
|
|
57
|
+
},
|
|
58
|
+
"routing": {
|
|
59
|
+
"config": {},
|
|
60
|
+
"routes": [],
|
|
61
|
+
"targets": {}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|