@sap-ux/adp-tooling 0.1.0 → 0.1.2
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/preview/adp-preview.d.ts +6 -5
- package/dist/preview/adp-preview.js +24 -15
- package/package.json +3 -2
- package/templates/gitignore.tmpl +5 -0
- package/templates/package.json +23 -0
- package/templates/ui5.yaml +6 -0
- package/templates/webapp/i18n/i18n.properties +6 -0
- package/templates/webapp/manifest.appdescr_variant +29 -0
|
@@ -2,13 +2,14 @@ import type { ToolsLogger } from '@sap-ux/logger';
|
|
|
2
2
|
import type { AdpPreviewConfig, DescriptorVariant } from '../types';
|
|
3
3
|
import type { NextFunction, Request, Response } from 'express';
|
|
4
4
|
import type { MergedAppDescriptor } from '@sap-ux/axios-extension';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ReaderCollection } from '@ui5/fs';
|
|
6
6
|
import type { UI5FlexLayer } from '@sap-ux/project-access';
|
|
7
7
|
/**
|
|
8
8
|
* Instance of an adaptation project handling requests and data transformation.
|
|
9
9
|
*/
|
|
10
10
|
export declare class AdpPreview {
|
|
11
11
|
private readonly config;
|
|
12
|
+
private readonly project;
|
|
12
13
|
private readonly logger;
|
|
13
14
|
/**
|
|
14
15
|
* Merged descriptor variant with reference app manifest
|
|
@@ -28,17 +29,17 @@ export declare class AdpPreview {
|
|
|
28
29
|
* Constructor taking the config and a logger as input.
|
|
29
30
|
*
|
|
30
31
|
* @param config adp config
|
|
32
|
+
* @param project reference to the root of the project
|
|
31
33
|
* @param logger logger instance
|
|
32
34
|
*/
|
|
33
|
-
constructor(config: AdpPreviewConfig, logger: ToolsLogger);
|
|
35
|
+
constructor(config: AdpPreviewConfig, project: ReaderCollection, logger: ToolsLogger);
|
|
34
36
|
/**
|
|
35
37
|
* Fetch all required configurations from the backend and initialize all configurations.
|
|
36
38
|
*
|
|
37
39
|
* @param descriptorVariant descriptor variant from the project
|
|
38
|
-
* @param files all relevant project files (e.g. webapp content)
|
|
39
40
|
* @returns the UI5 flex layer for which editing is enabled
|
|
40
41
|
*/
|
|
41
|
-
init(descriptorVariant: DescriptorVariant
|
|
42
|
+
init(descriptorVariant: DescriptorVariant): Promise<UI5FlexLayer>;
|
|
42
43
|
/**
|
|
43
44
|
* Proxy for the merged application manifest.json and blocking of preload files.
|
|
44
45
|
*
|
|
@@ -46,6 +47,6 @@ export declare class AdpPreview {
|
|
|
46
47
|
* @param res outgoing response object
|
|
47
48
|
* @param next next middleware that is to be called if the request cannot be handled
|
|
48
49
|
*/
|
|
49
|
-
proxy(req: Request, res: Response, next: NextFunction): void
|
|
50
|
+
proxy(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
50
51
|
}
|
|
51
52
|
//# sourceMappingURL=adp-preview.d.ts.map
|
|
@@ -33,8 +33,7 @@ class AdpPreview {
|
|
|
33
33
|
get resources() {
|
|
34
34
|
if (this.mergedDescriptor) {
|
|
35
35
|
const resources = {
|
|
36
|
-
[this.mergedDescriptor.name]: this.mergedDescriptor.url
|
|
37
|
-
[this.mergedDescriptor.manifest['sap.app'].id]: this.mergedDescriptor.url
|
|
36
|
+
[this.mergedDescriptor.name]: this.mergedDescriptor.url
|
|
38
37
|
};
|
|
39
38
|
this.mergedDescriptor.asyncHints.libs.forEach((lib) => {
|
|
40
39
|
var _a;
|
|
@@ -52,24 +51,26 @@ class AdpPreview {
|
|
|
52
51
|
* Constructor taking the config and a logger as input.
|
|
53
52
|
*
|
|
54
53
|
* @param config adp config
|
|
54
|
+
* @param project reference to the root of the project
|
|
55
55
|
* @param logger logger instance
|
|
56
56
|
*/
|
|
57
|
-
constructor(config, logger) {
|
|
57
|
+
constructor(config, project, logger) {
|
|
58
58
|
this.config = config;
|
|
59
|
+
this.project = project;
|
|
59
60
|
this.logger = logger;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Fetch all required configurations from the backend and initialize all configurations.
|
|
63
64
|
*
|
|
64
65
|
* @param descriptorVariant descriptor variant from the project
|
|
65
|
-
* @param files all relevant project files (e.g. webapp content)
|
|
66
66
|
* @returns the UI5 flex layer for which editing is enabled
|
|
67
67
|
*/
|
|
68
|
-
init(descriptorVariant
|
|
68
|
+
init(descriptorVariant) {
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
const provider = yield (0, service_1.createProvider)(this.config, this.logger);
|
|
71
71
|
const lrep = provider.getLayeredRepository();
|
|
72
72
|
const zip = new yazl_1.ZipFile();
|
|
73
|
+
const files = yield this.project.byGlob('**/*.*');
|
|
73
74
|
for (const file of files) {
|
|
74
75
|
zip.addBuffer(yield file.getBuffer(), file.getPath().substring(1));
|
|
75
76
|
}
|
|
@@ -88,16 +89,24 @@ class AdpPreview {
|
|
|
88
89
|
* @param next next middleware that is to be called if the request cannot be handled
|
|
89
90
|
*/
|
|
90
91
|
proxy(req, res, next) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
if (req.path === '/manifest.json') {
|
|
94
|
+
res.status(200);
|
|
95
|
+
res.send(JSON.stringify(this.descriptor.manifest, undefined, 2));
|
|
96
|
+
}
|
|
97
|
+
else if (req.path === '/Component-preload.js') {
|
|
98
|
+
res.status(404).send();
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const files = yield this.project.byGlob(req.path);
|
|
102
|
+
if (files.length === 1) {
|
|
103
|
+
res.status(200).send(yield files[0].getString());
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
next();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
101
110
|
}
|
|
102
111
|
}
|
|
103
112
|
exports.AdpPreview = AdpPreview;
|
package/package.json
CHANGED
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.1.
|
|
12
|
+
"version": "0.1.2",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"files": [
|
|
17
17
|
"LICENSE",
|
|
18
|
+
"templates",
|
|
18
19
|
"dist",
|
|
19
20
|
"ui5.yaml",
|
|
20
21
|
"bin",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"nock": "13.2.1",
|
|
47
48
|
"rimraf": "5.0.1",
|
|
48
49
|
"supertest": "6.3.2",
|
|
49
|
-
"@sap-ux/project-access": "1.
|
|
50
|
+
"@sap-ux/project-access": "1.11.0"
|
|
50
51
|
},
|
|
51
52
|
"engines": {
|
|
52
53
|
"pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= package.name %>",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "<%= package.description %>",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"ui5",
|
|
8
|
+
"openui5",
|
|
9
|
+
"sapui5"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@sap-ux/backend-proxy-middleware": "^0.6.61",
|
|
14
|
+
"@sap-ux/preview-middleware": "^0.3.1",
|
|
15
|
+
"@sap-ux/ui5-proxy-middleware": "^1.1.31",
|
|
16
|
+
"@ui5/cli": "^3.3.2"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "ui5 build --clean-dest",
|
|
20
|
+
"start": "ui5 serve --open /test/flp.html#app-preview",
|
|
21
|
+
"editor": "ui5 serve --open /test/flp.html?fiori-tools-rta-mode=forAdaptation#app-preview"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fileName": "manifest",
|
|
3
|
+
"layer": "<%- app.layer %>",
|
|
4
|
+
"fileType": "appdescr_variant",
|
|
5
|
+
"reference": "<%- app.reference %>",
|
|
6
|
+
"id": "<%- app.id %>",
|
|
7
|
+
"namespace": "apps/<%- app.reference %>/appVariants/<%- app.id %>/",
|
|
8
|
+
"version": "0.1.0",
|
|
9
|
+
"content": [
|
|
10
|
+
{
|
|
11
|
+
"changeType": "appdescr_app_setTitle",
|
|
12
|
+
"content": {},
|
|
13
|
+
"texts": {
|
|
14
|
+
"i18n": "i18n/i18n.properties"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"changeType": "appdescr_ui5_addNewModelEnhanceWith",
|
|
19
|
+
"content": {
|
|
20
|
+
"modelId": "i18n",
|
|
21
|
+
"bundleUrl": "i18n/i18n.properties",
|
|
22
|
+
"supportedLocales": [
|
|
23
|
+
""
|
|
24
|
+
],
|
|
25
|
+
"fallbackLocale": ""
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|