@sap-ux/preview-middleware 0.4.0 → 0.4.1
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/base/flp.js +7 -2
- package/dist/ui5/middleware.js +6 -6
- package/package.json +1 -1
package/dist/base/flp.js
CHANGED
|
@@ -106,7 +106,7 @@ class FlpSandbox {
|
|
|
106
106
|
*/
|
|
107
107
|
addStandardRoutes() {
|
|
108
108
|
// add route for the sandbox.html
|
|
109
|
-
this.router.get(this.config.path, (req, res) => {
|
|
109
|
+
this.router.get(this.config.path, ((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
110
110
|
var _a, _b;
|
|
111
111
|
const config = Object.assign({}, this.templateConfig);
|
|
112
112
|
const fioriToolsRtaMode = req.query['fiori-tools-rta-mode'];
|
|
@@ -121,6 +121,11 @@ class FlpSandbox {
|
|
|
121
121
|
this.logger.error('Fiori tools RTA mode could not be started because the RTA layer is missing.');
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
+
// warn the user if a file with the same name exists in the filesystem
|
|
125
|
+
const file = yield this.project.byPath(this.config.path);
|
|
126
|
+
if (file) {
|
|
127
|
+
this.logger.warn(`HTML file returned at ${this.config.path} is NOT loaded from the file system.`);
|
|
128
|
+
}
|
|
124
129
|
const template = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../templates/flp/sandbox.html'), 'utf-8');
|
|
125
130
|
const html = (0, ejs_1.render)(template, config);
|
|
126
131
|
// if livereload is enabled, don't send it but let other middleware modify the content
|
|
@@ -131,7 +136,7 @@ class FlpSandbox {
|
|
|
131
136
|
else {
|
|
132
137
|
res.status(200).contentType('html').send(html);
|
|
133
138
|
}
|
|
134
|
-
});
|
|
139
|
+
})));
|
|
135
140
|
// add route for locate-reuse-libs if requested
|
|
136
141
|
if (this.config.libs && this.templateConfig.locateReuseLibsScript) {
|
|
137
142
|
const pathParts = this.config.path.split('/');
|
package/dist/ui5/middleware.js
CHANGED
|
@@ -22,10 +22,10 @@ const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
|
22
22
|
*/
|
|
23
23
|
function initAdp(rootProject, config, flp, logger) {
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
25
|
+
const appVariant = yield rootProject.byPath('/manifest.appdescr_variant');
|
|
26
|
+
if (appVariant) {
|
|
27
27
|
const adp = new adp_tooling_1.AdpPreview(config, rootProject, logger);
|
|
28
|
-
const layer = yield adp.init(JSON.parse(yield
|
|
28
|
+
const layer = yield adp.init(JSON.parse(yield appVariant.getString()));
|
|
29
29
|
flp.config.rta = { layer };
|
|
30
30
|
yield flp.init(adp.descriptor.manifest, adp.descriptor.name, adp.resources);
|
|
31
31
|
flp.router.use(adp.descriptor.url, adp.proxy.bind(adp));
|
|
@@ -57,9 +57,9 @@ function createRouter({ resources, options, middlewareUtil }, logger) {
|
|
|
57
57
|
yield initAdp(resources.rootProject, config.adp, flp, logger);
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
yield flp.init(JSON.parse(yield
|
|
60
|
+
const manifest = yield resources.rootProject.byPath('/manifest.json');
|
|
61
|
+
if (manifest) {
|
|
62
|
+
yield flp.init(JSON.parse(yield manifest.getString()));
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
65
|
throw new Error('No manifest.json found.');
|
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%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.4.
|
|
12
|
+
"version": "0.4.1",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|