dev-approuter 0.2.14 → 0.2.16
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 +19 -0
- package/lib/devApprouter.js +8 -7
- package/lib/helpers.js +1 -6
- package/package.json +3 -3
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.2.16](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.2.15...dev-approuter@0.2.16) (2024-03-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* cleanup of dependencies and improved approuter logic ([#984](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/984)) ([65ffaed](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/65ffaedb7968015e008e2eb6aa66ff1e0a03a73a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.2.15](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.2.14...dev-approuter@0.2.15) (2024-03-04)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package dev-approuter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.2.14](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.2.13...dev-approuter@0.2.14) (2024-02-18)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package dev-approuter
|
package/lib/devApprouter.js
CHANGED
|
@@ -47,6 +47,8 @@ class DevApprouter {
|
|
|
47
47
|
|
|
48
48
|
const config = parseConfig();
|
|
49
49
|
const cwd = process.cwd();
|
|
50
|
+
const arPort = process.env.PORT || 5000;
|
|
51
|
+
const cdsPort = process.env.CDS_PORT || 4004;
|
|
50
52
|
|
|
51
53
|
// lookup the CDS server root
|
|
52
54
|
let cdsServerConfig;
|
|
@@ -100,7 +102,7 @@ class DevApprouter {
|
|
|
100
102
|
middlewareMountPath = "/_" + mountPath;
|
|
101
103
|
|
|
102
104
|
// add destination for newly configured route
|
|
103
|
-
addDestination(moduleId,
|
|
105
|
+
addDestination(moduleId, arPort, middlewareMountPath);
|
|
104
106
|
} else {
|
|
105
107
|
middlewareMountPath = mountPath;
|
|
106
108
|
}
|
|
@@ -115,7 +117,6 @@ class DevApprouter {
|
|
|
115
117
|
// start CDS server on different port
|
|
116
118
|
if (cdsServerConfig) {
|
|
117
119
|
const { modulePath, moduleId } = cdsServerConfig;
|
|
118
|
-
const port = process.env.CDS_PORT || 4004;
|
|
119
120
|
|
|
120
121
|
// start CDS server on different port (requires to override the
|
|
121
122
|
// origin listen function to intercept call from CDS server and
|
|
@@ -124,8 +125,8 @@ class DevApprouter {
|
|
|
124
125
|
const app = express();
|
|
125
126
|
app._listen = app.listen;
|
|
126
127
|
app.listen = function (port, callback) {
|
|
127
|
-
return this._listen(
|
|
128
|
-
console.log(`CDS server started at: http://localhost:${
|
|
128
|
+
return this._listen(cdsPort, function () {
|
|
129
|
+
console.log(`CDS server started at: http://localhost:${cdsPort}`);
|
|
129
130
|
callback?.apply(callback, arguments);
|
|
130
131
|
});
|
|
131
132
|
};
|
|
@@ -150,13 +151,13 @@ class DevApprouter {
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
// add destination for newly configured route
|
|
153
|
-
addDestination(moduleId,
|
|
154
|
+
addDestination(moduleId, cdsPort);
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
// create and start the SAP Approuter
|
|
157
158
|
// https://help.sap.com/docs/btp/sap-business-technology-platform/extension-api-of-application-router
|
|
158
159
|
approuter().start({
|
|
159
|
-
port:
|
|
160
|
+
port: arPort,
|
|
160
161
|
xsappConfig: applyDependencyConfig(config),
|
|
161
162
|
extensions: [
|
|
162
163
|
{
|
|
@@ -166,7 +167,7 @@ class DevApprouter {
|
|
|
166
167
|
},
|
|
167
168
|
].concat(extensions),
|
|
168
169
|
});
|
|
169
|
-
console.log(`Approuter started at: http://localhost:${
|
|
170
|
+
console.log(`Approuter started at: http://localhost:${arPort}`);
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
|
package/lib/helpers.js
CHANGED
|
@@ -63,12 +63,7 @@ const addDestination = (moduleId, port, mountPath) => {
|
|
|
63
63
|
destinations = JSON.parse(process.env.destinations);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
let url
|
|
67
|
-
if (mountPath) {
|
|
68
|
-
url = `http://localhost:${process.env.PORT || 5000}${mountPath}`;
|
|
69
|
-
} else {
|
|
70
|
-
url = `http://localhost:${port}`;
|
|
71
|
-
}
|
|
66
|
+
let url = `http://localhost${port ? `:${port}` : ""}${mountPath || ""}`;
|
|
72
67
|
|
|
73
68
|
// only add new destination if it's not already provided
|
|
74
69
|
const destinationAlreadyExists = destinations.some((destination) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dev-approuter",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
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",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@sap/approuter": ">=15.0.0",
|
|
15
15
|
"@sap/xsenv": "4.2.0",
|
|
16
|
-
"cds-plugin-ui5": "^0.8.
|
|
16
|
+
"cds-plugin-ui5": "^0.8.3",
|
|
17
17
|
"express": "^4.18.2",
|
|
18
18
|
"ui5-middleware-cap": "^3.2.9"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "cfbdc7583d6664e40c6ac5a765f662d34f93221b"
|
|
21
21
|
}
|