dev-approuter 0.1.22 → 0.2.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,17 @@
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.2.0](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.1.22...dev-approuter@0.2.0) (2023-10-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * **ui5-middleware-cap:** wrap @sap/cds/bin/serve command ([#869](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/869)) ([541e6e6](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/541e6e6d8f877e4bf4e472bc576e7e33224f0e03))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.1.22](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.1.21...dev-approuter@0.1.22) (2023-10-02)
7
18
 
8
19
  **Note:** Version bump only for package dev-approuter
@@ -104,12 +104,26 @@ class DevApprouter {
104
104
  // start CDS server on different port
105
105
  if (cdsServerConfig) {
106
106
  const { modulePath, moduleId } = cdsServerConfig;
107
+ const port = process.env.CDS_PORT || 4004;
107
108
 
108
- // start CDS server on different port
109
+ // start CDS server on different port (requires to override the
110
+ // origin listen function to intercept call from CDS server and
111
+ // ensure to use the port as defined by environment variable or
112
+ // the default port for the CDS server!)
109
113
  const app = express();
110
- const { servicesPaths } = await applyCDSMiddleware(app, { root: modulePath, cwd });
111
- app.listen(process.env.CDS_PORT || 4004, () => {
112
- console.log(`CDS server started at: http://localhost:${process.env.CDS_PORT || 4004}`);
114
+ app._listen = app.listen;
115
+ app.listen = function (port, callback) {
116
+ return this._listen(process.env.CDS_PORT || 4004, function () {
117
+ console.log(`CDS server started at: http://localhost:${process.env.CDS_PORT || 4004}`);
118
+ callback?.apply(callback, arguments);
119
+ });
120
+ };
121
+
122
+ // apply the CDS server middlewares and keep the welcome page
123
+ const { servicesPaths } = await applyCDSMiddleware(app, {
124
+ root: modulePath,
125
+ options: config.dependencyRoutes[moduleId]?.options,
126
+ headless: false,
113
127
  });
114
128
 
115
129
  // create route if CDS module is not referenced in xs-dev.json/xs-app.json
@@ -125,7 +139,7 @@ class DevApprouter {
125
139
  }
126
140
 
127
141
  // add destination for newly configured route
128
- addDestination(moduleId, process.env.CDS_PORT || 4004);
142
+ addDestination(moduleId, port);
129
143
  }
130
144
 
131
145
  // create and start the SAP Approuter
package/lib/helpers.js CHANGED
@@ -43,6 +43,7 @@ const applyDependencyConfig = (config) => {
43
43
  if (route.dependency) {
44
44
  Object.assign(route, config.dependencyRoutes[route.dependency]);
45
45
  delete route.dependency;
46
+ delete route.options;
46
47
  }
47
48
  });
48
49
  delete config.dependencyRoutes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-approuter",
3
- "version": "0.1.22",
3
+ "version": "0.2.0",
4
4
  "description": "A dev time wrapper for the SAP Application Router that can serve UI5 and CDS modules added as dependencies.",
5
5
  "author": "Nico Schoenteich <nicolai.schoenteich@sap.com> (https://github.com/nicoschoenteich)",
6
6
  "license": "Apache-2.0",
@@ -14,7 +14,7 @@
14
14
  "@sap/xsenv": "4.0.0",
15
15
  "cds-plugin-ui5": "^0.6.13",
16
16
  "express": "^4.18.2",
17
- "ui5-middleware-cap": "^3.1.5"
17
+ "ui5-middleware-cap": "^3.2.0"
18
18
  },
19
- "gitHead": "0469566e63fdad3800a1a3a92c781f807328dac8"
19
+ "gitHead": "ae9ead34c0a03173c8d621b85c58c0f530fdeddc"
20
20
  }