@sap-ux/cap-config-writer 0.12.10 → 0.12.13
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.
package/dist/cap-config/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enableCdsUi5Plugin = enableCdsUi5Plugin;
|
|
4
|
-
const
|
|
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 package_json_1 = require("./package-json");
|
|
@@ -17,7 +17,7 @@ async function enableCdsUi5Plugin(basePath, fs) {
|
|
|
17
17
|
if (!fs) {
|
|
18
18
|
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
19
19
|
}
|
|
20
|
-
const packageJsonPath = (0,
|
|
20
|
+
const packageJsonPath = (0, node_path_1.join)(basePath, 'package.json');
|
|
21
21
|
const packageJson = (fs.readJSON(packageJsonPath) ?? {});
|
|
22
22
|
(0, package_json_1.ensureMinCdsVersion)(packageJson);
|
|
23
23
|
await (0, package_json_1.enableWorkspaces)(basePath, packageJson);
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getCDSWatchScript = getCDSWatchScript;
|
|
4
4
|
exports.updateRootPackageJson = updateRootPackageJson;
|
|
5
5
|
exports.updateAppPackageJson = updateAppPackageJson;
|
|
6
|
-
const
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
7
|
const project_access_1 = require("@sap-ux/project-access");
|
|
8
|
-
const
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
9
|
const cap_config_1 = require("../cap-config");
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the CDS watch script for the CAP app.
|
|
@@ -52,9 +52,9 @@ async function updateExistingWatchScripts(fs, projectPath, appsPath, packageJson
|
|
|
52
52
|
for (const script in packageJson.scripts) {
|
|
53
53
|
if (script.startsWith('watch-') && packageJson?.scripts?.[script]?.includes('/webapp/')) {
|
|
54
54
|
const appName = script.split('-')[1];
|
|
55
|
-
const appPath = (0,
|
|
56
|
-
if ((0,
|
|
57
|
-
const manifestPath = (0,
|
|
55
|
+
const appPath = (0, node_path_1.join)(projectPath, appsPath, appName);
|
|
56
|
+
if ((0, node_fs_1.existsSync)(appPath)) {
|
|
57
|
+
const manifestPath = (0, node_path_1.join)(await (0, project_access_1.getWebappPath)(appPath), project_access_1.FileName.Manifest);
|
|
58
58
|
const manifest = fs.readJSON(manifestPath);
|
|
59
59
|
const appId = manifest['sap.app']?.id;
|
|
60
60
|
if (appId) {
|
|
@@ -91,7 +91,7 @@ async function updateScripts(fs, packageJson, { projectPath, projectName, appsPa
|
|
|
91
91
|
else {
|
|
92
92
|
cdsScripts = getCDSWatchScript(projectName);
|
|
93
93
|
}
|
|
94
|
-
updatePackageJsonWithScripts(fs, (0,
|
|
94
|
+
updatePackageJsonWithScripts(fs, (0, node_path_1.join)(projectPath, 'package.json'), cdsScripts);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Updates the root package.json file of CAP projects with the following changes:
|
|
@@ -107,7 +107,7 @@ async function updateScripts(fs, packageJson, { projectPath, projectName, appsPa
|
|
|
107
107
|
* @returns {Promise<void>} A Promise that resolves once the root package.json is updated.
|
|
108
108
|
*/
|
|
109
109
|
async function updateRootPackageJson(fs, projectName, sapux, capService, appId, addCdsUi5Plugin) {
|
|
110
|
-
const packageJsonPath = (0,
|
|
110
|
+
const packageJsonPath = (0, node_path_1.join)(capService.projectPath, 'package.json');
|
|
111
111
|
const packageJson = (fs.readJSON(packageJsonPath) ?? {});
|
|
112
112
|
const capNodeType = 'Node.js';
|
|
113
113
|
const appsPath = (await (0, project_access_1.getCapCustomPaths)(capService.projectPath)).app;
|
|
@@ -118,9 +118,9 @@ async function updateRootPackageJson(fs, projectName, sapux, capService, appId,
|
|
|
118
118
|
await updateScripts(fs, packageJson, { projectPath: capService.projectPath, projectName, appsPath, appId }, addCdsUi5Plugin);
|
|
119
119
|
}
|
|
120
120
|
if (sapux) {
|
|
121
|
-
const dirPath = (0,
|
|
121
|
+
const dirPath = (0, node_path_1.join)(capService.appPath ?? appsPath, projectName);
|
|
122
122
|
// Converts a directory path to a POSIX-style path.
|
|
123
|
-
const capProjectPath = (0,
|
|
123
|
+
const capProjectPath = (0, node_path_1.normalize)(dirPath).split(/[\\/]/g).join(node_path_1.posix.sep);
|
|
124
124
|
const sapuxExt = Array.isArray(packageJson?.sapux) ? [...packageJson.sapux, capProjectPath] : [capProjectPath];
|
|
125
125
|
fs.extendJSON(packageJsonPath, { sapux: sapuxExt });
|
|
126
126
|
}
|
|
@@ -133,7 +133,7 @@ async function updateRootPackageJson(fs, projectName, sapux, capService, appId,
|
|
|
133
133
|
* @param {string} appRoot The root directory of the application.
|
|
134
134
|
*/
|
|
135
135
|
function updateAppPackageJson(fs, appRoot) {
|
|
136
|
-
const packageJsonPath = (0,
|
|
136
|
+
const packageJsonPath = (0, node_path_1.join)(appRoot, 'package.json');
|
|
137
137
|
const packageJson = (fs.readJSON(packageJsonPath) ?? {});
|
|
138
138
|
delete packageJson.sapux;
|
|
139
139
|
if (packageJson?.scripts) {
|
|
@@ -4,7 +4,7 @@ exports.updateTsConfig = updateTsConfig;
|
|
|
4
4
|
exports.updateStaticLocationsInApplicationYaml = updateStaticLocationsInApplicationYaml;
|
|
5
5
|
const project_access_1 = require("@sap-ux/project-access");
|
|
6
6
|
const yaml_1 = require("@sap-ux/yaml");
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
8
|
const i18n_1 = require("../i18n");
|
|
9
9
|
/**
|
|
10
10
|
* Updates the tsconfig.json file to correct the type roots when node_modules
|
|
@@ -14,7 +14,7 @@ const i18n_1 = require("../i18n");
|
|
|
14
14
|
* @param {string} appRoot The root directory of the application.
|
|
15
15
|
*/
|
|
16
16
|
function updateTsConfig(fs, appRoot) {
|
|
17
|
-
const tsConfigPath = (0,
|
|
17
|
+
const tsConfigPath = (0, node_path_1.join)(appRoot, project_access_1.FileName.Tsconfig);
|
|
18
18
|
if (fs.exists(tsConfigPath)) {
|
|
19
19
|
const tsConfig = fs.readJSON(tsConfigPath);
|
|
20
20
|
if (tsConfig['compilerOptions']['typeRoots']) {
|
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.12.
|
|
4
|
+
"version": "0.12.13",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"semver": "7.5.4",
|
|
26
26
|
"xml-js": "1.6.11",
|
|
27
27
|
"@sap-ux/logger": "0.7.0",
|
|
28
|
-
"@sap-ux/project-access": "1.32.
|
|
29
|
-
"@sap-ux/yaml": "0.17.
|
|
30
|
-
"@sap-ux/fiori-generator-shared": "0.13.
|
|
28
|
+
"@sap-ux/project-access": "1.32.4",
|
|
29
|
+
"@sap-ux/yaml": "0.17.1",
|
|
30
|
+
"@sap-ux/fiori-generator-shared": "0.13.22"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/mem-fs": "1.1.2",
|