@sap-ux/mockserver-config-writer 0.9.19 → 0.9.20

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.enhancePackageJson = enhancePackageJson;
4
4
  exports.removeFromPackageJson = removeFromPackageJson;
5
- const path_1 = require("path");
5
+ const node_path_1 = require("node:path");
6
6
  /**
7
7
  * Enhance the package.json with dependency for mockserver.
8
8
  *
@@ -11,7 +11,7 @@ const path_1 = require("path");
11
11
  * @param config - optional config for mockserver
12
12
  */
13
13
  function enhancePackageJson(fs, basePath, config) {
14
- const packageJsonPath = (0, path_1.join)(basePath, 'package.json');
14
+ const packageJsonPath = (0, node_path_1.join)(basePath, 'package.json');
15
15
  const packageJson = fs.readJSON(packageJsonPath);
16
16
  enhanceDependencies(packageJson, config?.mockserverModule, config?.mockserverVersion);
17
17
  enhanceScripts(fs, packageJson);
@@ -88,7 +88,7 @@ function isUi5CliHigherTwo(devDependencies) {
88
88
  try {
89
89
  const versionString = devDependencies['@ui5/cli'];
90
90
  if (typeof versionString === 'string') {
91
- const majorVersion = parseInt(versionString.split('.')[0].match(/\d+/)?.[0] || '0', 10);
91
+ const majorVersion = Number.parseInt(versionString.split('.')[0].match(/\d+/)?.[0] || '0', 10);
92
92
  isHigherTwo = majorVersion > 2 ? true : false;
93
93
  }
94
94
  }
@@ -143,7 +143,7 @@ function removeMockserverUi5Dependencies(packageJson) {
143
143
  * @param basePath - path to application root, where package.json is
144
144
  */
145
145
  function removeFromPackageJson(fs, basePath) {
146
- const packageJsonPath = (0, path_1.join)(basePath, 'package.json');
146
+ const packageJsonPath = (0, node_path_1.join)(basePath, 'package.json');
147
147
  const packageJson = fs.readJSON(packageJsonPath);
148
148
  delete packageJson.scripts?.['start-mock'];
149
149
  if (packageJson.scripts && Object.keys(packageJson.scripts).length === 0) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.enhanceYaml = enhanceYaml;
4
4
  exports.removeMockDataFolders = removeMockDataFolders;
5
5
  exports.removeUi5MockYaml = removeUi5MockYaml;
6
- const path_1 = require("path");
6
+ const node_path_1 = require("node:path");
7
7
  const ui5_config_1 = require("@sap-ux/ui5-config");
8
8
  const project_access_1 = require("@sap-ux/project-access");
9
9
  const app_info_1 = require("../app-info");
@@ -31,9 +31,9 @@ const app_info_1 = require("../app-info");
31
31
  */
32
32
  async function enhanceYaml(fs, basePath, webappPath, config) {
33
33
  const overwrite = !!config?.overwrite;
34
- const ui5MockYamlPath = (0, path_1.join)(basePath, 'ui5-mock.yaml');
34
+ const ui5MockYamlPath = (0, node_path_1.join)(basePath, 'ui5-mock.yaml');
35
35
  let mockConfig;
36
- const manifest = fs.readJSON((0, path_1.join)(webappPath, 'manifest.json'));
36
+ const manifest = fs.readJSON((0, node_path_1.join)(webappPath, 'manifest.json'));
37
37
  // Prepare annotations list to be used in mockserver middleware config annotations
38
38
  const annotationSource = Object.values((0, app_info_1.getODataSources)(manifest, 'ODataAnnotation'));
39
39
  const annotationsConfig = [];
@@ -43,7 +43,7 @@ async function enhanceYaml(fs, basePath, webappPath, config) {
43
43
  const localUri = annotation.settings?.localUri;
44
44
  annotationsConfig.push({
45
45
  localPath: localUri
46
- ? `.${path_1.posix.sep}${(0, path_1.relative)(basePath, (0, path_1.join)(webappPath, localUri)).replaceAll(path_1.sep, path_1.posix.sep)}`
46
+ ? `.${node_path_1.posix.sep}${(0, node_path_1.relative)(basePath, (0, node_path_1.join)(webappPath, localUri)).replaceAll(node_path_1.sep, node_path_1.posix.sep)}`
47
47
  : undefined,
48
48
  urlPath: annotation.uri
49
49
  });
@@ -58,7 +58,7 @@ async function enhanceYaml(fs, basePath, webappPath, config) {
58
58
  serviceName: dataSource,
59
59
  servicePath: dataSources[dataSource].uri,
60
60
  metadataPath: localUri
61
- ? `.${path_1.posix.sep}${(0, path_1.relative)(basePath, (0, path_1.join)(webappPath, localUri)).replaceAll(path_1.sep, path_1.posix.sep)}`
61
+ ? `.${node_path_1.posix.sep}${(0, node_path_1.relative)(basePath, (0, node_path_1.join)(webappPath, localUri)).replaceAll(node_path_1.sep, node_path_1.posix.sep)}`
62
62
  : undefined
63
63
  });
64
64
  }
@@ -66,7 +66,7 @@ async function enhanceYaml(fs, basePath, webappPath, config) {
66
66
  mockConfig = await updateUi5MockYamlConfig(fs, basePath, webappPath, ui5MockYamlPath, dataSourcesConfig, annotationsConfig, overwrite);
67
67
  }
68
68
  else {
69
- mockConfig = fs.exists((0, path_1.join)(basePath, 'ui5.yaml'))
69
+ mockConfig = fs.exists((0, node_path_1.join)(basePath, 'ui5.yaml'))
70
70
  ? await generateUi5MockYamlBasedOnUi5Yaml(fs, basePath, webappPath, dataSourcesConfig, annotationsConfig)
71
71
  : await generateNewUi5MockYamlConfig(manifest['sap.app']?.id || '', basePath, webappPath, dataSourcesConfig, annotationsConfig);
72
72
  }
@@ -81,14 +81,14 @@ async function enhanceYaml(fs, basePath, webappPath, config) {
81
81
  */
82
82
  async function removeMockDataFolders(fs, basePath) {
83
83
  const webappPath = await (0, project_access_1.getWebappPath)(basePath, fs);
84
- const manifestPath = (0, path_1.join)(webappPath, project_access_1.FileName.Manifest);
84
+ const manifestPath = (0, node_path_1.join)(webappPath, project_access_1.FileName.Manifest);
85
85
  const manifest = fs.readJSON(manifestPath);
86
86
  // Read service names from manifest.json
87
87
  const dataSources = manifest['sap.app'].dataSources;
88
88
  if (dataSources) {
89
89
  const serviceNames = Object.keys(dataSources);
90
90
  serviceNames.forEach((serviceName) => {
91
- const mockdataPath = (0, path_1.join)(webappPath, project_access_1.DirName.LocalService, serviceName, project_access_1.DirName.Data);
91
+ const mockdataPath = (0, node_path_1.join)(webappPath, project_access_1.DirName.LocalService, serviceName, project_access_1.DirName.Data);
92
92
  if (mockdataPath) {
93
93
  fs.delete(mockdataPath);
94
94
  }
@@ -182,7 +182,7 @@ async function getNewMockserverMiddleware(basePath, webappPath, dataSourcesConfi
182
182
  * @param basePath - path to project root, where package.json and ui5.yaml is
183
183
  */
184
184
  function removeUi5MockYaml(fs, basePath) {
185
- const ui5MockYamlPath = (0, path_1.join)(basePath, 'ui5-mock.yaml');
185
+ const ui5MockYamlPath = (0, node_path_1.join)(basePath, 'ui5-mock.yaml');
186
186
  if (fs.exists(ui5MockYamlPath)) {
187
187
  fs.delete(ui5MockYamlPath);
188
188
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMockserverConfigQuestions = getMockserverConfigQuestions;
4
- const path_1 = require("path");
4
+ const node_path_1 = require("node:path");
5
5
  const mem_fs_1 = require("mem-fs");
6
6
  const mem_fs_editor_1 = require("mem-fs-editor");
7
7
  const app_info_1 = require("../app-info");
@@ -23,7 +23,7 @@ function getMockserverConfigQuestions(params) {
23
23
  };
24
24
  if (params?.webappPath) {
25
25
  const fs = params.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
26
- const manifest = JSON.parse(fs.read((0, path_1.join)(params.webappPath, 'manifest.json')));
26
+ const manifest = JSON.parse(fs.read((0, node_path_1.join)(params.webappPath, 'manifest.json')));
27
27
  const mainDataSourceUri = (0, app_info_1.getMainServiceDataSource)(manifest)?.uri ?? '';
28
28
  const oDataSources = (0, app_info_1.getODataSources)(manifest);
29
29
  const choices = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/mockserver-config-writer",
3
3
  "description": "Add or update configuration for SAP Fiori tools mockserver",
4
- "version": "0.9.19",
4
+ "version": "0.9.20",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -22,8 +22,8 @@
22
22
  "i18next": "25.3.0",
23
23
  "mem-fs": "2.1.0",
24
24
  "mem-fs-editor": "9.4.0",
25
- "@sap-ux/project-access": "1.32.2",
26
- "@sap-ux/ui5-config": "0.29.6"
25
+ "@sap-ux/project-access": "1.32.3",
26
+ "@sap-ux/ui5-config": "0.29.7"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/mem-fs": "1.1.2",