@sap-ux/cap-config-writer 0.7.68 → 0.8.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.
@@ -29,7 +29,6 @@ exports.updateAppPackageJson = updateAppPackageJson;
29
29
  const project_access_1 = require("@sap-ux/project-access");
30
30
  const path_1 = __importStar(require("path"));
31
31
  const cap_config_1 = require("../cap-config");
32
- const i18n_1 = require("../i18n");
33
32
  /**
34
33
  * Retrieves the CDS watch script for the CAP app.
35
34
  *
@@ -66,34 +65,19 @@ function updatePackageJsonWithScripts(fs, packageJsonPath, scripts) {
66
65
  * @param {string} projectName - The project's name, which is the module name.
67
66
  * @param {string} appId - The application's ID, including its namespace and the module name.
68
67
  * @param {boolean} [enableNPMWorkspaces] - Whether to enable npm workspaces.
69
- * @param {CapServiceCdsInfo} cdsUi5PluginInfo - cds Ui5 plugin info.
70
- * @param {Logger} [log] - The logger instance for logging warnings.
71
68
  * @returns {Promise<void>} A Promise that resolves once the scripts are updated.
72
69
  */
73
- async function updateScripts(fs, packageJsonPath, projectName, appId, enableNPMWorkspaces, cdsUi5PluginInfo, log) {
74
- const packageJson = (fs.readJSON(packageJsonPath) ?? {});
70
+ async function updateScripts(fs, packageJsonPath, projectName, appId, enableNPMWorkspaces) {
75
71
  const hasNPMworkspaces = await (0, cap_config_1.checkCdsUi5PluginEnabled)(packageJsonPath, fs);
76
- // Determine whether to add cds watch scripts for the app based on the availability of minimum CDS version information.
77
- // If 'cdsUi5PluginInfo' contains version information and it satisfies the minimum required CDS version,
78
- // or if 'cdsUi5PluginInfo' is not available and the version specified in 'package.json' satisfies the minimum required version,
79
- // then set 'addScripts' to true. Otherwise, set it to false.
80
- const addScripts = cdsUi5PluginInfo?.hasMinCdsVersion
81
- ? cdsUi5PluginInfo.hasMinCdsVersion
82
- : (0, cap_config_1.satisfiesMinCdsVersion)(packageJson);
83
72
  let cdsScript;
84
- if (addScripts) {
85
- if (enableNPMWorkspaces ?? hasNPMworkspaces) {
86
- // If the project uses npm workspaces (and specifically cds-plugin-ui5 ) then the project is served using the appId
87
- cdsScript = getCDSWatchScript(projectName, appId);
88
- }
89
- else {
90
- cdsScript = getCDSWatchScript(projectName);
91
- }
92
- updatePackageJsonWithScripts(fs, packageJsonPath, cdsScript);
73
+ if (enableNPMWorkspaces ?? hasNPMworkspaces) {
74
+ // If the project uses npm workspaces (and specifically cds-plugin-ui5 ) then the project is served using the appId
75
+ cdsScript = getCDSWatchScript(projectName, appId);
93
76
  }
94
77
  else {
95
- log?.warn((0, i18n_1.t)('warn.cdsDKNotInstalled', { minCdsVersion: cap_config_1.minCdsVersion }));
78
+ cdsScript = getCDSWatchScript(projectName);
96
79
  }
80
+ updatePackageJsonWithScripts(fs, packageJsonPath, cdsScript);
97
81
  }
98
82
  /**
99
83
  * Updates the root package.json file of CAP projects with the following changes:
@@ -117,7 +101,7 @@ async function updateRootPackageJson(fs, projectName, sapux, capService, appId,
117
101
  await (0, cap_config_1.enableCdsUi5Plugin)(capService.projectPath, fs);
118
102
  }
119
103
  if (capService?.capType === capNodeType) {
120
- await updateScripts(fs, packageJsonPath, projectName, appId, enableNPMWorkspaces, capService.cdsUi5PluginInfo, log);
104
+ await updateScripts(fs, packageJsonPath, projectName, appId, enableNPMWorkspaces);
121
105
  }
122
106
  if (sapux) {
123
107
  const dirPath = (0, path_1.join)(capService.appPath ?? (await (0, project_access_1.getCapCustomPaths)(capService.projectPath)).app, projectName);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/cap-config-writer",
3
3
  "description": "Add or update configuration for SAP CAP projects",
4
- "version": "0.7.68",
4
+ "version": "0.8.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -33,7 +33,7 @@
33
33
  "@types/mem-fs": "1.1.2",
34
34
  "@types/mem-fs-editor": "7.0.1",
35
35
  "@types/semver": "7.5.2",
36
- "@sap-ux/odata-service-inquirer": "0.8.3"
36
+ "@sap-ux/odata-service-inquirer": "0.8.6"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=18.x"