@sap-ux/app-config-writer 1.1.8 → 1.1.9

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.
@@ -4,7 +4,7 @@ import { create } from 'mem-fs-editor';
4
4
  import { getPreviewMiddleware, getIntentFromPreviewConfig, getCLIForPreview, readManifest } from '../common/utils.js';
5
5
  import { FileName, readUi5Yaml, getProjectType, findCapProjectRoot } from '@sap-ux/project-access';
6
6
  import { updateMiddlewaresForPreview } from '../common/ui5-yaml.js';
7
- import { ensureMinUI5Version } from './prerequisites.js';
7
+ import { ensureMinUI5Version, ensureCdsPluginUi5 } from './prerequisites.js';
8
8
  import { updateCapRootPackageJsonForCards } from './cap.js';
9
9
  const DEPENDENCY_NAME = '@sap-ux/cards-editor-middleware';
10
10
  const CARDS_GENERATOR_MIDDLEWARE = 'sap-cards-generator';
@@ -99,8 +99,11 @@ export async function enableCardGeneratorConfig(basePath, yamlPath, logger, fs,
99
99
  if (projectType === 'CAPJava') {
100
100
  throw new Error('The cards-editor command is not supported for CAP Java projects.');
101
101
  }
102
- if (projectType === 'CAPNodejs' && !capRoot) {
103
- throw new Error(`Could not find CAP project root for path '${basePath}'.`);
102
+ if (projectType === 'CAPNodejs') {
103
+ if (!capRoot) {
104
+ throw new Error(`Could not find CAP project root for path '${basePath}'.`);
105
+ }
106
+ await ensureCdsPluginUi5(capRoot, fs);
104
107
  }
105
108
  await updateMiddlewaresForPreview(fs, basePath, yamlPath, logger);
106
109
  await updateMiddlewareConfigWithGeneratorPath(fs, basePath, yamlPath, logger);
@@ -9,4 +9,13 @@ import type { Editor } from 'mem-fs-editor';
9
9
  * @throws {Error} if the minimum UI5 version requirement is not met
10
10
  */
11
11
  export declare function ensureMinUI5Version(basePath: string, fs: Editor): Promise<void>;
12
+ /**
13
+ * Ensures that `cds-plugin-ui5` is installed and enabled in the CAP root for CAP Node.js projects.
14
+ * The card generator relies on the CDS development server to serve the UI5 app, which requires this plugin.
15
+ *
16
+ * @param capRoot - path to the CAP project root
17
+ * @param fs - file system reference
18
+ * @throws {Error} if `cds-plugin-ui5` is not enabled in the CAP root
19
+ */
20
+ export declare function ensureCdsPluginUi5(capRoot: string, fs: Editor): Promise<void>;
12
21
  //# sourceMappingURL=prerequisites.d.ts.map
@@ -1,4 +1,4 @@
1
- import { getMinimumUI5Version, getProjectType, findProjectRoot } from '@sap-ux/project-access';
1
+ import { getMinimumUI5Version, getProjectType, findProjectRoot, checkCdsUi5PluginEnabled } from '@sap-ux/project-access';
2
2
  import { gte } from 'semver';
3
3
  import { readManifest } from '../common/utils.js';
4
4
  const MIN_UI5_VERSION_EDMX = '1.121.0';
@@ -23,4 +23,17 @@ export async function ensureMinUI5Version(basePath, fs) {
23
23
  throw new Error(`The card generator is only supported for projects with a minimum SAPUI5 version of ${featureVersion} or higher. The detected minimum SAPUI5 version is ${minUI5Version}. Update the sap.ui5.minUI5Version property in the manifest.json file and ensure the SAPUI5 version used is ${featureVersion} or higher.`);
24
24
  }
25
25
  }
26
+ /**
27
+ * Ensures that `cds-plugin-ui5` is installed and enabled in the CAP root for CAP Node.js projects.
28
+ * The card generator relies on the CDS development server to serve the UI5 app, which requires this plugin.
29
+ *
30
+ * @param capRoot - path to the CAP project root
31
+ * @param fs - file system reference
32
+ * @throws {Error} if `cds-plugin-ui5` is not enabled in the CAP root
33
+ */
34
+ export async function ensureCdsPluginUi5(capRoot, fs) {
35
+ if (!(await checkCdsUi5PluginEnabled(capRoot, fs))) {
36
+ throw new Error(`The cards-editor command requires 'cds-plugin-ui5' to be installed and enabled in the CAP root package.json.`);
37
+ }
38
+ }
26
39
  //# sourceMappingURL=prerequisites.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/app-config-writer",
3
3
  "description": "Add or update configuration for SAP Fiori tools application",
4
- "version": "1.1.8",
4
+ "version": "1.1.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -57,7 +57,7 @@
57
57
  "@types/cross-spawn": "6.0.6",
58
58
  "axios": "1.18.1",
59
59
  "nock": "14.0.15",
60
- "@sap-ux/preview-middleware": "1.0.38"
60
+ "@sap-ux/preview-middleware": "1.0.39"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=22.x"