@sap-ux/cap-config-writer 0.8.1 → 0.8.2
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.
|
@@ -1,33 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.getCDSWatchScript = getCDSWatchScript;
|
|
27
4
|
exports.updateRootPackageJson = updateRootPackageJson;
|
|
28
5
|
exports.updateAppPackageJson = updateAppPackageJson;
|
|
29
6
|
const project_access_1 = require("@sap-ux/project-access");
|
|
30
|
-
const path_1 =
|
|
7
|
+
const path_1 = require("path");
|
|
31
8
|
const cap_config_1 = require("../cap-config");
|
|
32
9
|
/**
|
|
33
10
|
* Retrieves the CDS watch script for the CAP app.
|
|
@@ -68,9 +45,10 @@ function updatePackageJsonWithScripts(fs, packageJsonPath, scripts) {
|
|
|
68
45
|
* @returns {Promise<void>} A Promise that resolves once the scripts are updated.
|
|
69
46
|
*/
|
|
70
47
|
async function updateScripts(fs, packageJsonPath, projectName, appId, enableNPMWorkspaces) {
|
|
71
|
-
const hasNPMworkspaces = await (0, cap_config_1.checkCdsUi5PluginEnabled)(packageJsonPath, fs);
|
|
48
|
+
const hasNPMworkspaces = await (0, cap_config_1.checkCdsUi5PluginEnabled)((0, path_1.dirname)(packageJsonPath), fs);
|
|
72
49
|
let cdsScript;
|
|
73
|
-
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
51
|
+
if (enableNPMWorkspaces || hasNPMworkspaces) {
|
|
74
52
|
// If the project uses npm workspaces (and specifically cds-plugin-ui5 ) then the project is served using the appId
|
|
75
53
|
cdsScript = getCDSWatchScript(projectName, appId);
|
|
76
54
|
}
|
|
@@ -106,7 +84,7 @@ async function updateRootPackageJson(fs, projectName, sapux, capService, appId,
|
|
|
106
84
|
if (sapux) {
|
|
107
85
|
const dirPath = (0, path_1.join)(capService.appPath ?? (await (0, project_access_1.getCapCustomPaths)(capService.projectPath)).app, projectName);
|
|
108
86
|
// Converts a directory path to a POSIX-style path.
|
|
109
|
-
const capProjectPath = path_1.
|
|
87
|
+
const capProjectPath = (0, path_1.normalize)(dirPath).split(/[\\/]/g).join(path_1.posix.sep);
|
|
110
88
|
const sapuxExt = Array.isArray(packageJson?.sapux) ? [...packageJson.sapux, capProjectPath] : [capProjectPath];
|
|
111
89
|
fs.extendJSON(packageJsonPath, { sapux: sapuxExt });
|
|
112
90
|
}
|
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.8.
|
|
4
|
+
"version": "0.8.2",
|
|
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": "
|
|
36
|
+
"@sap-ux/odata-service-inquirer": "1.2.2"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=18.x"
|