@sap-ux/cf-deploy-config-writer 0.3.28 → 0.3.30
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/cf-writer/app-config.js +12 -12
- package/dist/cf-writer/base-config.js +2 -2
- package/dist/mta-config/index.js +9 -9
- package/dist/mta-config/mta.js +11 -11
- package/dist/utils.js +12 -12
- package/package.json +6 -6
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.generateAppConfig = generateAppConfig;
|
|
7
7
|
exports.generateMTAFile = generateMTAFile;
|
|
8
8
|
exports.generateUI5DeployConfig = generateUI5DeployConfig;
|
|
9
|
-
const
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
10
|
const mem_fs_1 = require("mem-fs");
|
|
11
11
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
12
12
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
@@ -90,7 +90,7 @@ async function getProjectProperties(config) {
|
|
|
90
90
|
let mtaId;
|
|
91
91
|
const foundMtaPath = await (0, project_access_1.getMtaPath)(config.appPath);
|
|
92
92
|
if (foundMtaPath) {
|
|
93
|
-
mtaPath = (0,
|
|
93
|
+
mtaPath = (0, node_path_1.dirname)(foundMtaPath.mtaPath);
|
|
94
94
|
mtaId = await (0, mta_config_1.getMtaId)(mtaPath);
|
|
95
95
|
}
|
|
96
96
|
const hasRoot = foundMtaPath?.hasRoot ?? false;
|
|
@@ -138,7 +138,7 @@ async function processUI5Config(appPath, fs) {
|
|
|
138
138
|
* @returns servicePath, firstServicePathSegment and appId properties
|
|
139
139
|
*/
|
|
140
140
|
async function processManifest(appPath, fs) {
|
|
141
|
-
const manifest = await (0, utils_1.readManifest)((0,
|
|
141
|
+
const manifest = await (0, utils_1.readManifest)((0, node_path_1.join)(await (0, project_access_1.getWebappPath)(appPath), project_access_1.FileName.Manifest), fs);
|
|
142
142
|
const appId = manifest?.['sap.app']?.id ? (0, mta_config_1.toMtaModuleName)(manifest?.['sap.app']?.id) : undefined;
|
|
143
143
|
const servicePath = manifest?.['sap.app']?.dataSources?.mainService?.uri;
|
|
144
144
|
const firstServicePathSegment = servicePath?.substring(0, servicePath?.indexOf('/', 1));
|
|
@@ -204,7 +204,7 @@ async function appendAppRouter(cfConfig, fs) {
|
|
|
204
204
|
addMissingModules: !cfConfig.addAppFrontendRouter
|
|
205
205
|
});
|
|
206
206
|
const appModule = cfConfig.appId;
|
|
207
|
-
const appRelativePath = (0, utils_1.toPosixPath)((0,
|
|
207
|
+
const appRelativePath = (0, utils_1.toPosixPath)((0, node_path_1.relative)(cfConfig.rootPath, cfConfig.appPath));
|
|
208
208
|
await mtaInstance.addApp(appModule, appRelativePath ?? '.');
|
|
209
209
|
if ((cfConfig.addMtaDestination && cfConfig.isCap) || cfConfig.destinationName === constants_1.DefaultMTADestination) {
|
|
210
210
|
// If the destination instance identifier is passed, create a destination instance
|
|
@@ -238,11 +238,11 @@ function cleanupStandaloneRoutes({ rootPath, appId }, mtaInstance, fs) {
|
|
|
238
238
|
const appRouterPath = mtaInstance.standaloneRouterPath;
|
|
239
239
|
if (appRouterPath) {
|
|
240
240
|
try {
|
|
241
|
-
const xsAppPath = (0,
|
|
242
|
-
const appRouterXsAppObj = fs.readJSON((0,
|
|
241
|
+
const xsAppPath = (0, node_path_1.join)(appRouterPath, project_access_1.FileName.XSAppJson);
|
|
242
|
+
const appRouterXsAppObj = fs.readJSON((0, node_path_1.join)(rootPath, xsAppPath));
|
|
243
243
|
if ((appRouterXsAppObj && !appRouterXsAppObj?.[constants_1.WelcomeFile]) || appRouterXsAppObj?.[constants_1.WelcomeFile] === '/') {
|
|
244
244
|
appRouterXsAppObj[constants_1.WelcomeFile] = `/${appId}`;
|
|
245
|
-
fs.writeJSON((0,
|
|
245
|
+
fs.writeJSON((0, node_path_1.join)(rootPath, xsAppPath), appRouterXsAppObj);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
catch (error) {
|
|
@@ -302,7 +302,7 @@ async function appendCloudFoundryConfigurations(cfConfig, fs) {
|
|
|
302
302
|
}
|
|
303
303
|
: {})
|
|
304
304
|
};
|
|
305
|
-
fs.copyTpl((0, utils_1.getTemplatePath)('app/xs-app-destination.json'), (0,
|
|
305
|
+
fs.copyTpl((0, utils_1.getTemplatePath)('app/xs-app-destination.json'), (0, node_path_1.join)(cfConfig.appPath, project_access_1.FileName.XSAppJson), defaultProperties);
|
|
306
306
|
await generateUI5DeployConfig(cfConfig, fs);
|
|
307
307
|
}
|
|
308
308
|
/**
|
|
@@ -313,14 +313,14 @@ async function appendCloudFoundryConfigurations(cfConfig, fs) {
|
|
|
313
313
|
*/
|
|
314
314
|
async function updateManifest(cfConfig, fs) {
|
|
315
315
|
const webappPath = await (0, project_access_1.getWebappPath)(cfConfig.appPath, fs);
|
|
316
|
-
const manifest = await (0, utils_1.readManifest)((0,
|
|
316
|
+
const manifest = await (0, utils_1.readManifest)((0, node_path_1.join)(webappPath, project_access_1.FileName.Manifest), fs);
|
|
317
317
|
if (manifest && cfConfig.cloudServiceName) {
|
|
318
318
|
const sapCloud = {
|
|
319
319
|
...(manifest['sap.cloud'] || {}),
|
|
320
320
|
public: true,
|
|
321
321
|
service: cfConfig.cloudServiceName
|
|
322
322
|
};
|
|
323
|
-
fs.extendJSON((0,
|
|
323
|
+
fs.extendJSON((0, node_path_1.join)(webappPath, project_access_1.FileName.Manifest), {
|
|
324
324
|
'sap.cloud': sapCloud
|
|
325
325
|
});
|
|
326
326
|
}
|
|
@@ -333,7 +333,7 @@ async function updateManifest(cfConfig, fs) {
|
|
|
333
333
|
*/
|
|
334
334
|
async function updateHTML5AppPackage(cfConfig, fs) {
|
|
335
335
|
let deployArgs = [];
|
|
336
|
-
if ((0, utils_1.fileExists)(fs, (0,
|
|
336
|
+
if ((0, utils_1.fileExists)(fs, (0, node_path_1.join)(cfConfig.appPath, project_access_1.FileName.MtaExtYaml))) {
|
|
337
337
|
deployArgs = ['-e', project_access_1.FileName.MtaExtYaml];
|
|
338
338
|
}
|
|
339
339
|
// Added for all flows
|
|
@@ -371,6 +371,6 @@ async function generateUI5DeployConfig(cfConfig, fs) {
|
|
|
371
371
|
});
|
|
372
372
|
ui5DeployConfig.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8' });
|
|
373
373
|
ui5DeployConfig.addCloudFoundryDeployTask(cfConfig.appId, addModulesTask, addTranspileTask);
|
|
374
|
-
fs.write((0,
|
|
374
|
+
fs.write((0, node_path_1.join)(cfConfig.appPath, project_access_1.FileName.UI5DeployYaml), ui5DeployConfig.toString());
|
|
375
375
|
}
|
|
376
376
|
//# sourceMappingURL=app-config.js.map
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateBaseConfig = generateBaseConfig;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
8
|
const mem_fs_1 = require("mem-fs");
|
|
9
9
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
@@ -28,7 +28,7 @@ async function generateBaseConfig(config, fs, logger) {
|
|
|
28
28
|
}
|
|
29
29
|
logger?.debug(`Generate base configuration using: \n ${JSON.stringify(config)}`);
|
|
30
30
|
(0, mta_config_1.validateMtaConfig)(config);
|
|
31
|
-
if ((0, utils_1.fileExists)(fs, (0,
|
|
31
|
+
if ((0, utils_1.fileExists)(fs, (0, node_path_1.join)(config.mtaPath, config.mtaId))) {
|
|
32
32
|
throw new Error((0, i18n_1.t)('error.mtaFolderAlreadyExists'));
|
|
33
33
|
}
|
|
34
34
|
(0, mta_config_1.createMTA)(config);
|
package/dist/mta-config/index.js
CHANGED
|
@@ -26,8 +26,8 @@ exports.doesCDSBinaryExist = doesCDSBinaryExist;
|
|
|
26
26
|
exports.validateMtaConfig = validateMtaConfig;
|
|
27
27
|
exports.addRoutingConfig = addRoutingConfig;
|
|
28
28
|
exports.generateCAPMTA = generateCAPMTA;
|
|
29
|
-
const
|
|
30
|
-
const
|
|
29
|
+
const node_fs_1 = require("node:fs");
|
|
30
|
+
const node_path_1 = require("node:path");
|
|
31
31
|
const ejs_1 = require("ejs");
|
|
32
32
|
const mta_1 = require("./mta");
|
|
33
33
|
const utils_1 = require("../utils");
|
|
@@ -86,7 +86,7 @@ function toMtaModuleName(appId) {
|
|
|
86
86
|
*/
|
|
87
87
|
function createMTA(config) {
|
|
88
88
|
const mtaId = `${config.mtaId.slice(0, 128)}`;
|
|
89
|
-
const mtaTemplate = (0,
|
|
89
|
+
const mtaTemplate = (0, node_fs_1.readFileSync)((0, utils_1.getTemplatePath)(`app/${project_access_1.FileName.MtaYaml}`), 'utf-8');
|
|
90
90
|
const mtaContents = (0, ejs_1.render)(mtaTemplate, {
|
|
91
91
|
id: mtaId,
|
|
92
92
|
mtaDescription: config.mtaDescription ?? constants_1.MTADescription,
|
|
@@ -94,7 +94,7 @@ function createMTA(config) {
|
|
|
94
94
|
});
|
|
95
95
|
config.mtaId = mtaId;
|
|
96
96
|
// Written to disk immediately! Subsequent calls are dependent on it being on the file system i.e mta-lib.
|
|
97
|
-
(0,
|
|
97
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(config.mtaPath, project_access_1.FileName.MtaYaml), mtaContents);
|
|
98
98
|
logger_helper_1.default.logger?.debug((0, i18n_1.t)('debug.mtaCreated', { mtaPath: config.mtaPath }));
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -151,14 +151,14 @@ function validateMtaConfig(config) {
|
|
|
151
151
|
* @deprecated this function is deprecated and will be removed in future releases
|
|
152
152
|
*/
|
|
153
153
|
async function createCAPMTAAppFrontend(config, fs) {
|
|
154
|
-
const mtaTemplate = (0,
|
|
154
|
+
const mtaTemplate = (0, node_fs_1.readFileSync)((0, utils_1.getTemplatePath)(`frontend/${project_access_1.FileName.MtaYaml}`), 'utf-8');
|
|
155
155
|
const mtaContents = (0, ejs_1.render)(mtaTemplate, {
|
|
156
156
|
id: `${config.mtaId.slice(0, 128)}`,
|
|
157
157
|
mtaDescription: config.mtaDescription ?? constants_1.MTADescription,
|
|
158
158
|
mtaVersion: config.mtaVersion ?? constants_1.MTAVersion
|
|
159
159
|
});
|
|
160
160
|
// Written to disk immediately! Subsequent calls are dependent on it being on the file system i.e mta-lib.
|
|
161
|
-
(0,
|
|
161
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(config.mtaPath, project_access_1.FileName.MtaYaml), mtaContents);
|
|
162
162
|
// Add missing configurations
|
|
163
163
|
(0, utils_1.addXSSecurityConfig)(config, fs, false);
|
|
164
164
|
logger_helper_1.default.logger?.debug((0, i18n_1.t)('debug.mtaCreated', { mtaPath: config.mtaPath }));
|
|
@@ -179,7 +179,7 @@ async function addStandaloneRouter(cfConfig, mtaInstance, fs) {
|
|
|
179
179
|
if (abapServiceName && abapService) {
|
|
180
180
|
await mtaInstance.addAbapService(abapServiceName, abapService);
|
|
181
181
|
}
|
|
182
|
-
fs.copyTpl((0, utils_1.getTemplatePath)(`router/package.json`), (0,
|
|
182
|
+
fs.copyTpl((0, utils_1.getTemplatePath)(`router/package.json`), (0, node_path_1.join)(cfConfig.mtaPath, `${constants_1.RouterModule}/${project_access_1.FileName.Package}`));
|
|
183
183
|
if (abapServiceName) {
|
|
184
184
|
let serviceKey;
|
|
185
185
|
try {
|
|
@@ -191,10 +191,10 @@ async function addStandaloneRouter(cfConfig, mtaInstance, fs) {
|
|
|
191
191
|
}
|
|
192
192
|
const endpoints = serviceKey?.endpoints ? Object.keys(serviceKey.endpoints) : [''];
|
|
193
193
|
const service = serviceKey ? serviceKey['sap.cloud.service'] : '';
|
|
194
|
-
fs.copyTpl((0, utils_1.getTemplatePath)('router/xs-app-abapservice.json'), (0,
|
|
194
|
+
fs.copyTpl((0, utils_1.getTemplatePath)('router/xs-app-abapservice.json'), (0, node_path_1.join)(cfConfig.mtaPath, `${constants_1.RouterModule}/${project_access_1.FileName.XSAppJson}`), { servicekeyService: service, servicekeyEndpoint: endpoints[0] });
|
|
195
195
|
}
|
|
196
196
|
else {
|
|
197
|
-
fs.copyTpl((0, utils_1.getTemplatePath)('router/xs-app-server.json'), (0,
|
|
197
|
+
fs.copyTpl((0, utils_1.getTemplatePath)('router/xs-app-server.json'), (0, node_path_1.join)(cfConfig.mtaPath, `${constants_1.RouterModule}/${project_access_1.FileName.XSAppJson}`));
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
/**
|
package/dist/mta-config/mta.js
CHANGED
|
@@ -4,8 +4,8 @@ exports.MtaConfig = void 0;
|
|
|
4
4
|
exports.isMTAFound = isMTAFound;
|
|
5
5
|
exports.useAbapDirectServiceBinding = useAbapDirectServiceBinding;
|
|
6
6
|
const util_1 = require("util");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
9
|
const ejs_1 = require("ejs");
|
|
10
10
|
const mta_lib_1 = require("@sap/mta-lib");
|
|
11
11
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
@@ -527,7 +527,7 @@ class MtaConfig {
|
|
|
527
527
|
this.log?.debug((0, i18n_1.t)('debug.processHTML5App', { appName }));
|
|
528
528
|
try {
|
|
529
529
|
// Supported apps will have a dependency on`@sap/ux-ui5-tooling`, assume it's a UI5 app managed by our tooling
|
|
530
|
-
const packageJson = JSON.parse((0,
|
|
530
|
+
const packageJson = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(this.mtaDir, app.path, project_access_1.FileName.Package), 'utf8'));
|
|
531
531
|
if (packageJson && (0, project_access_1.hasDependency)(packageJson, '@sap/ux-ui5-tooling')) {
|
|
532
532
|
app['build-parameters'].commands = ['npm install', 'npm run build:cf'];
|
|
533
533
|
await this.mta?.updateModule(app);
|
|
@@ -748,10 +748,10 @@ class MtaConfig {
|
|
|
748
748
|
destinationServiceName = `${this.prefix?.slice(0, 100)}-destination-service`;
|
|
749
749
|
}
|
|
750
750
|
const appMtaId = this.mtaId;
|
|
751
|
-
const mtaExtFilePath = (0,
|
|
751
|
+
const mtaExtFilePath = (0, node_path_1.join)(this.mta.mtaDirPath, project_access_1.FileName.MtaExtYaml);
|
|
752
752
|
let mtaExtensionYamlFile;
|
|
753
753
|
try {
|
|
754
|
-
const mtaExtContents = (0,
|
|
754
|
+
const mtaExtContents = (0, node_fs_1.readFileSync)(mtaExtFilePath, 'utf-8');
|
|
755
755
|
mtaExtensionYamlFile = await yaml_1.YamlDocument.newInstance(mtaExtContents);
|
|
756
756
|
}
|
|
757
757
|
catch (err) {
|
|
@@ -770,8 +770,8 @@ class MtaConfig {
|
|
|
770
770
|
destinationServiceName: destinationServiceName,
|
|
771
771
|
mtaVersion: '1.0.0'
|
|
772
772
|
};
|
|
773
|
-
const mtaExtTemplate = (0,
|
|
774
|
-
(0,
|
|
773
|
+
const mtaExtTemplate = (0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, `../../templates/app/${project_access_1.FileName.MtaExtYaml}`), 'utf-8');
|
|
774
|
+
(0, node_fs_1.writeFileSync)(mtaExtFilePath, (0, ejs_1.render)(mtaExtTemplate, mtaExt));
|
|
775
775
|
this.log?.info((0, i18n_1.t)('info.mtaExtensionCreated', { appMtaId, mtaExtFile: project_access_1.FileName.MtaExtYaml }));
|
|
776
776
|
}
|
|
777
777
|
else {
|
|
@@ -793,7 +793,7 @@ class MtaConfig {
|
|
|
793
793
|
path: `resources.${resIdx}.parameters.config.init_data.instance.destinations`,
|
|
794
794
|
value: nodeToInsert
|
|
795
795
|
});
|
|
796
|
-
(0,
|
|
796
|
+
(0, node_fs_1.writeFileSync)(mtaExtFilePath, mtaExtensionYamlFile.toString());
|
|
797
797
|
this.log?.info((0, i18n_1.t)('info.mtaExtensionUpdated', { mtaExtFile: project_access_1.FileName.MtaExtYaml }));
|
|
798
798
|
}
|
|
799
799
|
else {
|
|
@@ -1096,7 +1096,7 @@ exports.MtaConfig = MtaConfig;
|
|
|
1096
1096
|
* @returns {boolean} true | false if MTA configuration file is found
|
|
1097
1097
|
*/
|
|
1098
1098
|
function isMTAFound(dir) {
|
|
1099
|
-
return (0,
|
|
1099
|
+
return (0, node_fs_1.existsSync)((0, node_path_1.join)(dir, project_access_1.FileName.MtaYaml));
|
|
1100
1100
|
}
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Returns true if there's an MTA configuration file in the supplied directory and contains an ABAP service binding.
|
|
@@ -1113,11 +1113,11 @@ async function useAbapDirectServiceBinding(appPath, findMtaPath, mtaPath = '', l
|
|
|
1113
1113
|
if (findMtaPath) {
|
|
1114
1114
|
const foundMtaPath = await (0, project_access_1.getMtaPath)(appPath);
|
|
1115
1115
|
if (foundMtaPath) {
|
|
1116
|
-
rootPath = (0,
|
|
1116
|
+
rootPath = (0, node_path_1.dirname)(foundMtaPath.mtaPath);
|
|
1117
1117
|
}
|
|
1118
1118
|
}
|
|
1119
1119
|
else if (mtaPath) {
|
|
1120
|
-
rootPath = (0,
|
|
1120
|
+
rootPath = (0, node_path_1.dirname)(mtaPath);
|
|
1121
1121
|
}
|
|
1122
1122
|
if (rootPath) {
|
|
1123
1123
|
const mtaConfig = await MtaConfig.newInstance(rootPath, logger);
|
package/dist/utils.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.enforceValidRouterConfig = enforceValidRouterConfig;
|
|
|
18
18
|
exports.alignCdsVersions = alignCdsVersions;
|
|
19
19
|
exports.runCommand = runCommand;
|
|
20
20
|
exports.fileExists = fileExists;
|
|
21
|
-
const
|
|
21
|
+
const node_path_1 = require("node:path");
|
|
22
22
|
const semver_1 = require("semver");
|
|
23
23
|
const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
|
|
24
24
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
@@ -43,7 +43,7 @@ async function readManifest(manifestPath, fs) {
|
|
|
43
43
|
* @returns the path of the template specified or templates root folder
|
|
44
44
|
*/
|
|
45
45
|
function getTemplatePath(relativeTemplatePath) {
|
|
46
|
-
return (0,
|
|
46
|
+
return (0, node_path_1.join)(__dirname, '../templates', relativeTemplatePath);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Convert an app name to an MTA ID that is suitable for CF deployment.
|
|
@@ -61,7 +61,7 @@ function toMtaModuleName(id) {
|
|
|
61
61
|
* @returns Path to the directory with consistent separators
|
|
62
62
|
*/
|
|
63
63
|
function toPosixPath(dirPath) {
|
|
64
|
-
return (0,
|
|
64
|
+
return (0, node_path_1.normalize)(dirPath).split(/[\\/]/g).join(node_path_1.posix.sep);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Get the destination properties, based on the destination value.
|
|
@@ -116,7 +116,7 @@ function validateVersion(mtaVersion) {
|
|
|
116
116
|
* @returns {void}
|
|
117
117
|
*/
|
|
118
118
|
function addXSSecurityConfig({ mtaPath, mtaId }, fs, addTenant = true) {
|
|
119
|
-
fs.copyTpl(getTemplatePath(`common/${project_access_1.FileName.XSSecurityJson}`), (0,
|
|
119
|
+
fs.copyTpl(getTemplatePath(`common/${project_access_1.FileName.XSSecurityJson}`), (0, node_path_1.join)(mtaPath, project_access_1.FileName.XSSecurityJson), {
|
|
120
120
|
id: mtaId.slice(0, 100),
|
|
121
121
|
addTenant
|
|
122
122
|
});
|
|
@@ -128,7 +128,7 @@ function addXSSecurityConfig({ mtaPath, mtaId }, fs, addTenant = true) {
|
|
|
128
128
|
* @param fs reference to a mem-fs editor
|
|
129
129
|
*/
|
|
130
130
|
function addGitIgnore(targetPath, fs) {
|
|
131
|
-
fs.copyTpl(getTemplatePath('gitignore.tmpl'), (0,
|
|
131
|
+
fs.copyTpl(getTemplatePath('gitignore.tmpl'), (0, node_path_1.join)(targetPath, project_access_1.FileName.DotGitIgnore), {});
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* Appends server package.json to the project folder.
|
|
@@ -140,7 +140,7 @@ function addGitIgnore(targetPath, fs) {
|
|
|
140
140
|
* @returns {void}
|
|
141
141
|
*/
|
|
142
142
|
function addRootPackage({ mtaPath, mtaId }, fs) {
|
|
143
|
-
fs.copyTpl(getTemplatePath(project_access_1.FileName.Package), (0,
|
|
143
|
+
fs.copyTpl(getTemplatePath(project_access_1.FileName.Package), (0, node_path_1.join)(mtaPath, project_access_1.FileName.Package), {
|
|
144
144
|
mtaId
|
|
145
145
|
});
|
|
146
146
|
}
|
|
@@ -162,14 +162,14 @@ async function addCommonPackageDependencies(targetPath, fs) {
|
|
|
162
162
|
* @param addTenant If true, append tenant to the xs-security.json file
|
|
163
163
|
*/
|
|
164
164
|
async function generateSupportingConfig(config, fs, addTenant = true) {
|
|
165
|
-
if (config.mtaId && !fs.exists((0,
|
|
165
|
+
if (config.mtaId && !fs.exists((0, node_path_1.join)(config.mtaPath, 'package.json'))) {
|
|
166
166
|
addRootPackage(config, fs);
|
|
167
167
|
}
|
|
168
|
-
if (config.mtaId && !fs.exists((0,
|
|
168
|
+
if (config.mtaId && !fs.exists((0, node_path_1.join)(config.mtaPath, project_access_1.FileName.XSSecurityJson))) {
|
|
169
169
|
addXSSecurityConfig(config, fs, addTenant);
|
|
170
170
|
}
|
|
171
171
|
// Be a good citizen and add a .gitignore if missing from the existing project root
|
|
172
|
-
if (!fs.exists((0,
|
|
172
|
+
if (!fs.exists((0, node_path_1.join)(config.mtaPath, '.gitignore'))) {
|
|
173
173
|
addGitIgnore(config.mtaPath, fs);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -194,7 +194,7 @@ function setMtaDefaults(config) {
|
|
|
194
194
|
* @param fs - optional reference to a mem-fs editor
|
|
195
195
|
*/
|
|
196
196
|
async function updateRootPackage({ mtaId, rootPath }, fs) {
|
|
197
|
-
const packageExists = fileExists(fs, (0,
|
|
197
|
+
const packageExists = fileExists(fs, (0, node_path_1.join)(rootPath, project_access_1.FileName.Package));
|
|
198
198
|
// Append package.json only if mta.yaml is at a different level to the HTML5 app
|
|
199
199
|
if (packageExists) {
|
|
200
200
|
// Align CDS versions if missing otherwise mta.yaml before-all scripts will fail
|
|
@@ -202,7 +202,7 @@ async function updateRootPackage({ mtaId, rootPath }, fs) {
|
|
|
202
202
|
await (0, project_access_1.addPackageDevDependency)(rootPath, constants_1.Rimraf, constants_1.RimrafVersion, fs);
|
|
203
203
|
await (0, project_access_1.addPackageDevDependency)(rootPath, constants_1.MbtPackage, constants_1.MbtPackageVersion, fs);
|
|
204
204
|
let deployArgs = [];
|
|
205
|
-
if (fs?.exists((0,
|
|
205
|
+
if (fs?.exists((0, node_path_1.join)(rootPath, project_access_1.FileName.MtaExtYaml))) {
|
|
206
206
|
deployArgs = ['-e', project_access_1.FileName.MtaExtYaml];
|
|
207
207
|
}
|
|
208
208
|
for (const script of [
|
|
@@ -240,7 +240,7 @@ function enforceValidRouterConfig(config) {
|
|
|
240
240
|
* @param fs reference to a mem-fs editor
|
|
241
241
|
*/
|
|
242
242
|
async function alignCdsVersions(rootPath, fs) {
|
|
243
|
-
const filePath = (0,
|
|
243
|
+
const filePath = (0, node_path_1.join)(rootPath, project_access_1.FileName.Package);
|
|
244
244
|
const packageJson = (fs.readJSON(filePath) ?? {});
|
|
245
245
|
const cdsDKDevDepVersion = (0, semver_1.coerce)(packageJson?.devDependencies?.[constants_1.CDSDKPackage]);
|
|
246
246
|
const cdsDepVersion = packageJson?.dependencies?.[constants_1.CDSPackage];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/cf-deploy-config-writer",
|
|
3
3
|
"description": "Add or amend Cloud Foundry and ABAP deployment configuration for SAP projects",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.30",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"mem-fs": "2.1.0",
|
|
30
30
|
"mem-fs-editor": "9.4.0",
|
|
31
31
|
"hasbin": "1.2.3",
|
|
32
|
-
"@sap-ux/project-access": "1.32.
|
|
33
|
-
"@sap-ux/yaml": "0.17.
|
|
34
|
-
"@sap-ux/btp-utils": "1.1.
|
|
32
|
+
"@sap-ux/project-access": "1.32.3",
|
|
33
|
+
"@sap-ux/yaml": "0.17.1",
|
|
34
|
+
"@sap-ux/btp-utils": "1.1.4",
|
|
35
35
|
"@sap-ux/logger": "0.7.0",
|
|
36
|
-
"@sap-ux/ui5-config": "0.29.
|
|
37
|
-
"@sap-ux/nodejs-utils": "0.2.
|
|
36
|
+
"@sap-ux/ui5-config": "0.29.7",
|
|
37
|
+
"@sap-ux/nodejs-utils": "0.2.7"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/ejs": "3.1.2",
|