cds-plugin-ui5 0.12.0 → 0.12.1

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,17 @@
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.12.1](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.12.0...cds-plugin-ui5@0.12.1) (2025-05-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **cds-plugin-ui5:** check that it's the `cds` script ([#1215](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/1215)) ([e7f1c9a](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/e7f1c9a469d8ff89eab3b65feec8aa90c950cd42))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.12.0](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.11.2...cds-plugin-ui5@0.12.0) (2025-02-06)
7
18
 
8
19
 
package/cds-plugin.js CHANGED
@@ -12,6 +12,7 @@
12
12
  // Details can be found in the following issue:
13
13
  // - https://github.com/ui5-community/ui5-ecosystem-showcase/issues/901
14
14
  //
15
+
15
16
  // To disable JEST we rely on env variables (see https://jestjs.io/docs/environment-variables)
16
17
  let skip = false;
17
18
  if (process.env.NODE_ENV === "test" && process.env.JEST_WORKER_ID && process.env.CDS_PLUGIN_UI5_ACTIVE !== "true") {
@@ -70,7 +71,7 @@ if (!skip) {
70
71
  // to disable the ui5-middleware-cap if used in apps
71
72
  process.env["cds-plugin-ui5"] = true;
72
73
 
73
- const { dirname, join, resolve } = require("path");
74
+ const { dirname, join, resolve, parse } = require("path");
74
75
  const { readFileSync, existsSync, realpathSync } = require("fs");
75
76
  const { execSync } = require("child_process");
76
77
 
@@ -102,29 +103,30 @@ if (!skip) {
102
103
  // find out the CDS-DK version to control the behavior of the plugin
103
104
  const getCDSDKVersion = function getCDSDKVersion() {
104
105
  let cdsDkPath = process.argv[1];
105
- try {
106
- cdsDkPath = realpathSync(cdsDkPath);
107
- // eslint-disable-next-line no-unused-vars
108
- } catch (err) {
109
- // ignore
110
- }
111
- const cdsDkDir = dirname(cdsDkPath);
112
- const packageJsonPath = findPackageJson(cdsDkDir);
113
- if (packageJsonPath) {
114
- const packageJson = JSON.parse(readFileSync(packageJsonPath, { encoding: "utf-8" }));
115
- return packageJson.version;
116
- } else {
117
- const moduleName = "@sap/cds-dk";
118
- let resolvedPath = resolveModule(`${moduleName}/package.json`);
119
- if (!resolvedPath) {
120
- const globalModulesPath = execSync("npm root -g").toString().trim();
121
- resolvedPath = resolveModule(`${moduleName}/package.json`, [globalModulesPath]);
106
+ if (parse(cdsDkPath).name === "cds") {
107
+ try {
108
+ cdsDkPath = realpathSync(cdsDkPath);
109
+ // eslint-disable-next-line no-unused-vars
110
+ } catch (err) {
111
+ // ignore
122
112
  }
123
- if (resolvedPath) {
124
- const packageJson = JSON.parse(readFileSync(resolvedPath, { encoding: "utf-8" }));
113
+ const cdsDkDir = dirname(cdsDkPath);
114
+ const packageJsonPath = findPackageJson(cdsDkDir);
115
+ if (packageJsonPath) {
116
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, { encoding: "utf-8" }));
125
117
  return packageJson.version;
126
118
  }
127
119
  }
120
+ const moduleName = "@sap/cds-dk";
121
+ let resolvedPath = resolveModule(`${moduleName}/package.json`);
122
+ if (!resolvedPath) {
123
+ const globalModulesPath = execSync("npm root -g").toString().trim();
124
+ resolvedPath = resolveModule(`${moduleName}/package.json`, [globalModulesPath]);
125
+ }
126
+ if (resolvedPath) {
127
+ const packageJson = JSON.parse(readFileSync(resolvedPath, { encoding: "utf-8" }));
128
+ return packageJson.version;
129
+ }
128
130
  return undefined;
129
131
  };
130
132
 
@@ -387,7 +389,7 @@ if (!skip) {
387
389
  if (!satisfies(cdsdkVersion, ">=7.5.0")) {
388
390
  // TODO: add error message to inform the user that the cds build task is not available
389
391
  // and that the @sap/cds-dk version is too old to support the cds build task
390
- 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...");
392
+ LOG.warn(`The cds build task requires @sap/cds-dk version >= 7.5.0! Skipping execution as your @sap/cds-dk version ${cdsdkVersion} is too old...`);
391
393
  }
392
394
  }
393
395
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cds-plugin-ui5",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
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",
@@ -26,5 +26,5 @@
26
26
  "@sap/cds": ">=6.8.2",
27
27
  "express": ">=4.18.2"
28
28
  },
29
- "gitHead": "ce6bb3836d24a9318fe1c9fb394fb609195607ae"
29
+ "gitHead": "35b0530739ca74a6f61cffab4e0927dd7d129c10"
30
30
  }