cds-plugin-ui5 0.7.0 → 0.7.2

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,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.7.2](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.7.1...cds-plugin-ui5@0.7.2) (2023-10-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **cds-plugin-ui5:** disable plugin for JEST test execution ([#906](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/906)) ([b2b3c01](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/b2b3c013368a7c87e3ee28972e7207d6bacd2d30)), closes [#901](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/901)
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.7.1](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.7.0...cds-plugin-ui5@0.7.1) (2023-10-30)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **cds-plugin-ui5:** remove activation hook since it's not needed ([#900](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/900)) ([86fde7e](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/86fde7e1cd709c52fc32cee2184b18bf6ea3f16d)), closes [#899](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/899)
23
+
24
+
25
+
26
+
27
+
6
28
  # [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
29
 
8
30
 
package/README.md CHANGED
@@ -146,6 +146,14 @@ module.exports = async ({ log, resources, options }) => {
146
146
 
147
147
  The returned app pages will be added to the welcome page within the respective mount path.
148
148
 
149
+ ## Hints
150
+
151
+ This section includes hints for the usage of the `cds-plugin-ui5` with other tools.
152
+
153
+ ### JEST
154
+
155
+ The `cds-plugin-ui5` doesn't work with JEST out of the box as it internally is using dynamic imports to load helpers from the UI5 tooling. JEST fails with a `segmentation fault` error and therefore, the `cds-plugin-ui5` is disabled when running in context of JEST. It can be forcefully enabled by setting the environment variable `CDS_PLUGIN_UI5_ACTIVE=true`. But in this case you need to at least use Node.js 21 (https://github.com/nodejs/node/issues/35889) and you need to enable the experimental support for ES modules (https://jestjs.io/docs/ecmascript-modules). This enables the `cds-plugin-ui5` to run in context of JEST.
156
+
149
157
  ## Support
150
158
 
151
159
  Please use the GitHub bug tracking system to post questions, bug reports or to create pull requests.
package/cds-plugin.js CHANGED
@@ -1,7 +1,32 @@
1
+ const log = require("./lib/log");
2
+
3
+ // >> IMPORTANT <<
4
+ //
5
+ // JEST has issues with dynamic imports and will fail when they are used,
6
+ // e.g. in the findUI5Modules the UI5 tooling is used which is implemented
7
+ // using ES modules. To avoid issues when running JEST tests, the plugin
8
+ // will be disabled by default but it can be enforced with CDS_PLUGIN_UI5_ACTIVE=true
9
+ // since JEST supports ES modules when using Node.js 21 and the experimental
10
+ // support for VM modules via:
11
+ //
12
+ // > NODE_OPTIONS=--experimental-vm-modules jest
13
+ //
14
+ // Details can be found in the following issue:
15
+ // - https://github.com/ui5-community/ui5-ecosystem-showcase/issues/901
16
+ //
17
+ // To disable JEST we rely on env variables (see https://jestjs.io/docs/environment-variables)
18
+ if (process.env.NODE_ENV === "test" && process.env.JEST_WORKER_ID && process.env.CDS_PLUGIN_UI5_ACTIVE !== "true") {
19
+ log.info("Skip execution of plugin because JEST is running tests! To force the execution of the plugin set env var CDS_PLUGIN_UI5_ACTIVE=true...");
20
+ return;
21
+ }
22
+ if (process.env.CDS_PLUGIN_UI5_ACTIVE === "false") {
23
+ log.info("Skip execution of plugin because it has been disabled by env var CDS_PLUGIN_UI5_ACTIVE!");
24
+ return;
25
+ }
26
+
1
27
  // @sap/cds/lib/index.js#138: global.cds = cds // REVISIT: using global.cds seems wrong
2
28
  const cds = global.cds || require("@sap/cds"); // reuse already loaded cds!
3
29
 
4
- const log = require("./lib/log");
5
30
  const findUI5Modules = require("./lib/findUI5Modules");
6
31
  const createPatchedRouter = require("./lib/createPatchedRouter");
7
32
  const applyUI5Middleware = require("./lib/applyUI5Middleware");
@@ -160,12 +185,3 @@ if (!skip) {
160
185
  bootstrapped();
161
186
  });
162
187
  }
163
-
164
- // return callback for plugin activation
165
- module.exports = {
166
- activate: function activate(conf) {
167
- if (!skip) {
168
- log.debug("activate", conf);
169
- }
170
- },
171
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cds-plugin-ui5",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
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",
@@ -25,5 +25,5 @@
25
25
  "@sap/cds": ">=6.8.2",
26
26
  "express": ">=4.18.2"
27
27
  },
28
- "gitHead": "df6d62f98ada9f7852931b7292070111717f3949"
28
+ "gitHead": "8ca55ef4efc1ecf9f51340e20f3d240c8f8fb2d2"
29
29
  }