@sap-ux/fe-fpm-writer 0.32.3 → 0.33.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.
@@ -91,7 +91,7 @@ async function generateCustomAction(basePath, actionConfig, fs) {
91
91
  if (!fs) {
92
92
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
93
93
  }
94
- (0, validate_1.validateBasePath)(basePath, fs);
94
+ await (0, validate_1.validateBasePath)(basePath, fs);
95
95
  const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
96
96
  const config = enhanceConfig(actionConfig, manifestPath, manifest);
97
97
  // Apply event handler
@@ -63,7 +63,7 @@ async function generateBuildingBlock(basePath, config, fs) {
63
63
  if (!fs) {
64
64
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
65
65
  }
66
- (0, validate_1.validateBasePath)(basePath, fs, []);
66
+ await (0, validate_1.validateBasePath)(basePath, fs, []);
67
67
  if (!fs.exists((0, path_1.join)(basePath, viewOrFragmentPath))) {
68
68
  throw new Error(`Invalid view path ${viewOrFragmentPath}.`);
69
69
  }
@@ -71,7 +71,7 @@ async function generateCustomColumn(basePath, customColumn, fs) {
71
71
  if (!fs) {
72
72
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
73
73
  }
74
- (0, validate_1.validateBasePath)(basePath, fs);
74
+ await (0, validate_1.validateBasePath)(basePath, fs);
75
75
  const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
76
76
  // merge with defaults
77
77
  const completeColumn = enhanceConfig(fs, customColumn, manifestPath, manifest);
@@ -23,7 +23,7 @@ export declare function validateDependenciesLibs(manifest: Manifest, dependencie
23
23
  * @param {string[]} dependencies - expected dependencies
24
24
  * @returns true if the path is valid, otherwise, throws and error
25
25
  */
26
- export declare function validateBasePath(basePath: string, fs?: Editor, dependencies?: string[]): boolean;
26
+ export declare function validateBasePath(basePath: string, fs?: Editor, dependencies?: string[]): Promise<boolean>;
27
27
  /**
28
28
  * Returns the message property if the error is an instance of `Error` else a string representation of the error.
29
29
  *
@@ -4,10 +4,10 @@ exports.validateVersion = validateVersion;
4
4
  exports.validateDependenciesLibs = validateDependenciesLibs;
5
5
  exports.validateBasePath = validateBasePath;
6
6
  exports.getErrorMessage = getErrorMessage;
7
- const path_1 = require("path");
8
7
  const mem_fs_1 = require("mem-fs");
9
8
  const mem_fs_editor_1 = require("mem-fs-editor");
10
9
  const semver_1 = require("semver");
10
+ const utils_1 = require("./utils");
11
11
  /**
12
12
  * Validate that the UI5 version requirement is valid.
13
13
  *
@@ -44,11 +44,11 @@ function validateDependenciesLibs(manifest, dependencies) {
44
44
  * @param {string[]} dependencies - expected dependencies
45
45
  * @returns true if the path is valid, otherwise, throws and error
46
46
  */
47
- function validateBasePath(basePath, fs, dependencies = ['sap.fe.templates']) {
47
+ async function validateBasePath(basePath, fs, dependencies = ['sap.fe.templates']) {
48
48
  if (!fs) {
49
49
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
50
50
  }
51
- const manifestPath = (0, path_1.join)(basePath, 'webapp', 'manifest.json');
51
+ const manifestPath = await (0, utils_1.getManifestPath)(basePath, fs);
52
52
  if (!fs.exists(manifestPath)) {
53
53
  throw new Error(`Invalid project folder. Cannot find required file ${manifestPath}`);
54
54
  }
@@ -179,7 +179,7 @@ async function generateControllerExtension(basePath, controllerConfig, fs) {
179
179
  if (!fs) {
180
180
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
181
181
  }
182
- (0, validate_1.validateBasePath)(basePath, fs);
182
+ await (0, validate_1.validateBasePath)(basePath, fs);
183
183
  const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
184
184
  // merge with defaults
185
185
  const internalConfig = enhanceConfig(controllerConfig, manifestPath, manifest);
@@ -47,7 +47,7 @@ async function generateCustomFilter(basePath, filterConfig, fs) {
47
47
  if (!fs) {
48
48
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
49
49
  }
50
- (0, validate_1.validateBasePath)(basePath, fs);
50
+ await (0, validate_1.validateBasePath)(basePath, fs);
51
51
  const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
52
52
  const config = enhanceConfig(filterConfig, manifestPath, manifest);
53
53
  // Apply event handler
@@ -178,7 +178,7 @@ function initializeTargetSettings(data, addSettings) {
178
178
  */
179
179
  async function validatePageConfig(basePath, config, fs, dependencies = []) {
180
180
  // common validators
181
- (0, validate_1.validateBasePath)(basePath, fs, dependencies);
181
+ await (0, validate_1.validateBasePath)(basePath, fs, dependencies);
182
182
  // validate config against the manifest
183
183
  if (config.navigation?.sourcePage) {
184
184
  const { content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
@@ -85,7 +85,7 @@ async function generate(basePath, customSection, manifestTemplateRoot, fs) {
85
85
  if (!fs) {
86
86
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
87
87
  }
88
- (0, validate_1.validateBasePath)(basePath, fs);
88
+ await (0, validate_1.validateBasePath)(basePath, fs);
89
89
  const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
90
90
  // merge with defaults
91
91
  const completeSection = enhanceConfig(fs, customSection, manifestPath, manifest);
@@ -85,7 +85,7 @@ async function generateCustomView(basePath, customView, fs) {
85
85
  if (!fs) {
86
86
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
87
87
  }
88
- (0, validate_1.validateBasePath)(basePath, fs);
88
+ await (0, validate_1.validateBasePath)(basePath, fs);
89
89
  const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
90
90
  // merge with defaults
91
91
  const completeView = enhanceConfig(fs, customView, manifestPath, manifest);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fe-fpm-writer",
3
3
  "description": "SAP Fiori elements flexible programming model writer",
4
- "version": "0.32.3",
4
+ "version": "0.33.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -31,8 +31,8 @@
31
31
  "semver": "7.5.4",
32
32
  "xml-formatter": "2.6.1",
33
33
  "xpath": "0.0.33",
34
- "@sap-ux/fiori-annotation-api": "0.4.3",
35
- "@sap-ux/project-access": "1.29.4"
34
+ "@sap-ux/fiori-annotation-api": "0.4.4",
35
+ "@sap-ux/project-access": "1.29.5"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/inquirer": "8.2.6",
@@ -42,8 +42,8 @@
42
42
  "@types/mem-fs-editor": "7.0.1",
43
43
  "@types/semver": "7.5.2",
44
44
  "@types/vinyl": "2.0.7",
45
- "@sap-ux/i18n": "0.2.0",
46
- "@sap-ux/ui-prompting": "0.3.14"
45
+ "@sap-ux/i18n": "0.2.1",
46
+ "@sap-ux/ui-prompting": "0.3.15"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=18.x"