cds-plugin-ui5 0.9.3 → 0.9.5
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 +22 -0
- package/README.md +1 -1
- package/cds-plugin.js +54 -6
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.9.5](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.9.4...cds-plugin-ui5@0.9.5) (2024-07-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cds-plugin-ui5:** report versions of the plugin and @sap/cds-dk, @sap/cds ([#1045](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/1045)) ([8db7560](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/8db7560da65d2d042a5e71887b885c8d102714db))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.9.4](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.9.3...cds-plugin-ui5@0.9.4) (2024-07-19)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **cds-plugin-ui5:** support @sap/cds-dk@8 build priorities ([#1037](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/1037)) ([c921a35](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/c921a35f97c0895b603f8b781a946ceaa1234275)), closes [#1033](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/1033)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [0.9.3](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.9.2...cds-plugin-ui5@0.9.3) (2024-06-04)
|
|
7
29
|
|
|
8
30
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> :wave: This is a **community project** and there is no official support for this package! Feel free to use it, open issues, contribute, and help answering questions.
|
|
4
4
|
|
|
5
|
-
The `cds-plugin-ui5` is a CDS server `cds-plugin` which enables the integration of UI5 tooling based (UI5 freestyle or Fiori elements) projects into the CDS server via the UI5 tooling express middlewares. The UI5 or Fiori elements projects just need to be located in the `app` folder of the CDS server, or via the `cds.env.folders.app` variable, or be a dependency of the CDS server.
|
|
5
|
+
The `cds-plugin-ui5` is a CDS server `cds-plugin` for the node runtime of the [SAP Cloud Application Programming Model (CAP)](https://cap.cloud.sap/docs/about/) which enables the integration of UI5 tooling based (UI5 freestyle or Fiori elements) projects into the CDS server via the UI5 tooling express middlewares. The UI5 or Fiori elements projects just need to be located in the `app` folder of the CDS server, or via the `cds.env.folders.app` variable, or be a dependency of the CDS server.
|
|
6
6
|
|
|
7
7
|
> :construction: **Note**
|
|
8
8
|
> This cds-plugin is still work in progress and not final yet!
|
package/cds-plugin.js
CHANGED
|
@@ -48,6 +48,46 @@ if (!skip) {
|
|
|
48
48
|
// to disable the ui5-middleware-cap if used in apps
|
|
49
49
|
process.env["cds-plugin-ui5"] = true;
|
|
50
50
|
|
|
51
|
+
const { execSync } = require("child_process");
|
|
52
|
+
const { readFileSync } = require("fs");
|
|
53
|
+
|
|
54
|
+
const { version: cdsPluginUI5Version } = require(`${__dirname}/package.json`);
|
|
55
|
+
|
|
56
|
+
// function to resolve a module with the given paths without throwing an error
|
|
57
|
+
const resolveModule = function resolveModule(moduleName, paths) {
|
|
58
|
+
try {
|
|
59
|
+
return require.resolve(moduleName, { paths });
|
|
60
|
+
} catch (error) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// find out the CDS-DK version to control the behavior of the plugin
|
|
66
|
+
const getCDSDKVersion = function getCDSDKVersion() {
|
|
67
|
+
const moduleName = "@sap/cds-dk";
|
|
68
|
+
let resolvedPath = resolveModule(`${moduleName}/package.json`);
|
|
69
|
+
if (!resolvedPath) {
|
|
70
|
+
const globalModulesPath = execSync("npm root -g").toString().trim();
|
|
71
|
+
resolvedPath = resolveModule(`${moduleName}/package.json`, [globalModulesPath]);
|
|
72
|
+
}
|
|
73
|
+
if (resolvedPath) {
|
|
74
|
+
const packageJson = JSON.parse(readFileSync(resolvedPath, { encoding: "utf-8" }));
|
|
75
|
+
return packageJson.version;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// get the CDS-DK version to control the behavior of the plugin
|
|
80
|
+
const cdsdkVersion = getCDSDKVersion();
|
|
81
|
+
|
|
82
|
+
// logging the version of the cds-plugin-ui5
|
|
83
|
+
log.info(`Running cds-plugin-ui5@${cdsPluginUI5Version} (@sap/cds-dk@${cdsdkVersion}, @sap/cds@${cds.version})`);
|
|
84
|
+
if (global.__cds_loaded_from?.size > 1) {
|
|
85
|
+
log.warn(" !! Multiple versions of @sap/cds loaded !!");
|
|
86
|
+
global.__cds_loaded_from.forEach((cdsPath) => {
|
|
87
|
+
log.warn(` => ${cdsPath}`);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
51
91
|
// promise to await the bootstrap and lock the
|
|
52
92
|
// served event to delay the startup a bit
|
|
53
93
|
let bootstrapped;
|
|
@@ -194,11 +234,11 @@ if (!skip) {
|
|
|
194
234
|
// check if the register function for build tasks is available at the cds object
|
|
195
235
|
// and if the Plugin class is available to register the cds build task to cover
|
|
196
236
|
// the tracks of the cds-plugin-ui5 workspace configuration and dependencies
|
|
237
|
+
const { minVersion, satisfies } = require("semver");
|
|
197
238
|
if (typeof cds.build?.register === "function" && typeof cds.build?.Plugin?.constructor === "function") {
|
|
198
239
|
const { readFile, writeFile } = require("fs").promises;
|
|
199
240
|
const { existsSync } = require("fs");
|
|
200
241
|
const { join } = require("path");
|
|
201
|
-
const { minVersion } = require("semver");
|
|
202
242
|
const util = require("util");
|
|
203
243
|
const exec = util.promisify(require("child_process").exec);
|
|
204
244
|
|
|
@@ -226,10 +266,16 @@ if (!skip) {
|
|
|
226
266
|
}
|
|
227
267
|
init() {}
|
|
228
268
|
clean() {
|
|
229
|
-
|
|
269
|
+
if (!satisfies(cdsdkVersion, ">=8")) {
|
|
270
|
+
this._priority = -1; // hack to ensure that the task is executed last!
|
|
271
|
+
}
|
|
230
272
|
}
|
|
231
273
|
get priority() {
|
|
232
|
-
|
|
274
|
+
if (!satisfies(cdsdkVersion, ">=8")) {
|
|
275
|
+
return this._priority || 1;
|
|
276
|
+
} else {
|
|
277
|
+
return -1;
|
|
278
|
+
}
|
|
233
279
|
}
|
|
234
280
|
async build() {
|
|
235
281
|
// determine the namespace from the model
|
|
@@ -277,8 +323,10 @@ if (!skip) {
|
|
|
277
323
|
}
|
|
278
324
|
);
|
|
279
325
|
} else {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
326
|
+
if (!satisfies(cdsdkVersion, ">=7.5.0")) {
|
|
327
|
+
// TODO: add error message to inform the user that the cds build task is not available
|
|
328
|
+
// and that the @sap/cds-dk version is too old to support the cds build task
|
|
329
|
+
log.warn("The cds build task requires @sap/cds-dk version >= 7.5.0! Skipping execution as your @sap/cds-dk version is too old...");
|
|
330
|
+
}
|
|
283
331
|
}
|
|
284
332
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cds-plugin-ui5",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
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",
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@ui5/fs": "^3.0.5",
|
|
15
|
-
"@ui5/project": "^3.9.
|
|
16
|
-
"@ui5/server": "^3.2.
|
|
15
|
+
"@ui5/project": "^3.9.2",
|
|
16
|
+
"@ui5/server": "^3.2.1",
|
|
17
17
|
"js-yaml": "^4.1.0",
|
|
18
18
|
"node-html-parser": "^6.1.13",
|
|
19
|
-
"semver": "^7.6.
|
|
19
|
+
"semver": "^7.6.3"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@sap/cds": "
|
|
23
|
-
"express": "
|
|
22
|
+
"@sap/cds": "*",
|
|
23
|
+
"express": "*"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@sap/cds": ">=6.8.2",
|
|
27
27
|
"express": ">=4.18.2"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "0a4076873a7fbd2fc675b5f9c2ec2efa3cd0518a"
|
|
30
30
|
}
|