dev-approuter 0.1.1 → 0.1.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 +19 -0
- package/README.md +1 -1
- package/lib/devApprouter.js +9 -2
- package/lib/helpers.js +11 -7
- package/package.json +2 -2
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.1.3](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.1.2...dev-approuter@0.1.3) (2023-08-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package dev-approuter
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.1.2](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.1.1...dev-approuter@0.1.2) (2023-08-25)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **dev-approuter:** make CAP projects work without reference in xs-dev.json ([#809](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/809)) ([d52a432](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/d52a432609630da3ac215cdcc1a501d7be37655d))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.1.1](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/dev-approuter@0.1.0...dev-approuter@0.1.1) (2023-08-25)
|
|
7
26
|
|
|
8
27
|
|
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ Look at the following example `xs-dev.json` that defines different `authenticati
|
|
|
134
134
|
}
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
Behind the scenes, the `dev-approuter` will resolve these "dependency routes" by adding the `source`, `target`, and `destination` properties to them. Be aware that exactly these properties
|
|
137
|
+
Behind the scenes, the `dev-approuter` will resolve these "dependency routes" by adding the `source`, `target`, and `destination` properties to them. Be aware that exactly these properties get overwritten by the `dev-approuter` in case you use them together with `dependency`. The only exception are SAP CAP dependencies, for which only the `destination` property gets overwritten by the `dev-approuter`.
|
|
138
138
|
|
|
139
139
|
## Using the `dev-approuter` and SAP Application Router simultaneously
|
|
140
140
|
|
package/lib/devApprouter.js
CHANGED
|
@@ -109,8 +109,15 @@ class DevApprouter {
|
|
|
109
109
|
console.log(`CAP server started at: http://localhost:${process.env.CAP_PORT || 4004}`);
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
//
|
|
113
|
-
if (config.dependencyRoutes
|
|
112
|
+
// create route if CAP module is not referenced in xs-dev.json/xs-app.json
|
|
113
|
+
if (!config.dependencyRoutes[moduleId]) {
|
|
114
|
+
const route = {
|
|
115
|
+
dependency: moduleId,
|
|
116
|
+
authenticationType: "none",
|
|
117
|
+
};
|
|
118
|
+
config.routes.unshift(Object.assign({}, route));
|
|
119
|
+
config.dependencyRoutes[moduleId] = configureCAPRoute(moduleId, servicesPaths, route);
|
|
120
|
+
} else {
|
|
114
121
|
config.dependencyRoutes[moduleId] = configureCAPRoute(moduleId, servicesPaths, config.dependencyRoutes[moduleId]);
|
|
115
122
|
}
|
|
116
123
|
|
package/lib/helpers.js
CHANGED
|
@@ -25,7 +25,8 @@ const parseConfig = () => {
|
|
|
25
25
|
if (config.dependencyRoutes[`${route.dependency}`]) {
|
|
26
26
|
throw new Error(`Duplicate dependency "${route.dependency}" found in file ${path.join(process.cwd(), configFile)}.`);
|
|
27
27
|
} else {
|
|
28
|
-
config.dependencyRoutes[`${route.dependency}`] =
|
|
28
|
+
config.dependencyRoutes[`${route.dependency}`] = {};
|
|
29
|
+
Object.assign(config.dependencyRoutes[`${route.dependency}`], route);
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
});
|
|
@@ -40,7 +41,8 @@ const parseConfig = () => {
|
|
|
40
41
|
const applyDependencyConfig = (config) => {
|
|
41
42
|
config.routes?.forEach((route) => {
|
|
42
43
|
if (route.dependency) {
|
|
43
|
-
route
|
|
44
|
+
Object.assign(route, config.dependencyRoutes[route.dependency]);
|
|
45
|
+
delete route.dependency;
|
|
44
46
|
}
|
|
45
47
|
});
|
|
46
48
|
delete config.dependencyRoutes;
|
|
@@ -95,11 +97,13 @@ const addDestination = (moduleId, port, mountPath) => {
|
|
|
95
97
|
* @returns {Object} the configured route.
|
|
96
98
|
*/
|
|
97
99
|
const configureCAPRoute = (moduleId, servicesPaths, route) => {
|
|
98
|
-
route.source
|
|
99
|
-
.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
if (!route.source) {
|
|
101
|
+
route.source = servicesPaths
|
|
102
|
+
.map((path) => {
|
|
103
|
+
return `${path}(.*)`;
|
|
104
|
+
})
|
|
105
|
+
.join("|");
|
|
106
|
+
}
|
|
103
107
|
route.destination = moduleId;
|
|
104
108
|
delete route.dependency;
|
|
105
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dev-approuter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A dev time wrapper for the SAP Application Router that can serve UI5 and CAP modules added as dependencies.",
|
|
5
5
|
"author": "Nico Schoenteich <nicolai.schoenteich@sap.com> (https://github.com/nicoschoenteich)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"path": "^0.12.7",
|
|
18
18
|
"ui5-middleware-cap": "^3.1.0"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "acbf2b7d5faf5d9b52a747201681c43a99377d02"
|
|
21
21
|
}
|