cds-plugin-ui5 0.6.13 → 0.7.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 +19 -0
- package/lib/findUI5Modules.js +31 -20
- package/package.json +3 -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.7.0](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.6.14...cds-plugin-ui5@0.7.0) (2023-10-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* allow overriding configFile for UI5 app dependencies ([#886](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/886)) ([c736648](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/c73664858c6ec67b4d8f2b7733b0d5234a6775db))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.6.14](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.6.13...cds-plugin-ui5@0.6.14) (2023-10-14)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package cds-plugin-ui5
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.6.13](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.6.12...cds-plugin-ui5@0.6.13) (2023-10-02)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package cds-plugin-ui5
|
package/lib/findUI5Modules.js
CHANGED
|
@@ -21,6 +21,33 @@ const log = require("./log");
|
|
|
21
21
|
* @returns {Array<UI5Module>} array of UI5 module
|
|
22
22
|
*/
|
|
23
23
|
module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps }) {
|
|
24
|
+
// extract the modules configuration from the package.json
|
|
25
|
+
const pkgJson = require(path.join(cwd, "package.json"));
|
|
26
|
+
|
|
27
|
+
// determine module configuration:
|
|
28
|
+
// => env variable: CDS_PLUGIN_UI5_MODULES (JSONObject<string, object>)
|
|
29
|
+
// => package.json: cds-plugin-ui5 > modules (JSONObject<string, object>)
|
|
30
|
+
// JSONObject<string, object>: key = moduleId (folder name, npm package name), object={ configFile: string, ... }
|
|
31
|
+
let modulesConfig;
|
|
32
|
+
try {
|
|
33
|
+
modulesConfig = JSON.parse(process.env.CDS_PLUGIN_UI5_MODULES);
|
|
34
|
+
log.info(`Using modules configuration from env`);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
modulesConfig = pkgJson.cds?.["cds-plugin-ui5"]?.modules;
|
|
37
|
+
}
|
|
38
|
+
if (modulesConfig) {
|
|
39
|
+
log.debug(`Found modules configuration: ${JSON.stringify(modulesConfig, undefined, 2)}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// helper to determine the ui5.yaml for the dependency or directory
|
|
43
|
+
const determineUI5Yaml = function determineUI5Yaml(depOrDir) {
|
|
44
|
+
let module = depOrDir;
|
|
45
|
+
if (path.isAbsolute(depOrDir)) {
|
|
46
|
+
module = path.basename(depOrDir);
|
|
47
|
+
}
|
|
48
|
+
return modulesConfig?.[module]?.configFile || "ui5.yaml";
|
|
49
|
+
};
|
|
50
|
+
|
|
24
51
|
// lookup the app folder to determine local apps and UI5 apps
|
|
25
52
|
const localApps = new Set();
|
|
26
53
|
const appDirs = [];
|
|
@@ -28,7 +55,7 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
|
|
|
28
55
|
const appDir = path.join(cwd, "app");
|
|
29
56
|
if (fs.existsSync(appDir)) {
|
|
30
57
|
// is the UI5 app directly in teh app directory?
|
|
31
|
-
if (!fs.existsSync(path.join(appDir,
|
|
58
|
+
if (!fs.existsSync(path.join(appDir, determineUI5Yaml(appDir)))) {
|
|
32
59
|
// lookup all dirs inside the root app directory for
|
|
33
60
|
// being either a local app or a UI5 application
|
|
34
61
|
fs.readdirSync(appDir, { withFileTypes: true })
|
|
@@ -36,7 +63,7 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
|
|
|
36
63
|
.forEach((d) => localApps.add(d.name));
|
|
37
64
|
localApps.forEach((e) => {
|
|
38
65
|
const d = path.join(appDir, e);
|
|
39
|
-
if (fs.existsSync(path.join(d,
|
|
66
|
+
if (fs.existsSync(path.join(d, determineUI5Yaml(d)))) {
|
|
40
67
|
localApps.delete(e);
|
|
41
68
|
appDirs.push(d);
|
|
42
69
|
}
|
|
@@ -61,7 +88,6 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
|
|
|
61
88
|
}
|
|
62
89
|
|
|
63
90
|
// lookup the UI5 modules in the project dependencies
|
|
64
|
-
const pkgJson = require(path.join(cwd, "package.json"));
|
|
65
91
|
if (!skipDeps) {
|
|
66
92
|
const deps = [];
|
|
67
93
|
deps.push(...Object.keys(pkgJson.dependencies || {}));
|
|
@@ -71,7 +97,7 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
|
|
|
71
97
|
appDirs.push(
|
|
72
98
|
...deps.filter((dep) => {
|
|
73
99
|
try {
|
|
74
|
-
require.resolve(
|
|
100
|
+
require.resolve(path.join(dep, determineUI5Yaml(dep)), {
|
|
75
101
|
paths: [cwd],
|
|
76
102
|
});
|
|
77
103
|
return true;
|
|
@@ -82,21 +108,6 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
|
|
|
82
108
|
);
|
|
83
109
|
}
|
|
84
110
|
|
|
85
|
-
// determine module configuration:
|
|
86
|
-
// => env variable: CDS_PLUGIN_UI5_MODULES (JSONObject<string, object>)
|
|
87
|
-
// => package.json: cds-plugin-ui5 > modules (JSONObject<string, object>)
|
|
88
|
-
// JSONObject<string, object>: key = moduleId (folder name, npm package name), object={ configFile: string, ... }
|
|
89
|
-
let modulesConfig;
|
|
90
|
-
try {
|
|
91
|
-
modulesConfig = JSON.parse(process.env.CDS_PLUGIN_UI5_MODULES);
|
|
92
|
-
log.info(`Using modules configuration from env`);
|
|
93
|
-
} catch (err) {
|
|
94
|
-
modulesConfig = pkgJson.cds?.["cds-plugin-ui5"]?.modules;
|
|
95
|
-
}
|
|
96
|
-
if (modulesConfig) {
|
|
97
|
-
log.debug(`Found modules configuration: ${JSON.stringify(modulesConfig, undefined, 2)}`);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
111
|
// if apps are available, attach the middlewares of the UI5 apps
|
|
101
112
|
// to the express of the CDS server via a express router
|
|
102
113
|
const apps = [];
|
|
@@ -104,7 +115,7 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
|
|
|
104
115
|
if (appDirs) {
|
|
105
116
|
for await (const appDir of appDirs) {
|
|
106
117
|
// read the ui5.yaml file to extract the configuration
|
|
107
|
-
const ui5YamlPath = require.resolve(path.join(appDir,
|
|
118
|
+
const ui5YamlPath = require.resolve(path.join(appDir, determineUI5Yaml(appDir)), {
|
|
108
119
|
paths: [cwd],
|
|
109
120
|
});
|
|
110
121
|
let ui5Configs;
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cds-plugin-ui5",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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",
|
|
7
|
+
"homepage": "https://github.com/ui5-community/ui5-ecosystem-showcase/tree/main/packages/cds-plugin-ui5#readme",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "https://github.com/ui5-community/ui5-ecosystem-showcase.git",
|
|
@@ -24,5 +25,5 @@
|
|
|
24
25
|
"@sap/cds": ">=6.8.2",
|
|
25
26
|
"express": ">=4.18.2"
|
|
26
27
|
},
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "df6d62f98ada9f7852931b7292070111717f3949"
|
|
28
29
|
}
|