dev-approuter 0.3.1 → 0.3.3

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,25 @@
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.3.3](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.3.2...dev-approuter@0.3.3) (2024-11-05)
7
+
8
+ **Note:** Version bump only for package dev-approuter
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.3.2](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.3.1...dev-approuter@0.3.2) (2024-11-01)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * update dependencies ([#1114](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/1114)) ([d7672f2](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/d7672f2cd10f8a5de1da3070050ab98810e0fcf8))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.3.1](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.3.0...dev-approuter@0.3.1) (2024-10-10)
7
26
 
8
27
  **Note:** Version bump only for package dev-approuter
@@ -2,10 +2,11 @@ const approuter = require("@sap/approuter");
2
2
  const express = require("express");
3
3
  const xsenv = require("@sap/xsenv");
4
4
 
5
+ const LOG = require("@sap/cds").log("dev-approuter") || console;
6
+
5
7
  const findUI5Modules = require("cds-plugin-ui5/lib/findUI5Modules");
6
8
  const createPatchedRouter = require("cds-plugin-ui5/lib/createPatchedRouter");
7
9
  const applyUI5Middleware = require("cds-plugin-ui5/lib/applyUI5Middleware");
8
-
9
10
  const findCDSModules = require("ui5-middleware-cap/lib/findCDSModules");
10
11
  const applyCDSMiddleware = require("ui5-middleware-cap/lib/applyCDSMiddleware");
11
12
 
@@ -91,7 +92,7 @@ class DevApprouter {
91
92
  });
92
93
 
93
94
  // mounting the router for the UI5 application to the CDS server
94
- console.log(`Mounting ${mountPath} to UI5 app ${modulePath}`);
95
+ LOG.info(`Mounting ${mountPath} to UI5 app ${modulePath}`);
95
96
 
96
97
  let middlewareMountPath;
97
98
  // define middlewareMountPath as `/_${mountPath}` if ui5 module is referenced as "dependency" in xs-dev.json or xs-app.json
@@ -126,7 +127,7 @@ class DevApprouter {
126
127
  app._listen = app.listen;
127
128
  app.listen = function (port, callback) {
128
129
  return this._listen(cdsPort, function () {
129
- console.log(`CDS server started at: http://localhost:${cdsPort}`);
130
+ LOG.info(`CDS server started at: http://localhost:${cdsPort}`);
130
131
  callback?.apply(callback, arguments);
131
132
  });
132
133
  };
@@ -144,7 +145,9 @@ class DevApprouter {
144
145
  dependency: moduleId,
145
146
  authenticationType: "none",
146
147
  };
147
- config.routes.unshift(Object.assign({}, route));
148
+ // respect already declared routes in xs-dev.json
149
+ // so inserting these auto-generated ones after
150
+ config.routes.push(Object.assign({}, route));
148
151
  config.dependencyRoutes[moduleId] = configureCDSRoute(moduleId, servicesPaths, route);
149
152
  } else {
150
153
  config.dependencyRoutes[moduleId] = configureCDSRoute(moduleId, servicesPaths, config.dependencyRoutes[moduleId]);
@@ -167,7 +170,7 @@ class DevApprouter {
167
170
  },
168
171
  ].concat(extensions),
169
172
  });
170
- console.log(`Approuter started at: http://localhost:${arPort}`);
173
+ LOG.info(`Approuter started at: http://localhost:${arPort}`);
171
174
  }
172
175
  }
173
176
 
package/lib/helpers.js CHANGED
@@ -1,6 +1,8 @@
1
1
  const path = require("path");
2
2
  const fs = require("fs");
3
3
 
4
+ const LOG = require("@sap/cds").log("dev-approuter") || console;
5
+
4
6
  /**
5
7
  * Parses the approuter configuration from an `xs-dev.json` file.
6
8
  * If that file doesn't exist, it looks for an `xs-app.json` file.
@@ -16,6 +18,7 @@ const parseConfig = () => {
16
18
  if (fs.existsSync(path.join(process.cwd(), file))) {
17
19
  config = JSON.parse(fs.readFileSync(path.join(process.cwd(), file), { encoding: "utf8" }));
18
20
  configFile = file;
21
+ LOG.info(`Using configuration from ${path.join(process.cwd(), configFile)}`);
19
22
  break;
20
23
  }
21
24
  }
@@ -47,6 +50,7 @@ const applyDependencyConfig = (config) => {
47
50
  }
48
51
  });
49
52
  delete config.dependencyRoutes;
53
+ LOG.info("running these routes:", config.routes);
50
54
  return config;
51
55
  };
52
56
 
@@ -83,6 +87,7 @@ const addDestination = (moduleId, port, mountPath) => {
83
87
  });
84
88
  process.env.destinations = JSON.stringify(destinations);
85
89
  }
90
+ LOG.info("running these destinations:", JSON.parse(process.env.destinations));
86
91
  };
87
92
 
88
93
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-approuter",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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",
@@ -11,11 +11,19 @@
11
11
  "directory": "packages/dev-approuter"
12
12
  },
13
13
  "dependencies": {
14
- "@sap/approuter": ">=16.7.1",
15
- "@sap/xsenv": "5.2.0",
14
+ "@sap/approuter": ">=17.0.0",
15
+ "@sap/xsenv": "5.4.0",
16
16
  "cds-plugin-ui5": "^0.11.1",
17
- "express": "^4.19.2",
17
+ "express": "^4.21.1",
18
18
  "ui5-middleware-cap": "^3.3.0"
19
19
  },
20
- "gitHead": "49c0415f143ba94b88f522362f027e84021933d2"
20
+ "peerDependencies": {
21
+ "@sap/cds": "*"
22
+ },
23
+ "peerDependenciesMeta": {
24
+ "@sap/cds": {
25
+ "optional": true
26
+ }
27
+ },
28
+ "gitHead": "2605fafb84023ea02332b3b80befcb47e747ab84"
21
29
  }