cds-plugin-ui5 0.7.4 → 0.8.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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.8.0](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.7.5...cds-plugin-ui5@0.8.0) (2024-01-25)
7
+
8
+
9
+ ### Features
10
+
11
+ * **ui5-middleware-ui5:** support nested scenarios in CDS servers ([#938](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/938)) ([5d61f18](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/5d61f18f04a624e8f61ec7fa1e8f32e81c43f6b0))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.7.5](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.7.4...cds-plugin-ui5@0.7.5) (2024-01-17)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **cds-plugin-ui5:** support app folders being served from cds.env.folders.app ([#934](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/934)) ([#935](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/935)) ([9cff34d](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/9cff34d1b39ff2d22b6a8caaf3971306de737fe5))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [0.7.4](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.7.3...cds-plugin-ui5@0.7.4) (2023-12-10)
7
29
 
8
30
  **Note:** Version bump only for package cds-plugin-ui5
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > :wave: This is a **community project** and there is no official support for this package! Feel free to use it, open issues, contribute, and help answering questions.
4
4
 
5
- The `cds-plugin-ui5` is a CDS server `cds-plugin` which enables the integration of UI5 tooling based (UI5 freestyle or Fiori elements) projects into the CDS server via the UI5 tooling express middlewares. The UI5 or Fiori elements projects just need to be located in the `app` folder of the CDS server or be dependency of the CDS server.
5
+ The `cds-plugin-ui5` is a CDS server `cds-plugin` which enables the integration of UI5 tooling based (UI5 freestyle or Fiori elements) projects into the CDS server via the UI5 tooling express middlewares. The UI5 or Fiori elements projects just need to be located in the `app` folder of the CDS server, or via the `cds.env.folders.app` variable, or be a dependency of the CDS server.
6
6
 
7
7
  > :construction: **Note**
8
8
  > This cds-plugin is still work in progress and not final yet!
package/cds-plugin.js CHANGED
@@ -69,7 +69,7 @@ if (!skip) {
69
69
  log.debug("bootstrap");
70
70
 
71
71
  const cwd = process.cwd();
72
- const ui5Modules = await findUI5Modules({ cwd });
72
+ const ui5Modules = await findUI5Modules({ cwd, cds });
73
73
  const { localApps, config } = ui5Modules;
74
74
 
75
75
  const links = [];
@@ -20,7 +20,7 @@ const log = require("./log");
20
20
  * @param {string} options.skipDeps skip dependencies
21
21
  * @returns {Array<UI5Module>} array of UI5 module
22
22
  */
23
- module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps }) {
23
+ module.exports = async function findUI5Modules({ cwd, cds, skipLocalApps, skipDeps }) {
24
24
  // extract the modules configuration from the package.json
25
25
  const pkgJson = require(path.join(cwd, "package.json"));
26
26
 
@@ -52,9 +52,9 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
52
52
  const localApps = new Set();
53
53
  const appDirs = [];
54
54
  if (!skipLocalApps) {
55
- const appDir = path.join(cwd, "app");
55
+ const appDir = path.join(cwd, cds?.env?.folders?.app || "app");
56
56
  if (fs.existsSync(appDir)) {
57
- // is the UI5 app directly in teh app directory?
57
+ // is the UI5 app directly in the app directory?
58
58
  if (!fs.existsSync(path.join(appDir, determineUI5Yaml(appDir)))) {
59
59
  // lookup all dirs inside the root app directory for
60
60
  // being either a local app or a UI5 application
@@ -61,15 +61,22 @@ module.exports = async function rewriteHTML(req, res, rewriteCondition, rewriteC
61
61
  // store the last chunk in the content buffer
62
62
  contentBuffer.push(content instanceof Buffer ? content.toString(encoding) : content);
63
63
 
64
- // create the html content and parse it
64
+ // create the html content
65
65
  let htmlContent = contentBuffer.join("");
66
- const doc = HTMLParser.parse(htmlContent);
67
66
 
68
- // now run the callback
69
- rewriteContent(doc);
67
+ // ensure that the request is rewritten only once and not also by the cds-plugin-ui5
68
+ // therefore we add a marker to the request so that the middlewares can identify this
69
+ if (!req["ui5-rewriteHTML"]) {
70
+ // parse the html content
71
+ const doc = HTMLParser.parse(htmlContent);
70
72
 
71
- // update the html content
72
- htmlContent = doc.toString();
73
+ // now run the callback
74
+ rewriteContent(doc);
75
+
76
+ // update the html content
77
+ htmlContent = doc.toString();
78
+ }
79
+ req["ui5-rewriteHTML"] = true;
73
80
 
74
81
  // the rest is on express
75
82
  end.call(res, htmlContent, encoding);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cds-plugin-ui5",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "A CDS server plugin to inject the middlewares of all related UI5 tooling based projects.",
5
5
  "author": "Peter Muessig",
6
6
  "license": "Apache-2.0",
@@ -12,10 +12,10 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@ui5/fs": "^3.0.5",
15
- "@ui5/project": "^3.8.0",
16
- "@ui5/server": "^3.1.4",
15
+ "@ui5/project": "^3.9.0",
16
+ "@ui5/server": "^3.1.5",
17
17
  "js-yaml": "^4.1.0",
18
- "node-html-parser": "^6.1.11"
18
+ "node-html-parser": "^6.1.12"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@sap/cds": "^6.8.4",
@@ -25,5 +25,5 @@
25
25
  "@sap/cds": ">=6.8.2",
26
26
  "express": ">=4.18.2"
27
27
  },
28
- "gitHead": "035b27d4b261799f585b8d2d86308e2025398866"
28
+ "gitHead": "674eb4798d4f5a23efadf81f303f705cac3caa82"
29
29
  }